Hi All,
I have a MCF51JM running off an 8MHz XTAL.
I want to use one of the timers to monitor pulse data coming in and measure the input capture toggle times.
What is the best method for calculating out how I need to set up the Timer Registers (Prescalers etc) to be able to measure bit times between 16uS and 300uS?.
I assume the best method is once I get an Int from the Timer I will read the TPM-Counter Registers (TPMxCNTH:TPMxCNTL) to get the value and compare it to 'x' to determine the time.
I'm just not sure how to calculate out for a given clock frequency and prescaler value what 100 or 400 (as examples) in the (TPMxCNTH:TPMxCNTL) registers corresponds to as a uS time.
Thanks,
Ross
Okay, I answered my own question above by experimenting, however, the problem I have now is the Timer count values are just incrementing on each interrupt, not resetting back to zero after each int is processed.
I'm not sure what I am doing wrong.
For each IC Int I read the values from (TPMxCnVH:TPMxCnVL) which are approximatly what I expect when read (value increases by approx 280 per read), which is about 64uS trigger time.
I can't seem to get (TPMxCnVH:TPMxCnVL) to revert back to zero after they are read.
The CF doc states "The latching mechanism may be manually reset by writing to the TPMxCnSC register", I am doing this by clearing bit 7 of the (TPMxCnSC) which is CHnF, what else am I missing?
Thanks,
Ross