On Thu, 12 Mar 1998 17:24:33 -0600 James & Ili writes: >Danjel, > This sounds like a great solution. > If I understand you, then you would use the timer to generate >the >interrupt >and just change the value that's loaded in the timer depending on the >mode you're in >i.e. at 9600 baud >Wait for start bit mode. clear timer ( set to 256 counts) >check pin when timer overflows and triggers interrupt > >Sample signal mode. set timer to 152 >check pin when timer overflows >I will try to implement it now. > > Thanks a bunch !!! >P.S. Is there anything I need to do when I put a value into the >timer? Remember the timer counts *up*, so the value you write should be 256-N where N is the number of counts you want before the next interrupt. You need to be sure the TOIF flag is clear after writing the timer and before enabling the timer interrupt. Also, writing the timer stops it for 2 PIC instruction cycles and resets the prescaler (if enabled). For consistent, exact timing, always write the timer at the same point in (same number of cycles into) the ISR. Putting a debug feature into your ISR that pulses a pin right after a sample of the data line is taken can be very helpful. Observed on a dual trace scope, the sample pulses should occur very near the center of the incoming data bits. _____________________________________________________________________ You don't need to buy Internet access to use free Internet e-mail. Get completely free e-mail from Juno at http://www.juno.com Or call Juno at (800) 654-JUNO [654-5866]