Teachers Name : Suman Sarker Telecommunication Technology Subject Name : Microcontroller &...

Preview:

Citation preview

Teachers Name : Suman Sarker Telecommunication Technology

Subject Name : Microcontroller & Embedded SystemSubject Code : 6871Semester :7th

Department : Electronics

Ideal Institute Of Science & Technology (IIST)

LECTURE-10 CH-11

INTERRUPT OF 8051

What is Interrupt?

What is Interrupt?

What is Interrupt?

What is Interrupt?

What is Interrupt?

InterruptReading Remember Open Return to work

What is Interrupt?

InterruptProcessing

Remember current instruction address in Stack Register

ExecuteISR

Return to work

In terms of MCU

Types of Interrupt

External / Hardware Interrupt Internal / Software Interrupt

Physical or interrupt from outside ADC, TIMER, USART etc.

External Interrupt

PIC 16F877A has the following 15 interrupt sources :1)External2)Timer 03)Timer 14)RB Port Change5)Parallel Slave Port Read/Write6)A/D Converter7)USART Receive8)USART Transmit9)Synchronous Serial Port10)CCP1 (Capture, Compare, PWM)11)CCP2  (Capture, Compare, PWM)12)TMR2 to PR2 Match13)Comparator14)EEPROM Write Operation15)Bus Collision

The 5 registers that used to control the operation of Interrupts in PIC 16F877A Microcontroller :1)INTCON2)PIE13)PIR14)PIE25)PIR2

INTCON Register

INTCON Register PIC 16F877A

INTCON Register is a readable and writeable register which contains various enable and flag bits for External and Internal Interrupts.

GIE – Global Interrupt Enable

1– Enables all unmasked interrupts0 – Disables all interrupts

PEIE – Peripheral Interrupt Enable1 – Enables all unmasked peripheral interrupts0 – Disables all peripheral interrupts

TMR0IE – Timer 0 Overflow Interrupt Enable1–Enables the TMR0 interrupt0 – Disables the TMR0 interrupt

INTE – RB0/INT External Interrupt Enable1 – Enables the RB0/INT external interrupt0 – Disables the RB0/INT external interrupt

RBIE –  RB Port Change Interrupt Enable1 – Enables the RB port change interrupt0 – Disables the RB port change interrupt

TMR0IF – Timer 0 Overflow Interrupt Flag1 – TMR0 register has overflowed. It must be cleared in software.0 – TMR0 register did not overflow

INTF – RB0/INT External Interrupt Flag1 – The RB0/INT external interrupt occurred. It must be cleared in software.0 – The RB0/INT external interrupt did not occur

RBIF – RB Port Change Interrupt Flag1 – At least one of the RB7 – RB4 pins changed state, a mismatch condition will continue to setthe bit. Reading PORTB will end the mismatch condition and allow the bit to be cleared. It must be cleared in software.0 – None of the RB7 – RB4 pins have changed state

INTEDG bit of OPTION_REG Register is the Interrupt Edge Select bit. When it is 1 interrupt is on rising edge of RB0/INT pin and when it is 0 interrupt is on falling edge of RB0/INT pin.

External Interrupt

Next Lecture

LCD AND KEY BOARD INTERFACING

Recommended