Interrupt Source: http://www.edsim51.com/8051Notes/interfacing.html#adc under http://www.edsim51.com/8051Notes/index.html.

Slides:



Advertisements
Similar presentations
Interrupts Professor Yasser Kadah –
Advertisements

The 8051 Microcontroller Chapter 5 SERIAL PORT OPERATION.
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.
8051 Interrupts.  Contrast edge-triggered with level-triggered interrupts  Program the 8051 for interrupt-based serial communication  Define the interrupt.
Chapter 6 Interrupts (I. Scott Mackenzie).
Architecture of the 8051 INTERNAL DATA BUS Oscillator & Timing Programmable I/O (32 Pins) 80C51 CPU 64K byte Expansion Control Serial I/O 4K Program Memory.
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.
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.
1 Chapter 4 Timer Operation (I. Scott MacKenzie).
Lecture Set 9 MCS-51 Serial Port.
CoE3DJ4 Digital Systems Design Chapter 6: Interrupts.
Serial Communication Lec note 9.
MCS51 - part 1.
Interrupt.
1. Registers Used in Timer/Counter  TH0, TL0, TH1, TL1  TMOD (Timer mode register)  TCON (Timer control register) 2.
Microprocessors 1 MCS-51 Interrupts.
Lecture 8 Interrupts. 2  Introduction  Interrupt organization  Interrupt summary  Enabling and disabling interrupts  Interrupt priority  Interrupt.
8051 Micro controller. Architecture of 8051 Features of 8051.
MCS51 - lecture 5. Lecture 5 2/28 Interrupts in MCS51 Step work Power consumption reducing.
Intel 8051 Another family of microcontroller is the Intel 8051 family. The basic 8051 microcontroller has four parallel input/output ports, port 0, 1,
Embedded Systems Design 1 Lecture Set 8 MCS-51 Interrupts.
EE/CS-352: Embedded Microcontroller Systems Part V The 8051 Assembly Language Interrupts.
Lecture 3 CSE 341 – Microprocessors Lecture 3 Md. Omar Faruqe UB 1228
kashanu.ac.ir Microprocessors Interrupts Lec note 8.
The 8051 Microcontroller Chapter 6 INTERRUPTS. 2/29 Interrupt is the occurrence of a condition an event that causes a temporary suspension of a program.
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.
Serial I/O Port.
Chapter 11 INTERRUPTS PROGRAMMING
Assembly Language * * * * * * * 8051 Timer
8085 Interrupts LAKSHMI.B.E..
Microprocessor and Assembly Language
Source: Serial Port Source:
8051 Timers Timers are the peripherals of the 8051 Microcontroller.
Interrupts In 8085 and 8086.
Unit - 1 Interrupts M.Brindha AP/EIE
Timer Source: under
Hardware Source: ttp:// under
BVM Engineering College Electrical Engineering Department : Microprocessor and Microcontroller Interfacing Interrupts of 8051 Prepared by:
Interrupt Source: under
8085 Interrupts.
Introduction to Micro Controllers & Embedded System Design Interrupt
UNIT 5 TIMRERS/COUNTERS
Introduction to Micro Controllers & Embedded System Design I/O Processing and Serial Port Operation Department of Electrical & Computer Engineering Missouri.
An Introduction to Microprocessor Architecture using intel 8085 as a classic processor
Timer Operations and Programming
* * * * * * * 8051 Interrupts Programming.
Source: Serial Port Source:
Interrupt.
Lecture 8 Interrupts.
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
Interrupt.
Hardware Source: ttp:// under
UNIT-VIII 8051 Microcontroller Architecture Register set of 8051
JANAKIRAMAN E G S PILLAY ARTS AND SCIENCE COLLAGE NAGAPATTINAM DEPARTMENT OF PHYSICS.
INTRODUCTION TO 8051, A 8-BIT MICROCONTROLLER
Source: Serial Port Source:
Timer Source: under
Compiled by Dr. N.Shanmugasundaram, HOD, ECE Dept, SECE.
Interrupts of 8051 Introduction 8051 Interrupt organization
Source: Serial Port Source:
Presentation transcript:

Interrupt Source: http://www.edsim51.com/8051Notes/interfacing.html#adc under http://www.edsim51.com/8051Notes/index.html

Response to an interrupt When an interrupt occurs the following happens: The current instruction completes execution. The content of PC (the address of the next instruction ) is saved on the stack. The address of ISR (i.e., Interrupt vector) for the interrupt is loaded into the PC. ISR: Interrupt Service Routine

