Quadrature Decoder
Libraries:
Motor Control Blockset /
Sensor Decoders
Motor Control Blockset HDL Support /
Sensor Decoders
Description
The Quadrature Decoder block computes the position of the quadrature encoder.
To calculate the angular position of the quadrature encoder (and the rotor) in either degrees, radians, or per-unit, the block uses one of the following methods.
Difference between current encoder counter value and encoder counter value at the previous index pulse (when index pulse is available).
Current encoder counter value (when index pulse is not available).
This figure shows a quadrature encoder disk with two channels (QEPA and QEPB) and an index pulse (QEPI):
In this example, the timer driven by the QEP increments by four for each slit:
Equations
The block computes the angular position (in counts) of the quadrature encoder as:
When the encoder rotates in the clockwise direction:
If ,
If and the shaft continues to rotate in the clockwise direction,
If and the shaft starts rotating in the anticlockwise direction,
When the encoder rotates in the anticlockwise direction:
If ,
If and the shaft continues to rotate in the anticlockwise direction,
If and the shaft starts rotating in the clockwise direction,
When you clear the External index count parameter, the Idx pulse resets Cnt to zero, therefore:
where:
is the angular position of the quadrature encoder in counts.
is the number of counts in one rotation cycle of the quadrature encoder.
The block computes the output θm as:
(in degrees)
(in radians)
(in per-unit)
Examples
Ports
Input
Output
Parameters
Extended Capabilities
Version History
Introduced in R2020a