very good idea thanks. the only part I am not clear is the timers as soon a= s 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 =A0to 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=A0 2. disable timer 3. end the way I see it if I do not disable the timer it will overflow without rec= eiving any data does it look correct? thanks On Sunday, February 2, 2014 10:58 AM, Wouter van Ooijen wr= ote: =20 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.=A0 This doesn't work if the packets are really close toget= her. > > 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 --=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 .