Scan IF Operation
24-34 Scan IF
Figure 2420. Quadrature Decoding State Diagram
00
10
11
01
00
10
11
01
Correct State Transitions Erroneous State Transitions
+11

To transfer the state encoding into counts it is necessary to decide what

fraction of the rotation should be counted and on what state transitions. In this

example only full rotations will be counted on the transition from state 00 to 01

or 10 using a 180° disk with the sensors 90° apart. All the possible state

transitions can be put into a table and this table can be translated into the

corresponding state table entries for the processing state machine as shown

in Table 248.

Table 248.Quadrature Decoding PSM Table
Previous Current Movement State Table Entry
Quad. Quad. Q6 Q2 Q1 Q3 Q0
Pair Pair Error 1 +1 Current
Quad.
Pair
Byte
Code
00 00 No Rotation 0 0 0 0 0 000h
00 01 Turns right, +1 0 0 1 0 1 003h
00 10 Turns left, 101 0 1 0 00Ch
00 11 Error 1 0 0 1 1 049h
01 00 Turns left 0 0 0 0 0 000h
01 01 No rotation 0 0 0 0 1 001h
01 10 Error 1 0 0 1 0 048h
01 11 Turns right 0 0 0 1 1 009h
10 00 Turns right 0 0 0 0 0 000h
10 01 Error 1 0 0 0 1 041h
10 10 No rotation 0 0 0 1 0 008h
10 11 Turns left 0 0 0 1 1 009h
11 00 Error 1 0 0 0 0 040h
11 01 Turns left 0 0 0 0 1 001h
11 10 Turns right 0 0 0 1 0 008h
11 11 No rotation 0 0 0 1 1 009h