Transcription of 8051 Timer Programming in Assembly and C Objectives: At ...
{{id}} {{{paragraph}}}
8051 TimerProgramming inAssembly andCMicrocontrollerPage18051 Timer Programming in Assembly and CObjectives:Atthe endof this chapter, we will be able to: List the timers of 8051 and their associated registers Describe the various modes of the 8051 timers. Program the 8051 timers in Assembly and C and Program the 8051 counters in Assembly and 8051 Timers:The 8051 has two timers/counters;they can be used either asTimers to generate a time delayor asevent counters to count events happeningoutside the Timers of 8051:Both Timer 0 and Timer 1 are 16 8051 has an 8-bit architecture, each16-bitstimer is accessed as two separateregisters of low byte and high low byte register iscalled TL0/TL1andthe high byte register is called TH0/TH1. These registers can beaccessed like any other register. For example: MOV TL0,#4FH MOV R5,TH0 Figure 1: Timer 0 and Timer1registerTMOD ( Timer mode) Register:Both timers 0 and 1 use the sameregister, called TMOD ( Timer mode), toset the varioustimer operation is an 8-bit lower 4 bits are for Timer 0and theupper 4 bits are for Timer each case,the lower 2 bits are used to set the Timer modetheupper 2 bits to specify the TMOD register is as shown in figure
Both timers 0 and 1 use the same register, called TMOD (timer mode), to set the various timer operation modes. TMOD is an 8-bit register. The lower 4 bits are for Timer 0 and the upper 4 bits are for Timer 1. In each case, the lower 2 bits are used to set the timer mode the upper 2 bits to specify the operation.
Domain:
Source:
Link to this page:
Please notify us if you found a problem with this document:
{{id}} {{{paragraph}}}