NATIONAL TAIWAN OCEAN UNIVERSITY 國立台灣海洋大學 2002/4/8 Microcomputers and Microprocessors Chapter 9 COUNTER/TIMER PROGRAMMING IN THE 8051.

Slides:



Advertisements
Similar presentations
The 8051 Microcontroller and Embedded Systems
Advertisements

Autumn 2012C.-S. Shieh, EC, KUAS, Taiwan1 The 8051 Family Microcontroller Chin-Shiuh Shieh Department of Electronic Engineering.
4-1 Timers Timers can be used for  timing  event counting  pulse width measurement  pulse generation  frequency multiplication There are 8 Timers.
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 
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”
Lecture 9 Timer Operations and Programming. 2  Introduction  Summary of timers  Timer programming sequence  Summary of timer SFRs  Timer 0: 8-bit.
UNIT V INTERFACING MICROCONTROLLER
Chapter Timer Programming in Assembly and C
Today’s Lecture List the Timers of PIC18 and their associated registers Describe the various modes of the PIC18 timers Program the PIC18 timers in Assembly.
The 8051 Microcontroller and Embedded Systems
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.
8051 timer/counter.
Lecture 9. - Synchronous Devices require a timing signal. Clock generated Interval Timer Microprocessor Interval Timer Clk PCLK = MHz PCLK (for.
8254 Programmable Interval Timer
1 Chapter 4 Timer Operation (I. Scott MacKenzie).
Chapter 9 Counter/Timer Programming in the 8051
8253 TIMER. Engr 4862 Microprocessors 8253 / 8254 Timer A.k.a. PIT (programmable Interval Timer), used to bring down the frequency to the desired level.
8254 Counter/Timer Counter Each of the three counter has 3 pins associated CLK: input clock frequency- 8 MHz OUT GATE: Enable (high) or disable.
Timer/counter Chapter 12
ARM Timers.
NATIONAL TAIWAN OCEAN UNIVERSITY 國立台灣海洋大學 2002/4/8 Microcomputers and Microprocessors Chapter 5 Addressing Modes.
Chapter 4 TIMER OPERATION
CoE3DJ4 Digital Systems Design Chapter 4: Timer operation.
Lecture Set 9 MCS-51 Serial Port.
University Of Engineering And Technology Taxila REF::NATIONAL TAIWANOCEAN UNIVERSITY 國立台灣海洋大學 Chapter 3 JUMP, LOOP and CALL Instructions.
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.
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
The AVR microcontroller and embedded systems using assembly and c AVR Microcontroller and Embedded System Using Assembly and C Mazidi, Naimi, and Naimi.
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
C Examples 6. Download Links MPLAB IDE dsPIC30F4011/4012 Data Sheet dsPIC30F Family Reference Manual MikroC MikroC Manual MikroC Quick Reference.
Timer Programming in Assembly and C Prepared By:
DEPARTMENT OF ELECTRONICS ENGINEERING V-SEMESTER MICROPROCESSOR & MICROCONTROLLER 1 CHAPTER NO microcontroller & programming.
Serial I/O Port.
Chapter 11 INTERRUPTS PROGRAMMING
Assembly Language * * * * * * * 8051 Timer
Source: Serial Port Source:
8051 Timers Timers are the peripherals of the 8051 Microcontroller.
Timer Source: under
Programmable Interval Timer
SERIAL PORT PROGRAMMING
Interrupt Source: under
UNIT 5 TIMRERS/COUNTERS
Timer Operations and Programming
EMT 348: Microcontroller Timer/counter
Source: Serial Port Source:
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.
8051 Timers / Counters It has two timers Timer 0 and Timer 1.
Timer Source: under
Interrupt Source: under
PIC18 Timer Programming “Explain the assembly language programming for the timer and counter module”
Interrupt Source: under
Source: Serial Port Source:
Timer Source: under
Source: Serial Port Source:
8253.
Presentation transcript:

NATIONAL TAIWAN OCEAN UNIVERSITY 國立台灣海洋大學 2002/4/8 Microcomputers and Microprocessors Chapter 9 COUNTER/TIMER PROGRAMMING IN THE 8051

 2002 MuDer Jeng Outlines  List the timers of the 8051 and their associated registers  Describe the various modes of the 8051 timers  Program the 8051 timers to generate time delays  Program the 8051 counters as event counters

 2002 MuDer Jeng PROGRAMMING 8051 TIMERS Timer 0 registers TL0 ( timer 0 low byte ) TH0 ( timer 0 high byte )

 2002 MuDer Jeng Timer 1 registers TL1 ( timer 1 low byte ) TH1 ( timer 1 high byte )

 2002 MuDer Jeng TMOD (timer mode) register

 2002 MuDer Jeng

Mode 1 programming 1.Loaded value into TL and TH 2.”SETB TR0” for timer 0 ;”SETB TR1” for timer 1 3.If TF (timer flag) = high “CLR TR0” or “CLR TR1” 4.Reloaded TH and TL value, TF reset to 0

 2002 MuDer Jeng Steps to program in mode 1 1.Load the TMOD value 2.Load registers TL and TH 3.Start the timer (SETB TR0 or SETB TR1) 4.Keep monitoring the timer flag (TF) 5.Stop the timer (CLR TR0 or CLR TR1) 6.Clear the TF flag 7.Go back to step 2

 2002 MuDer Jeng Calculate Timer Delay

 2002 MuDer Jeng

Finding values to be loaded into the timer Assuming XTAL = MHz from Example Divide the desired time delay by 1.085μs 2.Perform n, where n is the decimal value we got in Step 1 3.Convert the result of Step 2 to hex, where yyxx is the initial hex value to be loaded into the timer’s registers 4.Set TL = xx and TH = yy

 2002 MuDer Jeng

Mode 0 Like mode 1 except that it is a 13-bit timer Mode 2 Programming 1.Loaded value into TH (8-bit timer) 2.”SETB TR0” for timer 0 ;”SETB TR1” for timer 1 3.If TF (timer flag) = high “CLR TR0” or “CLR TR1” 4.Reloaded TL value kept by TH

 2002 MuDer Jeng Steps to program in mode 2 1.Load the TMOD value 2.Load the TH registers 3.Start the timer 4.Keep monitoring the timer flag (TF) 5.Clear the TF flag 7.Go back to step 4

 2002 MuDer Jeng

C/T bit in TMOD register

 2002 MuDer Jeng

The case of GATE =1 in TMOD

 2002 MuDer Jeng