You can disable the timer when there was a timeout (that is "end-of-package"), and then restart it at the next character (first character after the pause) isreceived. Then you will be looking for the next pause again. The timer should only be running during the receptment of an actual package. That is, *if* this method is the best for the actual case. Jan-Erik. Andre Abelian wrote 2014-02-03 00:08: > very good idea thanks. the only part I am not clear is the timers as soon= as activated it will run and overflow so > I have to keep it off until uart ISR will enable as soon as data comes in= .. > > ISR: > 1.clear timer to start from 0 > 2.enable timer > 3.RX uart got the data > 4.clear timer again once byte received > > > then function to process the UART data > 1. check for timer flag? if overflow > 2. disable timer > 3. end > > the way I see it if I do not disable the timer it will overflow without r= eceiving any data > > does it look correct? > > > thanks > > > > On Sunday, February 2, 2014 10:58 AM, Wouter van Ooijen = wrote: > > Dwayne Reid schreef op 02-Feb-14 7:12 PM: >> Generally, I reset a timer every time a new byte comes in. When the >> timer expires, I consider that to be the end of the packet. >> >> That works pretty well for me but in my case, the bytes are fairly >> close to each other, and the time between packets is much longer than >> one byte time. This doesn't work if the packets are really close togeth= er. >> >> > > And you'll get in trouble when an usb-to-serial converter is used. > > Wouter > --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .