09 Timers
09 Timers
Lecture 9
Counter Register
System Clock 0x1206
Reload
on Zero
÷ 000000
Clock Divider Countdown Register
Interrupt to
I/O Control
Processor
• Pause Function
– Suspends task for a specified amount of time
• One-shot timer
– Single one-time-only timeout
• Periodic timer
– Multiple renewable timeouts
• Time-slicing
– Chunks of time to each task
• Watchdog timer
GO Register
offset 0x08, immediately moves
Counter Reg value into Current Counter
Current Counter
(not directly readable by software)
Latch Register
offset 0x0C, write a ``1'' to immediately write
Current Counter value to readable Latch Reg
Latched Counter
at offsets 0x04, 0x00 (read only)
int time;
timer = (timer_p) TIMER1;
timer>latch = (unsigned char) 1;
time = (unsigned int) timer>countLow;
time = time | (unsigned int) (timer>countHigh << 8);
• How do we know when the timer has reached zero?
while (1){
timer>latch = (unsigned char) 1;
time = (unsigned int) timer>countLow;
time = time | (unsigned int) (timer>countHigh <<
8);
}
if(*char_ptr != BACKSPACE) {
printf("%d",*char_ptr&0xffff); // Echo char back
if ((*char_ptr&0xffff) == 125)
sendchar("v");
}
} else {
char_ptr++;
}
}
Data Bus
ARM 7500
Address Bus 8-bit register
Vcc
Processor
A0
A2
D7
A4
A6 D6
31 30 29 28 27 … 8 7 6 5 4 3 2 1 0
A8
N Z C V I F M4 M3 M2 M1 M0 A10 D5
A12
A14 D4
A16
A18 D3
A20
A22 D2
A24
A26
A28
D1
A30
D0