ENEE 440 Chapter 7 8254 Timer 8254 Register Select The 8254 timer is actually 3 timers in one. It is an upgraded version of the 8253 timer which was.

Slides:



Advertisements
Similar presentations
Lecture 08: 8253/4 Timer and Music
Advertisements

Microprocessor & Interfacing
Lecture 23: Registers and Counters (2)
The 8051 Microcontroller and Embedded Systems
1 Homework Reading –Intel 8254 Programmable Interval Timer (PIT) Data Sheet Machine Projects –Continue on MP3 Labs –Continue in labs with your assigned.
Dr A Sahu Dept of Comp Sc & Engg. IIT Guwahati I/O + Timer 8155 I/O + Timer 8255 I/O 8255 I/O 8253/54 Timer 8253/54 Timer 2 Port (A,B), No Bidirectional.
Dr A Sahu Dept of Computer Science & Engineering IIT Guwahati.
4-1 Timers Timers can be used for  timing  event counting  pulse width measurement  pulse generation  frequency multiplication There are 8 Timers.
Programmable Interval Timer
Dr A Sahu Dept of Computer Science & Engineering IIT Guwahati.
8253/54 Timer Section /54 Timer Description and Initialization
Using the 8254 Timer-Counter Understanding the role of the system’s 8254 programmable Interval-Timer/Counter.
Programmable Interval Timer Prepared By: Prof. M. B. Salunke SITS, Narhe, Pune - 41.
Counters and Registers
8254 Modes Made by: Ryan wahab (8) Modes Gate is low the count will be paused Gate is high Will continue counting Mode 0: An events counter.
CS370 Counters. Overview °Counter: A register that goes through a prescribed series of states °Counters are important components in computers. °Counters.
Timers and Interrupts Shivendu Bhushan Summer Camp ‘13.
DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1.
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”
Chapter 7 Counters and Registers
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.
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).
Engineering 4862 Microprocessors Lecture 27 Cheng Li EN-4012
7/23 Timers in Coldfire Processor Computer Science & Engineering Department Arizona State University Tempe, AZ Dr. Yann-Hang Lee (480)
Dec Hex Bin 13 D ORG ; THIRTEEN 8253/54 Timer.
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.
PIT: Programmable Interval Timer
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.
8254 SOFTWARE PROGRAMMABLE TIMER/COUNTER
Chapter 4 TIMER OPERATION
CoE3DJ4 Digital Systems Design Chapter 4: Timer operation.
The 8253 Programmable Interval Timer
MCU: Interrupts and Timers Ganesh Pitchiah. What’s an MCU ?
PIT Programming Examples Working with the modes of PIT.
Lecture 11: TI MSP430 Timers Compare Modes
Timers.
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.
Advanced Microprocessor1 I/O Interface Programmable Interval Timer: 8254 Three independent 16-bit programmable counters (timers). Each capable in counting.
University of Tehran 1 Microprocessor System Design Timers Omid Fatemi
8254 Timer.
ENEE 440 Chapter PPI 8255 Register Select -CS A1 A0 REGISTER R/W PORT A R/W PORT B R/W PORT C R/W CR W 1 X X8255 NOT.
THEME 6: Frequency dividers. Digital counters with reduced counting modulus. Programmable digital counters. If the input pulses are more than K, the counter.
Seth Schwiethale James Crosetto James Ellison.  square pulse of ms, repeats every 20 ms  It is the same for both steering and acceleration 
8086 – I/O Interfacing - I/O mapped I/O
Module 8 Tutorial  An 8086 system is used for controlling the speed of a motor. The motor can operate at 5 different speeds (1- 5).  The speed.
Electronic Devices and Circuit Theory
8254 SOFTWARE PROGRAMMABLE TIMER/COUNTER. Difference between 8253 and Maximum input clock frequency is 2.6 MHz Maximum input clock frequency.
8253 / 8254 Timer A.k.a. PIT (programmable Interval Timer), used to bring down the frequency to the desired level Three counters inside 8253/8254. Each.
EI205 Lecture 8 Dianguang Ma Fall 2008.
Homework Reading Machine Projects Labs
Timer and Interrupts.
Chapter 13 Linear-Digital ICs
8254 – SOFTWARE PROGRAMMABLE TIMER
Programmable Interval Timer
Programmable Interval Timer
Programmable Interval Timer 8254 LECTURE 3
Digital Fundamentals with PLD Programming Floyd Chapter 10
EMT 348: Microcontroller Timer/counter
Chapter 7 Latches, Flip-Flops, and Timers
8254 Timer and Counter (8254 IC).
Timer.
Timers.
Programmable Interval timer 8253 / 8254
Programmable Interval timer 8253 / 8254
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.
Programmable Interval Timer
Presentation transcript:

