SPRUJF2A March 2026 – March 2026 AM13E23019
FILE: eqep_ex3_epwm_xbar.c
This example calculates the frequency of a PWM signal using the eQEP module. PWM1A is configured to generate this input signal with a frequency of 5kHz. This PWM signal is connected to input of eQEP using Input XBAR and PWM XBAR. The MCPWM module interrupts once every period and calls the frequency calculation function. This example uses the IQMath library to simplify high-precision calculations.
In addition to the main example file, the following files must be included in this project:
The configuration for this example is as follows
SPEED_PR: Low Frequency Measurement is obtained by measuring time period of input edges. Time measurement is averaged over 64 edges for better results and the capture unit performs the time measurement using pre-scaled MCLK .
Note that the pre-scaler for capture unit clock is selected such that the capture timer does not overflow at the required minimum frequency. This example runs indefinitely until the user stops the program.
For more information about the frequency calculation see the comments at the beginning of eqep_ex1_calculation.c and the XLS file provided with the project, eqep_ex1_calculation.xls.
Watch
Variables