unsigned short LRC=0, LRCflag=1; if(LRCflag) LRC ^= inbyte; // Calculate Longitudinal Redundancy Check if(inbyte == 0xXX) LRCflag = XX; // Stop LRC calc after End Sentinel