mc9s32 timer help needed

Hi to all. I'm new to using this processor(MC9S12Gc32) and a a bit confused about some of the Timer module functionality. I have read the datasheet , but still have a few questions. If I want to measure the time that a input on say IOC4 is high I have to do the following. Set the input to trigger on high and low edges. When the edge goes high I take the value of TC4 and store it. When the edge goes low I take the TC4 reading again and subtract the 2 to get a time/count difference?

This seems to work , but seems cumbersome. It would be easier to set the counter to 0 on the rising edge and then take one reading on the falling edge to get a result. The only way I can see to do this is to set the main counter TCNT to 0(this can't be done directly anyway) but this would mess up any other timers that are running. Am I missing something here ? Cheers Seegoon

Reply to
seegoon
Loading thread data ...

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.