Hi, Hope this bit of code might help. bRF_Timeout = false; cRF_Time = cTick + 6; cRX_RF_Byte = RCREG2; //otherwise, get data byte from Receive(1) buffer switch (cRF_Mode) //RF RX state machine { //must receive PREAMBLEe followed immediately by SYNC to start reception case IDLE : if(cRX_RF_Byte = PREAMBLE) //Is current byte a PREAMBLE (0xAA) byte ? { cRF_Mode = GOT_PREAMBLE; //YES.. then switch state to look for SYNC byte (0X33) } break; //NO... then ignore and stay in IDLE mode case GOT_PREAMBLE : if(cRX_RF_Byte == SYNC) //is current byte SYNC ? { cRF_Mode = RECEIVING; //YES.. change state to receive mode cRX_RF_Ptr = 0; //reset RX data buffer pointer } //NO... if another PREAMBLE then stay in present state else if(cRX_RF_Byte != 0xAA) cRF_Mode = IDLE; //else reset state back to IDLE break; case RECEIVING : cRX_RF_Buf[cRX_RF_Ptr] = cRX_RF_Byte; //store byte into RF Receive buffer cRX_RF_Ptr++; //point to next location in buffer if(cRX_RF_Ptr > 9) //fixed length packet has been received { cRF_Mode = IDLE; //reset state machine to IDLE mode bReceived_RF_Packet = true; //set flag to indicate packet has arrived break; } } //end of switch routine The main program loop setes cRX_Mode = IDLE if timeout occurs due to incomplete packet being receieved. Regards David Huisman -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics