|
|
View previous topic :: View next topic |
Author |
Message |
Neil_J
Joined: 11 Jun 2006 Posts: 4
|
How to set timer up for simultaneous 4ch PWM, RS232, I2C? |
Posted: Sun Jun 25, 2006 6:48 pm |
|
|
I am developing a project that has a few different signals that all need to run simultaneously. I've done a few projects that only done one or two things but this one seems a little harder to me... My signals are:
- 4-channel PWM (red, green, blue LED's and 1x DC speed control) at about 4.4 mS
- RS232 8,n,1 @ 2400bps (rx + tx)
- I2C EEPROM (24AA08)
- Infrared remote using Philips RC-5 protocol
- Also some other signals that doesn't relate to the question..
I am hoping to do all this on a PIC16F684 @ 8 MHz.
The only way I can think to do it is to use a 8uS timer and four variables (1 for each signal type) to offset the timer. I don't see how I could generate an interrupt for each, and if I did an interrupt every 8uS I couldn't get that much done between them.
Does anyone have any suggestions, or possibly some example code?
Thanks,
Neil |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Jun 26, 2006 3:29 pm |
|
|
I would use the multi-tasking approach, as described in this thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=17189
Low speed processes are checked or updated at the tick rate (10 ms).
These would be keypad, checking RS-232 receive buffer, etc.
(This assumes an interrupt-driven RS-232 receive fifo).
High speed processes run independently at their own rate. These
could be running on a timer interrupt that runs faster than the tick rate.
(A separate hardware timer, other than the tick timer). This could
be the RC-5 receiver and the software PWM.
I'm not sure if you can do all of this in a PIC, unassisted by external
hardware. Normally, I try to use as many of the PIC's hardware
modules as possible. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|