8051 Timers / Counters It has two timers Timer 0 and Timer 1.

Slides:



Advertisements
Similar presentations
The 8051 Microcontroller and Embedded Systems
Advertisements

8051 Core Specification.
CSC Timers Since this is a microcontroller it mainly finds itself in embedded devices Quite often embedded devices need to synchronize events The.
5-1 Timer/Counters In many microprocessor systems we need to:  count logic pulses  measure the frequency of signals  measure the period of pulses 
Chapter 6 Interrupts (I. Scott Mackenzie).
Microcontroller 8051.
Embedded Systems UNIT 3. Pin Details of 8051 Pins 1-8: Port 1 Each of these pins can be configured as an input or an output. Pin 9: The positive voltage.
1.  8051 Timers “count up,” incrementing the Timer’s respective “count register” each time there is a triggering clock pulse. 2  When the “count register”
The 8051 Microcontroller and Embedded Systems
INTERRUPTS PROGRAMMING
Lecture 9 Timer Operations and Programming. 2  Introduction  Summary of timers  Timer programming sequence  Summary of timer SFRs  Timer 0: 8-bit.
Microcontroller 8051.
NATIONAL TAIWAN OCEAN UNIVERSITY 國立台灣海洋大學 2002/4/8 Microcomputers and Microprocessors Chapter 9 COUNTER/TIMER PROGRAMMING IN THE 8051.
CHAPTER TIMER PROGRAMMING Timers The 8051 has two timers/counters, they can be used as ◦ Timers to generate a time delay ◦ Event counters.
8051 timer/counter.
1 Chapter 4 Timer Operation (I. Scott MacKenzie).
Chapter 9 Counter/Timer Programming in the 8051
ARM Timers.
Timers ELEC 330 Digital Systems Engineering Dr. Ron Hayne
Chapter 4 TIMER OPERATION
CoE3DJ4 Digital Systems Design Chapter 4: Timer operation.
Timers /Counters Programming  The 8051 has 2 timers/counters: ○ timer/counter 0 ○ timer/counter 1 They can be used as 1. The timer is used as a time.
1. Registers Used in Timer/Counter  TH0, TL0, TH1, TL1  TMOD (Timer mode register)  TCON (Timer control register) 2.
8051 Timer/Counter Lec note 7.
8051 Micro controller. Architecture of 8051 Features of 8051.
Timers and Interrupts Anurag Dwivedi. Let Us Revise.
MCS51 - lecture 3. Lecture 3 2/30 Timers/counters MCS51.
Intel 8051 Another family of microcontroller is the Intel 8051 family. The basic 8051 microcontroller has four parallel input/output ports, port 0, 1,
The 8051 Microcontroller Prepared By, R-THANDAIAH PRABU M.E.,
Jump, Loop, and Call Instructions
The Silicon Laboratories C8051F020
8051 Aula 02 Prof Afonso Ferreira Miguel. Microcontrolador 8051 (MCS-51)  Timers do MCS51 Two 16-bit Counter/Timers: Two 16-bit Counter/Timers: Up counters,
Lecture 41 CSE 341 – Microprocessors Lecture 4 Md. Omar Faruqe UB 1228
#1 of 10 Tutorial Introduction PURPOSE -To explain how to configure and use the Timer Interface Module in common applications OBJECTIVES: -Identify the.
Lecture 3 CSE 341 – Microprocessors Lecture 3 Md. Omar Faruqe UB 1228
kashanu.ac.ir Microprocessors Interrupts Lec note 8.
HOME AUTOMATION USING PC DONE BY RAJESHKUMAR S SRI HARSHA D.
Timer Programming in Assembly and C Prepared By:
80C51 Block Diagram 1. 80C51 Memory Memory The data width is 8 bits Registers are 8 bits Addresses are 8 bits – i.e. addresses for only 256.
DEPARTMENT OF ELECTRONICS ENGINEERING V-SEMESTER MICROPROCESSOR & MICROCONTROLLER 1 CHAPTER NO microcontroller & programming.
TIMERS.
Serial I/O Port.
80C51 Block Diagram ECE Overview.
Assembly Language * * * * * * * 8051 Timer
8051 Microcontroller Features and its Applications
8051 Timers Timers are the peripherals of the 8051 Microcontroller.
Timer Source: under
BVM Engineering College Electrical Engineering Department : Microprocessor and Microcontroller Interfacing Interrupts of 8051 Prepared by:
Interrupt Source: under
Introduction to Micro Controllers & Embedded System Design Interrupt
UNIT 5 TIMRERS/COUNTERS
Timer Operations and Programming
* * * * * * * 8051 Interrupts Programming.
EMT 348: Microcontroller Timer/counter
8051 Timers Prof. Rajiv R Bhandari.
Interrupt.
Introduction to Micro Controllers & Embedded System Design Timer Operation Department of Electrical & Computer Engineering Missouri University of Science.
Timer.
Timers.
Timer Source: under
Interrupt Source: under
PIC18 Timer Programming “Explain the assembly language programming for the timer and counter module”
Interrupt.
JANAKIRAMAN E G S PILLAY ARTS AND SCIENCE COLLAGE NAGAPATTINAM DEPARTMENT OF PHYSICS.
Interrupt Source: under
Source: Serial Port Source:
Timer Source: under
8253 – PROGRAMMABLE INTERVAL TIMER (PIT). What is a Timer? Timer is a specialized type of device that is used to measure timing intervals. Timers can.
Source: Serial Port Source:
Presentation transcript:

