Hi All, I am having hard time to determine the length of =A0uart RX data. the data = length is unknown it is between (100-125 byte) and it is less then 128 byte= s. in my routine RX ISR clears the RX flag and saves the byte came in and incr= eases the counter. data_available is not used for now =A0 void __attribute__((interrupt, no_auto_psv)) _U2RXInterrupt(void) { =A0 =A0 uint8_t data_size_U2; =A0 =A0 =A0 =A0 IFS1bits.U2RXIF =3D 0; =A0 =A0 =A0 =A0 if (U2STAbits.URXDA =3D=3D 1) =A0 =A0 =A0 =A0 { =A0 =A0 =A0 =A0 =A0 =A0 U2_RX[new_counter] =3D U2RXREG; =A0 =A0 =A0// save = incoming byte =A0 =A0 =A0 =A0 =A0 =A0 counter++; =A0 =A0 // increment=A0 =A0 =A0 =A0 =A0 =A0 =A0 data_available =3D 1; =A0 =A0 =A0 =A0 =A0 =A0 GLED_ON; =A0 =A0 =A0 =A0 } } the counter contains total number of bytes but the question is how to check= when no more data is coming in? to use the counter. I was testing with IDEL flag =A0=A0=A0 U2STAbits.RIDLE I can see when uart = RX is active =A0the flag is set to 0. now the problem is even on first receive byte the flag will indicate as busy. so just using wh= en it is busy is not going to work. =A0 in my case I do not mind to deal with fixed 128 byte every time I already k= now the data is some where between 100-125 bytes. the only issue is when there is no data coming in the interr= upt will not occur and counting extra is not going to work. =A0the counter in ISR knows exact =A0length=A0of=A0bytes came in but I do n= ot know when to check the counter since I do not know the length of data. i am not sure if I explain clearly. the counter and U2_RX are global variab= les. any idea or suggestion will appreciate. thanks Andre =A0 =A0=A0 --=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 .