SlideShare a Scribd company logo
The 8051 Microcontroller andThe 8051 Microcontroller and
Embedded SystemsEmbedded Systems
CHAPTER 9
8051TIMER
PROGRAMMING IN
ASSEMBLY
Hala kamal
1
2
SECTION 9.1: PROGRAMMING 8051
TIMERS
3
SECTION 9.1: PROGRAMMING 8051SECTION 9.1: PROGRAMMING 8051
TIMERSTIMERS
Basic registers of the timer
◦ Timer 0 and Timer 1 are 16 bits wide
◦ each 16-bit timer is accessed as two
separate registers of low byte and high byte.
4
SECTION 9.1: PROGRAMMING 8051SECTION 9.1: PROGRAMMING 8051
TIMERSTIMERS
 Timer 0 registers
◦ low byte register is called TL0 (Timer 0 low byte) and the
high byte register is referred to as TH0 (Timer 0 high byte)
◦ can be accessed like any other register, such as A, B, R0, R1,
R2, etc.
◦ "MOV TL0, #4 FH" moves the value 4FH into TL0
◦ "MOV R5, TH0" saves TH0 (high byte of Timer 0) in R5
5
SECTION 9.1: PROGRAMMING 8051SECTION 9.1: PROGRAMMING 8051
TIMERSTIMERS
6
Figure 9–1 Timer 0 Registers
SECTION 9.1: PROGRAMMING 8051SECTION 9.1: PROGRAMMING 8051
TIMERSTIMERS
Timer 1 registers
◦ also 16 bits
◦ split into two bytes TL1 (Timer 1 low byte)
and TH1 (Timer 1 high byte)
◦ accessible in the same way as the registers
of Timer 0.
7
SECTION 9.1: PROGRAMMING 8051SECTION 9.1: PROGRAMMING 8051
TIMERSTIMERS
8
Figure 9–2 Timer 1 Registers
SECTION 9.1: PROGRAMMING 8051SECTION 9.1: PROGRAMMING 8051
TIMERSTIMERS
 TMOD (timer mode) register
◦ timers 0 and 1 use TMOD register to set operation modes .
◦ 8-bit register
◦ lower 4 bits are for Timer 0
◦ upper 4 bits are for Timer 1
◦ lower 2 bits are used to set the timer mode.
◦ upper 2 bits to specify the operation
9
SECTION 9.1: PROGRAMMING 8051SECTION 9.1: PROGRAMMING 8051
TIMERSTIMERS
10
Figure 9–3 TMOD Register
SECTION 9.1: PROGRAMMING 8051SECTION 9.1: PROGRAMMING 8051
TIMERSTIMERS
11
12
13
Timer

More Related Content

What's hot

Class9
Class9Class9
Registers
RegistersRegisters
Registers
UMARHASSAN31
 
Registers
RegistersRegisters
Registers
Gaditek
 
Shift Registers
Shift RegistersShift Registers
Shift Registers
Abhilash Nair
 
Shift Register
Shift RegisterShift Register
Shift Register
Vanitha Chandru
 
8051 Instruction Set
8051 Instruction Set8051 Instruction Set
8051 Instruction Set
Stupidsid.com
 
8051 Timer
8051 Timer8051 Timer
8051 Timer
Ramasubbu .P
 
14827 shift registers
14827 shift registers14827 shift registers
14827 shift registers
Sandeep Kumar
 
8051e
8051e8051e
8051e
rupalir
 
Overview of Shift register and applications
Overview of Shift register and applicationsOverview of Shift register and applications
Overview of Shift register and applications
Karthik Kumar
 
Shift registers
Shift registersShift registers
Shift registers
Ravi Maurya
 
Using Timers in PIC18F Microcontrollers
Using Timers in PIC18F MicrocontrollersUsing Timers in PIC18F Microcontrollers
Using Timers in PIC18F Microcontrollers
Corrado Santoro
 
Shift register
Shift registerShift register
Shift register
Ashwini Yadav
 
Registers siso, sipo
Registers siso, sipoRegisters siso, sipo
Registers siso, sipo
DEPARTMENT OF PHYSICS
 
Using Timer1 and CCP
Using Timer1 and CCPUsing Timer1 and CCP
Using Timer1 and CCP
Corrado Santoro
 
