|
Тема |
MP-50 Datecs - въпрос за CRC |
|
Автор | DP-5O (Нерегистриран) | |
Публикувано | 22.01.07 15:00 |
|
|
Из протокола на MP-50:
ALGORITHM FOR CRC CHECK ON RECEIVING
Three working bytes are used S1, S0 and RC
S1 - Most significant byte from the CRC ( it is received immediately after END)
S0 - Least significant byte from the CRC ( transmitted after S1)
RC - the current received byte in the block ( beginning from the first byte after BEG and ending 2 bytes after END).
The CRC is obtained as follows:
1. S1 and S0 are zeroed
2. RC is loaded with the current received byte
3. Points 3.1 and 3.2 are executed 8 times:
3.1. S1, S0 and RC are shifted 8 times to the left
3.2. if the MSB of S1 is 1 then MSB of S1 and LSB of S0 are inverted.
Points 2 and 3 are executed for all bytes, included in the calculation of the CRC - from the first byte after BEG up to and including 2 bytes after END.
S1 and S0 must be 0.
Тъй като в началото S1 и S0 са нули колкото и да ги шифтвам на ляво, условие 3.2 никага няма да бъде изпълнено и двата байта на CRC винаги ще са нули.
Аз ли нещо не мога да схвана или има грешка в протокола.
Някой да има информация как се смята CRC при приемане на инфо от касата и при предаване на инфо от PC.
|
| |
|
|
|