five interrupt sources The 8051 has five interrupt sources. Two external interrupts: pins INTO-bar and INT1-bar (port 3 pin 2 and port 3 pin 3) Two internal interrupts: timer 0 overflow & timer 1 overflow The serial port: when a byte has been transmitted or when a byte is received

Interrupt-related SFRs: IE, SCON, TCON

Interrupt-related SFR: IE (Interrupt Enable Register) An interrupt can be disabled and enabled. On power-up or reset, all interrupts are disabled. * To enable interrupts we set the appropriate bits in the interrupt enable SFR. Symbol Bit Number Description EA 7 Enable/disable all interrupts. If this bit is cleared all interrupts are disabled. If it is set each interrupt source is individually enabled or disabled by setting or clearing the appropriate enable bit, as detailed below. -- 6   5 ES 4 Enable/disable serial port interrupts (set to enable, clear to disable). ET1 3 Enable/disable timer 1 overflow interrupt (set to enable, clear to disable). EX1 2 Enable/disable external 1 interrupt (set to enable, clear to disable). ET0 1 Enable/disable timer 0 overflow interrupt (set to enable, clear to disable). EX0 Enable/disable external 0 interrupt (set to enable, clear to disable). SETB EA SETB ET0 CLR EX1

Interrupt-related SFR: TCON (Timer Control Register) Bit Symbol Bit Address Description 7 TF1 8FH Timer 1 overflow flag; set by hardware upon overflow, cleared by software. 6 TR1 8EH Timer 1 run-control bit; manipulated by software - setting starts timer 1, resetting stops timer 1. 5 TF0 8DH Timer 0 overflow flag; set by hardware upon overflow, cleared by software. 4 TR0 8CH Timer 0 run-control bit; manipulated by software - setting starts timer 0, resetting stops timer 0. 3 IE1 8BH ITx controls the triggering condition of external x interrupt. = 1: negative-edge triggering = 0: low-level triggering IEx is the interrupt flag for external interrupt x , where x = 0 or 1 2 IT1 8AH 1 IE0 89H IT0 88H

Interrupt-related SFR: SCON (Serial Control Register) Bit Symbol Address Description 7 SM0 9FH serial port mode bit 0 6 SM1 9EH serial port mode bit 1 5 SM2 9DH serial port mode bit 2 - will be dealt with at a later date 4 REN 9CH receiver enable - this bit must be set to receive data 3 TB8 9BH transmit bit 8 - this is the ninth bit transmitted in the 9-bit UART modes 2 RB8 9AH receive bit 8 - this is the ninth bit received in the 9-bit UART modes 1 TI 99H transmit interrupt flag - this bit is set by hardware when an entire byte has been transmitted - it must be cleared by software RI 98H receive interrupt flag - this bit is set by hardware when an entire byte has been received - it must be cleared by software

Interrupt Flags The 1st bit of TCON register Interrupt Flag Location External 0 IE0 TCON.1 External 1 IE1 TCON.3 Timer 0 TF0 TCON.5 Timer 1 TF1 TCON.7 Serial Port Receive RI SCON.0 Serial Port Transmit TI SCON.1 The 1st bit of TCON register

Interrupt Vectors Interrupt Source Interrupt Flag Interrupt Vector (Address in code memory) System reset RST 0000H External interrupt 0 IE0 0003H Timer 0 TF0 000BH External interrupt 1 IE1 0013H Timer 1 TF1 001BH Serial port RI or TI 0023H When an interrupt in the 8051 occurs, the vector address, as shown above, is loaded into the PC.

Scenario of Interrupting

External Interrupts Interrupt pins: the INT0-bar (P3.2) & INT1-bar (P3.3) pins Triggering conditions: a low-level or negative edge on the interrupt pins Choice of the triggering condition: the IT0 and IT1 bits (in the TCON register) The interrupt flags: IE0 and IE1 (in the TCON register); 0 for low-level triggering, 1 for negative edge triggering Sampling rate  The external interrupt pins are sampled (ie; tested) once every machine cycle. Note: Machine cycle = 1 us for 12 MHz clock rate

How to program an interrupt To do External Interrupt 0 Set up the interrupt vector ORG 3 JMP EXT0ISR Choose the interrupt triggering condition (negative-edge or low-level triggering) SETB IT0 ; for edge-triggering CLR IT0 ; for level-triggering Enable the interrupt SETB EX0 Enable all the interrupts SETB EA Program the ISR EXT0ISR:  IRET