Olin Lathrop wrote: >> : the 8 bit polynomial checksum > > 8 bits is very small for the size packets you are talking about. It may > be > good enough for your purposes if you don't really expect errors, which > might > be applicable in your case. I disagree. An 8-bit CRC is used in automotive protocols (including CAN), which were specifically designed for noisy environments. > You also need to think about timeouts when a ACK is not received. Think > carefully about what happens when the ACK itself is lost. The receiving > node got the command, executed it, and sent the ACK. The transmitting > node > has to assume the receiver never got the command. Most likely it will > resend after a timeout, but you have to think carefully about what the > receiving node might do if it receives two separate valid commands. A > sequence number is the usual way around this, but there are other > strategies. - Avoid "vague" commands ("toggle") in favor of more specific ones ("turn off") - Have the transmitter request the status before issuing the command again >> If I have other things to do, how do I create "tasks" so that >> the real tasks such as getting data from sensors, turning off the >> lights, and so on is done on a high priority basis? > > You don't need priorities, since you've got plenty of CPU time to go > around. > A simple round robin task manager should be just fine for this. Each task > does whatever it can do immediately, then calls TASK_YIELD to let all > other > tasks run once. When a task is waiting on a external event, it sits in a > loop checking the event and calling TASK_YIELD until the event condition > occurs. I'm curious, why do you think a task manager would be useful in this case? Vitaliy -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist