Hi,
I have one clarification. i do not understand when you configure a channel in ECT as input capture mode then the timer channel registers say TC0 does not register the number of pulses from the start but insted reads the TCNT value. if the channel register can register the pulses then simply after some ms i can count the pulses and get the frequency. but i think it is not the case with s12x. Could somebody please let me know how to measure the frequency of the pulses. Please also let me know if my understanding is wrong.
thanks in advance,
regards
satya
已解决! 转到解答。
Pulse Accumulator can register number of external pulses or do gated time counting.
Free running timer counter TCNT is your chronometer. Using input capture you capture timestamp (TCNT) of first pulse t1, then timestamp of second pulse t2. Frequency is 1/(t2-t1).
Regarding usage of input capture, I think you should read Section 10 of M68HC11 Reference manual. HC11 has similar input capture and output compare channels like in ECT
http://cache.freescale.com/files/microcontrollers/doc/ref_manual/M68HC11RM.pdf
Pulse Accumulator can register number of external pulses or do gated time counting.
Free running timer counter TCNT is your chronometer. Using input capture you capture timestamp (TCNT) of first pulse t1, then timestamp of second pulse t2. Frequency is 1/(t2-t1).
Regarding usage of input capture, I think you should read Section 10 of M68HC11 Reference manual. HC11 has similar input capture and output compare channels like in ECT
http://cache.freescale.com/files/microcontrollers/doc/ref_manual/M68HC11RM.pdf