I am trying to figure out the Checksum alrorithm used by one of the printers I am working with. I have set up a serial communications monitoring interface and was able to record the "conversation" betwee the device and the printer. At the end of the every data line, sent to the printer, device sends a 16 bit code. I suspect the device and the printer use CRC-16 algorithm to calculate this code.
Example 1 of the "conversation":
--------------------------
----------
----------
----------
----------
--------
1) Device:
4 4 0 4 48 227 86
2) Printer:
16 6
3)Device:
2 48 0 83 30 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 13 10 224 62
4) Printer:
16 21
As a result of this "Conversation" a Printer prints 83 underscore characters
--------------------------
----------
----------
----------
----------
----------
----------
------
Here is Example 2 of the recorded conversation:
1) Device:
4 4 0 4 48 227 86
2) Printer:
16 6
3) Device:
2 48 0 44 31 14 32 32 32 32 32 32 32 32 32 32 32 32 80 82 79 68 85 67 84 32 83 85 77 77 65 82 89 32 32 32 32 32 32 32 32 32 32 32 32 20 13 10 196 130
4) Printer:
16 21
As a result of this conversation, printer Prints Product Summary in the middle of the line
--------------------------
----------
----------
----------
----------
----------
--------
I have analized the strings sent by the device and here is what I've come up with.
2, 48, 0 - is likely to be a beginning of the printing command
44 (in exampe 2) and 83 (in example 1) - is likely to be the number of characters to be printed
[224 62] (in example 1) and [196 130] in example 2 is the checksum.
QUESTION:
Find the way to calculate this checksum.
Start Free Trial