8051 Timers / Counters It has two timers Timer 0 and Timer 1. The timers are 16- bit registers. Since 8051 is 8 – bit microcontroller, each 16 – bit register can be accessed as low – byte register (TL) and high – byte register (TH). These registers are accessed like other registers (A, B, R0, R1 etc.) in 8051

Timer Control (TCON) Register Time Mode (TMOD) Register Timer 1 Register Timer 0 Register TH1 (8 – bit) TL1 TH0 (8 – bit) TL0 Timer Control (TCON) Register Time Mode (TMOD) Register Timer Register

Structure of TMOD Register Timer / counter mode control (TMOD) is the special function register in 8051 having the following format: LSB MSB Timer 0 Timer 1 TMOD Register GATE C / T M1 M0

TMOD Register Responsibility Select Timer 0 to operate as a counter or timer. Select Timer 1 to operate as a counter or timer. Select the mode in which timer should operate. M1, M0 : These bits select the timer mode. There are four modes of timer, mode 0, mode 1, mode 2, and mode 3.

8 – bit timer / counter “THx” with TLx” s 5 – bit prescaler Operating Mode 8 – bit timer / counter “THx” with TLx” s 5 – bit prescaler 1 16 – bit Timer / Counter “THx” with “TLx” are cascaded; there is no prescaler. 8 – bit auto – reload Timer / Counter “Thx” holds a value which is to be reloaded into “TLx”, each time it overflows. (Timer 0) TL0 is an 8 – bit Timer / Counter controlled by the standard Timer 0 control bits. TH0 is an 8 – bit timer only controlled by Timer 1 control bits. (Timer 1) Timer / Counter 1 Stopped. C / T : This bit is cleared (C / T = 0) for selecting “Timer” operation and is set (C/ T=1) for selecting “Counter Operation). GATE : Gating control when set. Timer / Counter “x” is enabled only while “INTx” pin is high and “TRx” control bit is set. When cleared Timer “x” is enabled whenever “TRx” control bit is set.

Structure of TCON Register MSB LSB TF1 TR1 TF0 TR0 IE1 IT1 IE0 IT0 TCON Register

TCON – Timer / Counter Control / Status register Symbol Position Name and Significance TF1 TCON.7 Timer 1 overflow flag. Set by Hardware on timer / counter overflow. Cleared when interrupt processed. TR1 TCON.6 Timer 1 Run control bit. Set / Cleared by software to turn timer / counter on / off TF0 TCON.5 Timer 0 overflow flag. Set by hardware on timer / counter overflow. Cleared when interrupt is processed. TRO TCON.4 Timer 0 Run control bit. Set / Cleared by software to turn timer / counter on / off. IE1 TCON.3 Interrupt 1 Edge flag. Set by hardware when external interrupt edge detected. Cleared when interrupt processed. IT1 TCON.2 Interrupt 1 Type control bit. Set / Cleared by software to specify falling edge / low level triggered external interrupts. IE0 TCON.1 Interrupt 0 Edge flag. Set by hardware when external interrupt edge detected. Cleared when interrupt processed. IT0 TCON.0 Interrupt 0 Type control bit. Set / Cleared by software to specify falling edge / low level triggered external interrupts. TCON – Timer / Counter Control / Status register

TCON Register Operations Start and Stop timer 0 and timer 1. It provides status of timer / counter overflows. It provides status of external interrupts. It configures external interrupts as either low level triggered or falling edge triggered.