Input capture very confusing

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Input capture very confusing

1,103 Views
rahulkrishna
Contributor IV

Hi,

i want to measure the frequency of a signal. I thoroughly read the s12x ect module. I am very confused with the terms timer and counter in the same module. My requirement is I have to measure three frequency signals, I have given it to channels 0,1,2. I have configured in input capture mode. So when there is a transition I shall get an interrupt in the 3 channels. I take the difference of Tc will give me pulse width am I correct on this? My main doubt is what is the timer overflow interrupt, I don't understand this at all. Should I use it or not especially in input capture mode. Please help. How to measure frequency?

Labels (1)
1 Reply

441 Views
iggi
NXP Employee
NXP Employee

Yes, the description is little bit confusing, what is main timer and what is counter.

There is 16-bit Free Running Main Timer derived from the bus clock via prescaler. So we can say it is a clock.

The timer counter (TCNT) is the part of the module and that is 16-bit register which counts up from 0x0000 to 0xFFFF.

Maybe i'm not exactly correct about this, but at least it's not that confusing.

If enabled, Timer Overflow Interrupt (TOI) is triggered each time Timer Overflow Flag (TOF) is set.

Timer Overflow Flag (TOF) is set when the 16-bit timer counter overflows from value FFFF to 0000.

Timer overflow counter can be used to measure periods longer than one timer period.

Attached are some old project demonstrating the frequency measurement on S12XDP512 device.

The CodeWarrior projects are compatible with the latest v5.1 version.

Hope that helps.

Regards,

iggi