Lecture 05 PIC Microcontroller Interrupts and EEPROM Data Memory
Lecture 05 PIC Microcontroller Interrupts and EEPROM Data Memory
LECTURE SESSIONS
Session FIVE: PIC Microcontrollers Interrupts and EEPROM Data Memory
5.1 Session Objectives
By the end of this session, you should be able to:
The PIC interrupts sources.
The interrupt logic circuit.
The interrupt controls register INTCON.
Context Saving During Interrupts
EEPROM registers
EEPROM Data Read & Write Operation
5.2 The PIC interrupts sources
The PIC16F84A has 4 sources of interrupt:
• External interrupt RB0/INT pin
• TMR0 overflow interrupt
• PORTB change interrupts (pins RB7:RB4)
• Data EEPROM write complete interrupt
5.2.1 INT INTERRUPT
It is an edge triggered interrupt that is externally applied on RB0/INT pin
MOVLW AAh;
MOVWF EECON2; Write AAh
BSF EECON1, WR; Set WR bit
; begin write
BSF INTCON, GIE; Enable INTs
The built-in requirement for these codes helps to ensure that accidental writes do not take place,
for example on power-up or -down.
The WR bit is then set high and writing actually commences. The write completion is signaled by
the setting of bit EEIF in EECON1.
The write will not initiate if the above sequence is not exactly followed (write 55h to
EECON2, write AAh to EECON2, then set WR bit) for each byte. We strongly recommend
that interrupts be disabled during this code segment.