Domanda

I have a very old device that I am connecting to through serial. When I am sending data it wants a checksum to be calculated with it. I add up all of the ascii valuesof the characters of the string and convert the sum to BCD. This results in illegal BCD characters such as 1011. In the only example that is provided they convert 1011 to ";". When I sent the data in the example the checksum clears fine. But when I use ";" for other illegal characters it fails. Has anyone seen the use of ";" before and if so does anyone have any idea what the values for the other illegal characters are?

edit : The Example I have:

STX       000    0010
1         011    0001
2         011    0010
3         011    0011
CR        000    1101
A         100    0001
B         100    0010
C         100    0011
CR        000    1101
EXT       000    0011

Total    10111   1011
Convert To BCD 1  0111 1011
Checksum       1   7   ;
È stato utile?

Soluzione

Looks like they're using the next six ASCII characters:

DEC    HEX1    HEX2    BIN1    BIN2    CHAR
48     3       0       0011    0000    0
49     3       1       0011    0001    1
50     3       2       0011    0010    2
51     3       3       0011    0011    3
52     3       4       0011    0100    4
53     3       5       0011    0101    5
54     3       6       0011    0110    6
55     3       7       0011    0111    7
56     3       8       0011    1000    8
57     3       9       0011    1001    9
58     3       A       0011    1010    :
59     3       B       0011    1011    ;
60     3       C       0011    1100    <
61     3       D       0011    1101    =
62     3       E       0011    1110    >
63     3       F       0011    1111    ?
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top