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 Count 1 2 3 4 5 6 7 8 9 10 11 12
Data P1 P2 d7 P4 d6 d5 d4 P8 d3 d2 d1 d0
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