Hi all, I intend to read a proprietary serial data stream from another product into a spare PortA pin on a 16F pic. Currently 8Mhz internal osc, but the PCB is setup for a 3-pin resonator (20Mhz or other) resonator if necessary. Essentially there is a relatively long idle period, followed by over 70 sequential data bits which are around 400ms long each, and at approx 1% timing error from the sender. This becomes fun because I don't have interrupt-on-change on this pin, and trying to set a constant time for each bit will be difficult because and error will accumulate over 70 bits. So my plan is to generate Timer 2 interrupts every 50 to 100 ms looking for the idle period, then end-of-idle transition, adjust the timer (PR2) to poll in the middle as appropriate to capture the bit value, then adjust PR2 again to end a few percent before the expected transition, and then poll in a loop to accurately determine the edge/transition that marks the end of the bit (the beginning of the bit). The "few percent" will allow for all sources of timing errors from the sender, receiver (pic) clock, etc. Now the question -- since the pic is doing other things, the timer interrupt that should be triggered a few percent before the end of the bit may get delayed, so the few percent may change to 5 percent or more, and I could be waiting for maybe over 100 clock cycles before returning from that interrupt. I hate doing that, and always try to keep my interrupt processing as short as possible. Is there another/better way to do this? Cheers, -Neil. -- View this message in context: http://www.nabble.com/Better-way-to-read-a-serial-data-stream--tp25018655p25018655.html Sent from the PIC - [PIC] mailing list archive at Nabble.com. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist