Thank You Abdallah. I see you are getting the same result. I had tried EncodingAnsi! but the result is always 20 as you got. I am expecting 0X0C = 12 because the document about the device that I tried to communicate describe as follow; They added 0C to the end of the message, because the LRC of [STX]013210018"1208[FS][ETX] must be 0C.
from document:
Command string : [STX]013210018"1208[FS][ETX]0C
[STX] Start of message.
01 FDU # 1.
32 POS terminal # 32.
1 Command ‘1’ – encode keycard.
0018 Length = 18. From STX to LRC inclusive.
"1208 Room tag ‘"’. Room # 1208.
[FS] Field separator.
[ETX] End of message.
0C LRC = 0x0C
LRC for a PMS command is computed by exclusive OR’ing (XOR) the entire command string from STX to ETX inclusive.
Example code in ANSI C:
unsigned char computeLRC(unsigned char *msgBuffer, int len)
{
unsigned char LRC = 0;
int i;
for (i = 0; i < len; i++)
LRC ^= msgBuffer[i];
return LRC;
}