Adding Quadrature Encoder Driver Block
In the Simulink® Library Browser, add the eQEP block from C2000™ Microcontroller Blockset > 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 Texas Instruments® 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 on the LaunchPadXL28379d hardware board. The sample time is
-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 setting wraps the position
count when the index pulse is read.
Add the eQEP driver block module to the
control subsystem as shown in this figure.