Alex Prog

MC912DG128A - HC12 Timer

Discussion created by Alex Prog on Sep 22, 2007
Latest reply on Sep 25, 2007 by kef
Hello,
 
i have a problem with the timer counter.
 
Code:
int variable1, variable2;
timerinit();while(1){variable1=TCNT;  //save the TimerCounterRegister TCNT in variable1variable2=TCNT;  //...}

The Timer has a resolution of 1µs. Now the problem: in the first cycle of the loop the difference between variable1 and variable2 is 6µs. from the second cycle the difference is only 1µs or 0µs. the reason of 0 is probably that the resolution is to big. But why 6µs in the first cycle? Do you have any idea? Thank you!



--
Alban Edit: Please always include FSL Part Number in Message Subject line.




Message Edited by Alban on 2007-09-22 09:06 PM

Outcomes