Marco, I can see the advantages of your method, that was my original idea. Use interrupts to detect incoming pulse then switch to timer overflow interrupts to sample data stream. My problem is I would be tied to a special pin and the configuration that I am using won't allow that. So I used Danjel's method. I wrapped it up last night about midnight. Good news is it works great, bad news is it takes up lots of processor cycles. Fortunately in this application I have plenty to spare. The PIC is only taking data in, and sending it to a DAC via I2C protocol. I think it would be pretty easy to modify the code to work either way. James On Friday, March 13, 1998 2:39 AM, Marco DI LEO [SMTP:m.dileo@SISTINF.IT] wrote: > There are pros and cons in both approaches: > Danjel method pros: you can use any pin as RX line because you > sample it > using a bit test instruction. cons: if there is no traffic on the > line > you still have 3 int per bit time interrupting you main task. > My method pros: your main task is only interrupted when a > transmission > occur. If transmission are rare you can save lot of compute power. > cons: > you have to use specific pin for the RX line. On the 16C84 you can > choose between the RB0/INT and RA4/T0CK1. Use the latter setting > the > counter to external clock, no prescaler and preload it to 0xFF. At > the > the first edge the counter roll to 0x00 thus generating an int. The > RB0/INT method is easier but the RA4/T0CK1 saves you an interrupt > source > because you only use the timer/counter for bit timing/start bit > detection, having the RB0/INT free for other purposes. > > The choice of the method used to detect the start bit depends > completely > on your application and on the timing of your main task.