Driver API for Quadrature Decoder.
The functions and other declarations used in this part of the driver are in cy_tcpwm_quaddec.h. You can also include cy_pdl.h to get access to all functions and declarations in the PDL.
A quadrature decoder is used to decode the output of a quadrature encoder. A quadrature encoder senses the position, velocity, and direction of an object (for example a rotating axle, or a spinning mouse ball). A quadrature decoder can also be used for precision measurement of speed, acceleration, and position of a motor's rotor, or with a rotary switch to determine user input.
The Quadrature Decoder has the following features:
The QuadDec configuration can be divided to number of sequential steps listed below:
To configure Quadrature, provide the configuration parameters in the cy_stc_tcpwm_quaddec_config_t structure. The Configuration structure can be modified through software, but if the configurator in ModusToolbox is used then the configuration structure will be updated with the users input. To initialize the driver, call Cy_TCPWM_QuadDec_Init function providing a pointer to the populated cy_stc_tcpwm_quaddec_config_t structure.
For TCPWM V1 Configuration
For TCPWM V2 Configuration
The clock source must be connected to proper working. Any of the peripheral clock dividers could be used. Use the SysClk (System Clock) driver API to do that.
Quadrature has to be enabled before starting
Quadrature has to be started
API Reference | |
Macros | |
Functions | |
Data Structures | |