ENEE 440 Chapter 7

8254 Timer

8254 Register Select The 8254 timer is actually 3 timers in one. It is an upgraded version of the 8253 timer which was used in the PC/XT. The PC/AT uses the The decoding scheme is shown below: -CS A1 A0 REGISTER Counter Counter Counter Control Register 1 X X8254 NOT SELECTED

8254 Timer Summary The counters are 16 bits wide. The count is loaded and read 8 bits at a time. The order is always LSB first and then MSB. CLK is the frequency of the input clock. OUT is the output which depends on the mode of operation. GATE disables the counter with 0V and enables it with 5V.

8254 Timer Modes... MODE 0Interrupt on terminal count: The output goes high when the counter decrements to zero(TC). This output can be connected to an external device to signal an interrupt. MODE 1Hardware retriggerable one-shot: Also called programmable one-shot. The output goes low when triggered by a 0-1 pulse applied to the gate input. The output goes high on TC (count down to zero). Retriggerable means that during the count-down another 0-1 pulse can retrigger the counter to reload the initial count and start the count-down again. Thus the width of the output (one-shot) can be increased.

8254 Timer Modes... MODE 2 Rate Generator: This gives a periodic output whose frequency depends on the number N loaded into the counter. This is a divide by N counter. The output stays high until the counter decrements to 1. The output then goes low for one clock cycle and the counter is reloaded with the initial count N. The cycle is repeated.

8254 Timer Modes... MODE 3 Square Wave Generator: If N is even, output is high for N/2 clock cycles and low for N/2 pulses. Thus the duty cycle is 50% and it is a divide by N counter. If N is odd then OUT is low for (N-1)/2 clock cycles and high for (N+1)/2 clock cycles. The duty cycle for odd N depends on N. MODE 4 Software triggered strobe: OUT stays high for N+1 clock pulses and then goes low for one clock pulse. The output is not periodic. To repeat the process, the counter must be reloaded.

8254 Timer Modes... MODE 5 Hardware triggered strobe: A 0-1 pulse on GATE will trigger the counter and the output will stay high for N+1 clock pulses and then go low for one clock pulse (cycle). If the gate is triggered during the countdown, the count will start all over again. The output is not periodic.

Time out for examples! The base address of an 8254 is 350H. CLK 2 is connected to a 200kHz clock. Write a program to generate a 40 kHz square wave. What is the duty cycle of this square wave?

8253/4 Control Word

Solution... Address of counter2 is 352H and that of the control register is 353H. We need N=5. Our square wave will be high for 3 clock cycles and low for 2 clock cycles. The duty cycle is 3/5 *100 = 60%. We need the control word. Looking at the chart for the control word, we have 10 for counter2, 01 for LSB,011 for mode 3 (square wave) and 1 for BCD The control word is 97

Program... Here is the program (finally!): mov dx, 353h; control register mov al, 97h; control word. out dx, al; counter2, mode 3, BCD counting dec dx; equals mov dx,352 mov al, 05h; N=5 out dx, al; No comments!

8253/4 Timer in the PC

Happy birthday to you..... and other loony tunes! The speaker will be turned off completely if bit 1 of port 61h is 0. Irrespective of the output at OUT2, the output of the NAND gate will stay high. The speaker can sound only if there is a frequency at the output of the NAND gate. If bit1 is 1 then OUT2 will sound the speaker if GATE 2 is enabled by bit 0 of port 61h also being high. Here is a recipe to generate music:

Happy birthday to you Program the 8254 counter 2 to generate square waves. 2. The frequency should be in the "music" range, say 100 to 1000 Hz. 3. Set bits 0 and 1 of port 61h to 1 without messing up the other bits. 4. Insert a delay for the length of time the music should continue. 5. Remember to turn the speaker off by restoring the original setting of port 61h. 6. If step 5 is messed up, the music will never stop!

A different tune! There is another method (not highly recommended but works for me!) to sound the speaker without using the 8254 timer! Set bit 0 of port 61h to 0. This disables the timer's output for ever. Now turn bit 1 of port 61h ON and OFF. This pulses the speaker! Make sure you have a software delay between ON and OFF and again between OFF and ON. The delay will determine the frequency of the speaker's output. You will need a different (much longer) delay to establish the time interval for which the tune will play.