Hello,
As googling on the net, i have encounterd capture and compare can be done via HET. My question is: is it possible to do Capture and compare with ADC.
Thanks.
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.
Hello,
As googling on the net, i have encounterd capture and compare can be done via HET. My question is: is it possible to do Capture and compare with ADC.
Thanks.
Hello,
NHET is to capture the input digital signal: edge (rising or falling), pulse high, pulse low, period.
ADC is used to sample the analog input signal. Yes, you can use ADC to continuously sample a digital input signal, calculate the pulse high or low and period. But this method is not accurate, it accuracy depends on the ADC sampling frequency and your detection algorithm. This method takes most of the CPU bandwidth.
The ADC supports a magnitude threshold compare interrupt mechanism. You can use this to set up a compare threshold and a comparison condition for a channel that is continuously converted. An interrupt is generated to the CPU when the defined comparison condition is true.
This allows you to implement a compare window without using any CPU bandwidth.
If your input is a PWM signal, the instruction PCNT captures the period between 2 rising edges, or two falling edges.
Please refer to the PCNT in TRM