>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? Right, sorry to be so late replying, but I have been away for 9 weeks looking after my ailing father. My response is to refer you to the M6800 Applications manual that was printed around the late 1970s. Someone posted a link here to a downloadable PDF copy when I mentioned this some time in the past, so check the archives. My reason for mentioning it is that they do a scheme something like you are suggesting, to read a barcode wand for UPC codes, which is hand scanned across the barcode, so has to deal with variable speed scans, as well as widely different scan rates. Should give you some good ideas on what you need to do to get good results every time. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist