In the Simulink® Library Browser, add the eQEP block from Embedded Coder® Support Package for Texas Instruments™ C2000™ Processors > F2837xD.
The eQEP block reads the quadrature encoder pulses and increments the position count. This block outputs the quadrature encoder pulse for the mechanical rotor position wraparound when the quadrature encoder index pulse is read.
See the section Quadrature Encoder Interface Configuration in Model Configuration Parameters for configurations related to the quadrature encoder.
In c28x eQEP block parameters dialog box, configure the quadrature encoder to read the quadrature encoder pulse count in the TI processor and wrap the pulse counter output when index pulse is found as shown in this table.
|Tab and Parameter in eQEP Block||Settings|
General > Module
General > Sample time
Position counter > Output position counter
Position counter > Maximum position counter value (0~4294967295)
Position counter > Position counter reset mode
|Reset on the first index event|
Position counter > Output latch position counter on index event
Position counter > Index event latch of position counter
Rename the block as eQEP.
eQEP1 module is selected because the quadrature encoder is connected to the QEP_A
interface in the LaunchPadXL28379d hardware board. Select the sample time as
-1 because the library block is function-call triggered by the
ADC interrupt synchronously. The maximum position counter value is
2^16-1 because the position counter uses a 16-bit architecture in
the library driver block. The position counter reset mode on the index pulse wraps the
position count on the index pulse.
Add the eQEP driver block module to the
control subsystem as shown in this figure.