16
Teachers Name : Suman Sarker Telecommunication Technology Subject Name : Microcontroller & Embedded System Subject Code : 6871 Semester :7th Department : Electronics Ideal Institute Of Science & Technology (IIST)

Teachers Name : Suman Sarker Telecommunication Technology Subject Name : Microcontroller & Embedded System Subject Code : 6871 Semester : 7th Department

Embed Size (px)

Citation preview

Page 1: Teachers Name : Suman Sarker Telecommunication Technology Subject Name : Microcontroller & Embedded System Subject Code : 6871 Semester : 7th Department

Teachers Name : Suman Sarker Telecommunication Technology

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

Department : Electronics

Ideal Institute Of Science & Technology (IIST)

Page 2: Teachers Name : Suman Sarker Telecommunication Technology Subject Name : Microcontroller & Embedded System Subject Code : 6871 Semester : 7th Department

LECTURE-10 CH-11

INTERRUPT OF 8051

Page 3: Teachers Name : Suman Sarker Telecommunication Technology Subject Name : Microcontroller & Embedded System Subject Code : 6871 Semester : 7th Department

What is Interrupt?

Page 4: Teachers Name : Suman Sarker Telecommunication Technology Subject Name : Microcontroller & Embedded System Subject Code : 6871 Semester : 7th Department

What is Interrupt?

Page 5: Teachers Name : Suman Sarker Telecommunication Technology Subject Name : Microcontroller & Embedded System Subject Code : 6871 Semester : 7th Department

What is Interrupt?

Page 6: Teachers Name : Suman Sarker Telecommunication Technology Subject Name : Microcontroller & Embedded System Subject Code : 6871 Semester : 7th Department

What is Interrupt?

Page 7: Teachers Name : Suman Sarker Telecommunication Technology Subject Name : Microcontroller & Embedded System Subject Code : 6871 Semester : 7th Department

What is Interrupt?

InterruptReading Remember Open Return to work

Page 8: Teachers Name : Suman Sarker Telecommunication Technology Subject Name : Microcontroller & Embedded System Subject Code : 6871 Semester : 7th Department

What is Interrupt?

InterruptProcessing

Remember current instruction address in Stack Register

ExecuteISR

Return to work

In terms of MCU

Page 9: Teachers Name : Suman Sarker Telecommunication Technology Subject Name : Microcontroller & Embedded System Subject Code : 6871 Semester : 7th Department

Types of Interrupt

External / Hardware Interrupt Internal / Software Interrupt

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

Page 10: Teachers Name : Suman Sarker Telecommunication Technology Subject Name : Microcontroller & Embedded System Subject Code : 6871 Semester : 7th Department

External Interrupt

Page 11: Teachers Name : Suman Sarker Telecommunication Technology Subject Name : Microcontroller & Embedded System Subject Code : 6871 Semester : 7th Department

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

Page 12: Teachers Name : Suman Sarker Telecommunication Technology Subject Name : Microcontroller & Embedded System Subject Code : 6871 Semester : 7th Department

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

Page 13: Teachers Name : Suman Sarker Telecommunication Technology Subject Name : Microcontroller & Embedded System Subject Code : 6871 Semester : 7th Department

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

Page 14: Teachers Name : Suman Sarker Telecommunication Technology Subject Name : Microcontroller & Embedded System Subject Code : 6871 Semester : 7th Department

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.

Page 15: Teachers Name : Suman Sarker Telecommunication Technology Subject Name : Microcontroller & Embedded System Subject Code : 6871 Semester : 7th Department

External Interrupt

Page 16: Teachers Name : Suman Sarker Telecommunication Technology Subject Name : Microcontroller & Embedded System Subject Code : 6871 Semester : 7th Department

Next Lecture

LCD AND KEY BOARD INTERFACING