This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
I want to configure the ECAP to compute frequency and duty cycle of a 1Hz to 100KHz input with a resolution of at least 5Hz and an accuracy of +/- 20Hz. I have VCLK3 configured at 75MHz and I've noticed that I can get better accuracy of higher frequency inputs if I use the ECAP prescale, but it seems like the prescale effectively increases the amount of time needed to detect changes in frequency. For example an input of 1Hz and a prescale to divide by 4 would take 4 seconds for all capture events to occur. Likewise a prescale to divide by 10 would take 10 seconds to determine the frequency.
Is there any way to minimize the time to detect changes and maintain accuracy of higher frequency inputs?
I am using 3 capture events to calculate frequency and duty cycle:
cap1 = rising with the counter not reset on event
cap2 = falling with the counter not reset on event
cap3 = rising with the counter reset on event
Hello,
The prescaler is useful for the input signals with very higher frequency. Your observation is correct. If you increase the prescaler, the frequency of the input signal (PSOUT) to the CAP unit is decreased.
The detection time is dependent on the frequency of the input signal.
Is it also true that using a prescale greater than 1 will remove the ability to detect the duty cycle of the incoming signal?
Hello Jeremy,
It is expected. The prescaler (>1) is used to measure the period of high frequency input. As you said, the duty cycle is 50% when precaler > 1.