Shift registers
Shift registersShift registers
Shift registers
Sulman Ahmed
 
Registers
RegistersRegisters
Registers
Sanjeev Patel
 
Microcontroller 8051 introduction
Microcontroller 8051 introductionMicrocontroller 8051 introduction
Microcontroller 8051 introduction
Engr umar
 
Register Dld project
Register Dld projectRegister Dld project
Register Dld project
Ahsin Yousaf
 
Chapter7
Chapter7Chapter7

What's hot (20)

Class9
Class9Class9
Class9
 
Registers
RegistersRegisters
Registers
 
Registers
RegistersRegisters
Registers
 
Shift Registers
Shift RegistersShift Registers
Shift Registers
 
Shift Register
Shift RegisterShift Register
Shift Register
 
8051 Instruction Set
8051 Instruction Set8051 Instruction Set
8051 Instruction Set
 
8051 Timer
8051 Timer8051 Timer
8051 Timer
 
14827 shift registers
14827 shift registers14827 shift registers
14827 shift registers
 
8051e
8051e8051e
8051e
 
Overview of Shift register and applications
Overview of Shift register and applicationsOverview of Shift register and applications
Overview of Shift register and applications
 
Shift registers
Shift registersShift registers
Shift registers
 
Using Timers in PIC18F Microcontrollers
Using Timers in PIC18F MicrocontrollersUsing Timers in PIC18F Microcontrollers
Using Timers in PIC18F Microcontrollers
 
Shift register
Shift registerShift register
Shift register
 
Registers siso, sipo
Registers siso, sipoRegisters siso, sipo
Registers siso, sipo
 
Using Timer1 and CCP
Using Timer1 and CCPUsing Timer1 and CCP
Using Timer1 and CCP
 
Shift registers
Shift registersShift registers
Shift registers
 
Registers
RegistersRegisters
Registers
 
Microcontroller 8051 introduction
Microcontroller 8051 introductionMicrocontroller 8051 introduction
Microcontroller 8051 introduction
 
Register Dld project
Register Dld projectRegister Dld project
Register Dld project
 
Chapter7
Chapter7Chapter7
Chapter7
 

Similar to Timer

Advanced Microprocessor 6.pptx
Advanced Microprocessor 6.pptxAdvanced Microprocessor 6.pptx
Advanced Microprocessor 6.pptx
ShanDimantha1
 
MICROCONTROLLER TIMERS.ppt
MICROCONTROLLER TIMERS.pptMICROCONTROLLER TIMERS.ppt
MICROCONTROLLER TIMERS.ppt
reemasajin1
 
8051 training an interactive tutorial
8051 training an interactive tutorial8051 training an interactive tutorial
8051 training an interactive tutorial
Futura infotech
 
8051 Timers
8051 Timers8051 Timers
The 8051 microcontroller
The 8051  microcontroller The 8051  microcontroller
The 8051 microcontroller
Avinash Mishra
 
Advanced Embedded Automatic Car Parking System
	Advanced Embedded Automatic Car Parking System	Advanced Embedded Automatic Car Parking System
Advanced Embedded Automatic Car Parking System
theijes
 
Ashish microcontroller 8051
Ashish microcontroller 8051Ashish microcontroller 8051
Ashish microcontroller 8051
ASHISH RAJ
 
8051 ch9
8051 ch98051 ch9
8051 ch9
860540760
 
module-2.pptx
module-2.pptxmodule-2.pptx
module-2.pptx
Ambika Naik
 
MCUnit 4and 5_New.pptx
MCUnit 4and 5_New.pptxMCUnit 4and 5_New.pptx
MCUnit 4and 5_New.pptx
nandalalparthiban
 
8051 microcontroller features
8051 microcontroller features8051 microcontroller features
8051 microcontroller features
Tech_MX
 
lecture 12 counter_microcontroller2.ppt
lecture 12 counter_microcontroller2.pptlecture 12 counter_microcontroller2.ppt
lecture 12 counter_microcontroller2.ppt
HebaEng
 
Interrupt programming with 8051 microcontroller
Interrupt programming with 8051  microcontrollerInterrupt programming with 8051  microcontroller
Interrupt programming with 8051 microcontroller
Ankit Bhatnagar
 
