weeks9-10 - Weeks 9-10 8051 Interrupt Programming 1...

Info iconThis preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Weeks 9-10 8051 Interrupt Programming
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2 Sections 11.1 8051 Interrupts 11.2 Programming timer interrupts 11.3 Programming external hardware interrupts 11.4 Programming the serial communication interrupt 11.5 Interrupt priority in the 8051/52
Background image of page 2
3 Section 11.1 8051 Interrupts
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
4 Figure 4-1. 8051 Pin Diagram PDIP/Cerdip 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 P1.0 P1.1 P1.2 P1.3 P1.4 P1.5 P1.6 P1.7 RST (RXD)P3.0 (TXD)P3.1 (T0)P3.4 (T1)P3.5 XTAL2 XTAL1 GND (INT0)P3.2 (INT1)P3.3 (RD)P3.7 (WR)P3.6 Vcc P0.0(AD0) P0.1(AD1) P0.2(AD2) P0.3(AD3) P0.4(AD4) P0.5(AD5) P0.6(AD6) P0.7(AD7) EA/VPP ALE/PROG PSEN P2.7(A15) P2.6(A14) P2.5(A13) P2.4(A12) P2.3(A11) P2.2(A10) P2.1(A9) P2.0(A8) 8051 (8031) external hardware interrupt
Background image of page 4
5 Inside Architecture of 8051 CPU On-chip RAM On-chip ROM for program code 4 I/O Ports Timer 0 Serial Port Figure 1-2. Inside the 8051 Microcontroller Block Diagram OSC Interrupt Control External interrupts Timer 1 Timer/Counter Bus Control TxD RxD P0 P1 P2 P3 Address/Data Counter Inputs
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
6 I/O Services ± A single microcontroller can serve several devices. ± Two ways: ² Interrupt method • An interrupt is an external or internal event that interrupts the microcontroller to inform that a device needs its service. ² Polling method
Background image of page 6
7 Polling method ± The microcontroller continuously monitors the status of a given device. ± When the condition is met, it serves the device. ± After that, it moves on to monitor the next device until every one is serviced. ± The microcontroller checks all devices in a round-robin fashion.
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
8 Interrupt method ± Whenever any device needs its service, the device notifies the microcontroller by sending it an interrupt signal. ± Upon receiving an interrupt signal, the microcontroller interrupts (suspends execution) whatever it is doing and serves the device. ± The program which is associated with the interrupt is called the interrupt service routine (ISR) or interrupt handler .
Background image of page 8
9 The Advantage of Interrupts ± The microcontroller can serve many devices. ± Each device can get service based on the priority assigned to it. ± The microcontroller can ignore (mask) a device request. ± The use of microcontroller is more efficient. ² Ex: in polling system, HERE: JNB TI, HERE wastes much of the microcontroller’s time.
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
10 Six Interrupts in the 8051 ± Reset ± Two interrupts for the timers ² TF0, TF1 ± Two interrupts for external hardware interrupts ² INT0, INT1 ± Serial communication ² TI or RI ± Refer to Table 11.1 ± Programmers must enable these interrupts before using them.
Background image of page 10
11 Interrupt Service Routine ± For every interrupt, there is a fixed location in the Code memory that holds its ISR.
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 12
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 83

weeks9-10 - Weeks 9-10 8051 Interrupt Programming 1...

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online