FILE: eqep_ex2_freq_cal_interrupt.c
This example will calculate the frequency of an input signal using the eQEP module. ePWM1A is configured to generate this input signal with a frequency of 5 kHz. EQEP unit timeout is set which will generate an interrupt every UNIT_PERIOD microseconds and frequency calculation occurs continuously
The configuration for this example is as follows
- PWM frequency is specified as 5000Hz
- UNIT_PERIOD is specified as 10000 us
- Min frequency is (1/(2*10ms)) i.e 50Hz
- Highest frequency can be (2^32)/ ((2*10ms))
- Resolution of frequency measurement is 50hz
freq : Frequency Measurement is obtained by counting the external input pulses for UNIT_PERIOD (unit timer set to 10 ms).
External Connections
- Connect GPIO20/eQEP1A to GPIO0/ePWM1A
Watch Variables
- freq - Frequency measurement using position counter/unit time out
- pass - If measured frequency matches with PWM frequency then pass = 1 else 0