Hello I am quiet new at C# programming so would appreciate any help. I am writing a program to communicate via RS232 with a machine and need to send it a packet in the form:
My two byte CRC is 0x421F and I need to split it into two bytes to fit the format above.
When I convert to binary I get < 01000010 | 00011111 >
Obviously the left zero padding on the MSB doesn't matter but the padding on the LSB is important and I think converting it into < 0x42 | 0x1F > is not correct as it loses the zero padding on the LSB.
Thanks for any help
Maja :)
Code:
{ <DLE> , <STX> , "G" , <DLE> , <ETX> , <CRC> , <CRC> } byte[] byteToSend = new byte[] { 0x10, 0x02, 0x47, 0x10, 0x03, CRC , CRC };
When I convert to binary I get < 01000010 | 00011111 >
Obviously the left zero padding on the MSB doesn't matter but the padding on the LSB is important and I think converting it into < 0x42 | 0x1F > is not correct as it loses the zero padding on the LSB.
Thanks for any help
Maja :)
Comment