Difference between revisions of "5.8051 Timer programming"
Line 9: | Line 9: | ||
==Timer Counter Operation== | ==Timer Counter Operation== | ||
− | {| class="wikitable" style="text-align:center;background-color:# | + | {| class="wikitable" style="text-align:center;background-color:#87A96B;margin: 1em auto 1em auto;" |
|- | |- | ||
!colspan = '16'|T0 | !colspan = '16'|T0 | ||
Line 18: | Line 18: | ||
|} | |} | ||
− | {| class="wikitable" style="text-align:center;background-color:# | + | {| class="wikitable" style="text-align:center;background-color:#87A96B;margin: 1em auto 1em auto;" |
|- | |- | ||
− | !colspan = '8'| | + | !colspan = '8'|TMOD |
|- | |- | ||
|D7||D6||D5||D4||D3||D2||D1||D0 | |D7||D6||D5||D4||D3||D2||D1||D0 | ||
Line 29: | Line 29: | ||
{{Box|type=l_green_light|text=<br/> | {{Box|type=l_green_light|text=<br/> | ||
}} | }} | ||
− | {| class="wikitable" style="background-color:# | + | {| class="wikitable" style="background-color:#87A96B;" |
|- | |- | ||
! Register !! Operation | ! Register !! Operation |
Revision as of 22:32, 26 December 2013
In this tutorial we will see 8051 timers. We will use the 8051 timers to generate a precise delay of 1 sec.
8051 timers/counters
The 8051 has 2 timers/counters.
- They can be used to generate precise timing, i.e., we can measure time between events. The unit is then called timer.
- It can also be used to count external events, known as counter.
- Timer 1 is also used for generating baud rate in serial communication, which we will discuss in the next tutorial
Timer Counter Operation
T0 | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
TH0 | TL0 | ||||||||||||||
D15 | D14 | D13 | D12 | D11 | D10 | D9 | D8 | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
TMOD | |||||||
---|---|---|---|---|---|---|---|
D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
Gate | C/T | M1 | M0 | Gate | C/T | M1 | M0 |
Register | Operation |
---|---|
T0 | Timer 0 |
T1 | Timer 1 |
TCON | Timer Control |
TMOD | Timer Mode |