M
Magix
Hi,
I would like to add the char of string in hex (WORD format) to have the
checksum (in WORD).
E.g char *p =" Test"
so in hex (WORD), it will be
0x0054 (T)
0x0065 (e)
0x0073 (s)
0x0074 (t)
How can put p in 4 digits hex ?
for (i=0; i<strlen(p); i++)
{
// convert p to 4 digits hex
//checksum = checksum + p in 4 digits hex
}
How to add all of them in total to have the checksum ? checksum is 16 bits.
once I have the Checksum, let say 0x3450, I want to split them into MSB, and
LSB
send_char(0x34);
send_char(0x50);
void send_char(char p)
{
// send char
}
I would like to add the char of string in hex (WORD format) to have the
checksum (in WORD).
E.g char *p =" Test"
so in hex (WORD), it will be
0x0054 (T)
0x0065 (e)
0x0073 (s)
0x0074 (t)
How can put p in 4 digits hex ?
for (i=0; i<strlen(p); i++)
{
// convert p to 4 digits hex
//checksum = checksum + p in 4 digits hex
}
How to add all of them in total to have the checksum ? checksum is 16 bits.
once I have the Checksum, let say 0x3450, I want to split them into MSB, and
LSB
send_char(0x34);
send_char(0x50);
void send_char(char p)
{
// send char
}