001 unsigned char getParity(char data) { 002 003 data ^= data >> 4; 004 data ^= data >> 2; 005 data ^= data >> 1; 006 return((data & 0x01) ^ 0x01); 007 }