3.10.3 Quadrature Decoding
Users interact with the system using a rotary encoder with a built-in push button. The encoder generates a quadrature encoded signal which must be decoded by the MCU into left or right rotation pulses. Two Configurable Logic Cells (CLCs), Timer1 and Timer3 are used to perform this action in hardware, with only periodic software reads to obtain the net rotation. As shown in Figure 3-8, the CLCs filter the quadrature encoded signal, so rotational pulses only show up on the output, depending on the encoder direction. The output is fed into a timer, which counts the number of pulses. The software then periodically calculates the difference in the timer values since last read to know how many pulses the rotary encoder turned.