8051 timers--2
   8051 timers--2   8051 timers--2
8051 timers--2
Syed Basharat Hussain
 
B sc e5.2 mp unit 4 mc-8051
B sc e5.2 mp unit 4 mc-8051B sc e5.2 mp unit 4 mc-8051
B sc e5.2 mp unit 4 mc-8051
MahiboobAliMulla
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
Shivashankar Sawalgi
 
TIMERS.pptx
TIMERS.pptxTIMERS.pptx
TIMERS.pptx
maheswariM7
 
8051 timer counter
8051 timer counter8051 timer counter
8051 timer counter
ankit3991
 
moving message display of lcd
 moving message display of lcd moving message display of lcd
moving message display of lcd
abhishek upadhyay
 
Microcontroller-8051.ppt
Microcontroller-8051.pptMicrocontroller-8051.ppt
Microcontroller-8051.ppt
KalaiSelvan911913
 

Similar to Timer (20)

Advanced Microprocessor 6.pptx
Advanced Microprocessor 6.pptxAdvanced Microprocessor 6.pptx
Advanced Microprocessor 6.pptx
 
MICROCONTROLLER TIMERS.ppt
MICROCONTROLLER TIMERS.pptMICROCONTROLLER TIMERS.ppt
MICROCONTROLLER TIMERS.ppt
 
8051 training an interactive tutorial
8051 training an interactive tutorial8051 training an interactive tutorial
8051 training an interactive tutorial
 
8051 Timers
8051 Timers8051 Timers
8051 Timers
 
The 8051 microcontroller
The 8051  microcontroller The 8051  microcontroller
The 8051 microcontroller
 
Advanced Embedded Automatic Car Parking System
	Advanced Embedded Automatic Car Parking System	Advanced Embedded Automatic Car Parking System
Advanced Embedded Automatic Car Parking System
 
Ashish microcontroller 8051
Ashish microcontroller 8051Ashish microcontroller 8051
Ashish microcontroller 8051
 
8051 ch9
8051 ch98051 ch9
8051 ch9
 
module-2.pptx
module-2.pptxmodule-2.pptx
module-2.pptx
 
MCUnit 4and 5_New.pptx
MCUnit 4and 5_New.pptxMCUnit 4and 5_New.pptx
MCUnit 4and 5_New.pptx
 
8051 microcontroller features
8051 microcontroller features8051 microcontroller features
8051 microcontroller features
 
lecture 12 counter_microcontroller2.ppt
lecture 12 counter_microcontroller2.pptlecture 12 counter_microcontroller2.ppt
lecture 12 counter_microcontroller2.ppt
 
Interrupt programming with 8051 microcontroller
Interrupt programming with 8051  microcontrollerInterrupt programming with 8051  microcontroller
Interrupt programming with 8051 microcontroller
 
8051 timers--2
   8051 timers--2   8051 timers--2
8051 timers--2
 
B sc e5.2 mp unit 4 mc-8051
B sc e5.2 mp unit 4 mc-8051B sc e5.2 mp unit 4 mc-8051
B sc e5.2 mp unit 4 mc-8051
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
 
TIMERS.pptx
TIMERS.pptxTIMERS.pptx
TIMERS.pptx
 
8051 timer counter
8051 timer counter8051 timer counter
8051 timer counter
 
moving message display of lcd
 moving message display of lcd moving message display of lcd
moving message display of lcd
 
Microcontroller-8051.ppt
Microcontroller-8051.pptMicrocontroller-8051.ppt
Microcontroller-8051.ppt
 

Recently uploaded

RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
Himanshu Rai
 
The basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptxThe basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptx
heathfieldcps1
 
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
zuzanka
 
CIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdfCIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdf
blueshagoo1
 
How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17
Celine George
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Denish Jangid
 
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
indexPub
 
MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025
khuleseema60
 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
zuzanka
 
Skimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S EliotSkimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S Eliot
nitinpv4ai
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
MysoreMuleSoftMeetup
 
