2.1 Encoding

For encoding, the 4-bit parity has to be calculated and added to the data stream. The following table describes how parity is calculated and added to the data stream.

Table 2-1. Encoding
Bit Count123456789101112
DataP1P2d7P4d6d5d4P8d3d2d1d0
Table 2-2. Calculations
Formula

P1 = d7 ⊕ d6 ⊕ d4 ⊕ d3 ⊕ d1

P2 = d7 ⊕ d5 ⊕ d4 ⊕ d2 ⊕ d1

P4 = d6 ⊕ d5 ⊕ d4 ⊕ d0

P8 = d3 ⊕ d2 ⊕ d1 ⊕ d0

Example Calculation
  • User data = 0x55

    P1 = 0 ⊕ 1 ⊕ 1 ⊕ 0 ⊕ 0 = 0

    P2 = 0 ⊕ 0 ⊕ 1 ⊕ 1 ⊕ 0 = 0

    P4 = 1 ⊕ 0 ⊕ 1 ⊕ 1 = 1

    P8 = 0 ⊕ 1 ⊕ 0 ⊕ 1 = 0

  • Parity (P8,P4,P2,P1) = 0x4
  • Data to transmit (d7-d0 + parity) = 0x554
Note:
  • d7-d0 – User data
  • PX – Parity
  • ⊕ – XOR operator