Philips FMod-TCP BOX Manual de usuario Pagina 20

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 58
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 19
20 / 58
Checksum calculation
This checksum is the same as the IP checksum.
Definition: sum of 1’s complement of all 16 bits words of whole message
(FiveCo packet) except checksum bytes.
Note: all values are unsigned!
Sequence:
1. Clear accumulator
Loop
x. Only if last word is not made of two bytes, the data byte is the upper byte (big endian)
2. Compute 1’s complement of each 16bits word, result is 16bits
3. Convert last result from 16 bits to 32 bits, result is 32bits: 0x0000+last result
4. Add last result to the 32 bits accumulator
Try the Loop
5. Convert accumulator in two 16bits words
6. Add those two 16bits words, result is 16bits word.
7. If an overflow occurs with the last addition (Carry), add 1 to the last result.
8. Last result is the final result
Example (in hexadecimal):
!0x0021 (0XFFDE) Æ 0x0000FFDE (Read)
+!0x1234 (0xEDCB) Æ 0x0001EDA9 (TransID)
+!0x0003 (0xFFFC) Æ 0x0002EDA5 (3 reg to read)
+!0x0A10 (0XF5EF) Æ 0x0003E394 (reg 0A,10,02)
+!0x02(00)(0XFDFF) Æ 0x0004E193
Note that in this case a last 00 is implicitly used. (02 Æ 02 00).
0x0004 + 0xE193 = 0xE197, (carry=0)
0
xE197 + carry = 0xE197
Checksum = 0xE197
FMod-TCP User Manual v.2.8
Vista de pagina 19
1 2 ... 15 16 17 18 19 20 21 22 23 24 25 ... 57 58

Comentarios a estos manuales

Sin comentarios