Hi,
I'm trying to make a simple second clock using the Axon and its Timer2 timer.
The timer2 timer is run off of 32.768 KHz internal oscillator on the Axon. Prescale is set at 1024.
Time Resolution = Prescale/ Clock Frequency
Time Resolution = 1024/32768
Time Resolution = .03125 seconds or 31.25mS
So for one second I would need 1000/31.25 = 32 "ticks"
But when I run my code, for 32 ticks, the seconds are displayed at more than two times the speed they should be.
Any idea whats up with this?
int Timer_Value(void) {
return Timer2Reg0;
}
void Clear_Timer_Value(void) {
Timer2Reg0 = 0;
}
Clear_Timer_Value();
while(1) {
if (Timer_Value() >= 31) {
rprintf("%d \r",temp);
temp = temp + 1;
Clear_Timer_Value();
}