Bonku-Babus-Friend by Sathyajith Ray (9)
Bonku-Babus-Friend by Sathyajith Ray  (9)Bonku-Babus-Friend by Sathyajith Ray  (9)
Bonku-Babus-Friend by Sathyajith Ray (9)
nitinpv4ai
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
EduSkills OECD
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
Nguyen Thanh Tu Collection
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
iammrhaywood
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
Bossa N’ Roll Records by Ismael Vazquez.
Bossa N’ Roll Records by Ismael Vazquez.Bossa N’ Roll Records by Ismael Vazquez.
Bossa N’ Roll Records by Ismael Vazquez.
IsmaelVazquez38
 
Data Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsxData Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsx
Prof. Dr. K. Adisesha
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 

Recently uploaded (20)

RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
 
The basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptxThe basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptx
 
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
 
CIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdfCIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdf
 
How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
 
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
THE SACRIFICE HOW PRO-PALESTINE PROTESTS STUDENTS ARE SACRIFICING TO CHANGE T...
 
MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025
 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
 
Skimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S EliotSkimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S Eliot
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
 
Bonku-Babus-Friend by Sathyajith Ray (9)
Bonku-Babus-Friend by Sathyajith Ray  (9)Bonku-Babus-Friend by Sathyajith Ray  (9)
Bonku-Babus-Friend by Sathyajith Ray (9)
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
Bossa N’ Roll Records by Ismael Vazquez.
Bossa N’ Roll Records by Ismael Vazquez.Bossa N’ Roll Records by Ismael Vazquez.
Bossa N’ Roll Records by Ismael Vazquez.
 
Data Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsxData Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsx
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 

Timer

  • 1. The 8051 Microcontroller andThe 8051 Microcontroller and Embedded SystemsEmbedded Systems CHAPTER 9 8051TIMER PROGRAMMING IN ASSEMBLY Hala kamal 1
  • 3. 3
  • 4. SECTION 9.1: PROGRAMMING 8051SECTION 9.1: PROGRAMMING 8051 TIMERSTIMERS Basic registers of the timer ◦ Timer 0 and Timer 1 are 16 bits wide ◦ each 16-bit timer is accessed as two separate registers of low byte and high byte. 4
  • 5. SECTION 9.1: PROGRAMMING 8051SECTION 9.1: PROGRAMMING 8051 TIMERSTIMERS  Timer 0 registers ◦ low byte register is called TL0 (Timer 0 low byte) and the high byte register is referred to as TH0 (Timer 0 high byte) ◦ can be accessed like any other register, such as A, B, R0, R1, R2, etc. ◦ "MOV TL0, #4 FH" moves the value 4FH into TL0 ◦ "MOV R5, TH0" saves TH0 (high byte of Timer 0) in R5 5
  • 6. SECTION 9.1: PROGRAMMING 8051SECTION 9.1: PROGRAMMING 8051 TIMERSTIMERS 6 Figure 9–1 Timer 0 Registers
  • 7. SECTION 9.1: PROGRAMMING 8051SECTION 9.1: PROGRAMMING 8051 TIMERSTIMERS Timer 1 registers ◦ also 16 bits ◦ split into two bytes TL1 (Timer 1 low byte) and TH1 (Timer 1 high byte) ◦ accessible in the same way as the registers of Timer 0. 7
  • 8. SECTION 9.1: PROGRAMMING 8051SECTION 9.1: PROGRAMMING 8051 TIMERSTIMERS 8 Figure 9–2 Timer 1 Registers
  • 9. SECTION 9.1: PROGRAMMING 8051SECTION 9.1: PROGRAMMING 8051 TIMERSTIMERS  TMOD (timer mode) register ◦ timers 0 and 1 use TMOD register to set operation modes . ◦ 8-bit register ◦ lower 4 bits are for Timer 0 ◦ upper 4 bits are for Timer 1 ◦ lower 2 bits are used to set the timer mode. ◦ upper 2 bits to specify the operation 9
  • 10. SECTION 9.1: PROGRAMMING 8051SECTION 9.1: PROGRAMMING 8051 TIMERSTIMERS 10 Figure 9–3 TMOD Register
  • 11. SECTION 9.1: PROGRAMMING 8051SECTION 9.1: PROGRAMMING 8051 TIMERSTIMERS 11
  • 12. 12
  • 13. 13