I want to use the interupt on change feature of portB of the PIC16C84 to
read a key pad.
Because the '84 has a number of interupt sources (and only one ISR
address: org 4) I guess the first part of the ISR work out which
interupt has occured and then execute the relevant code.
How is this usually done?
Auckland, New Zealand
|Seth Fischer wrote:
> Because the '84 has a number of interupt sources (and only one ISR
> address: org 4) I guess the first part of the ISR work out which
> interupt has occured and then execute the relevant code.
> How is this usually done?
The code in the ISR checks the bits in the INTCON register to determine
which interrupt conditions caused execution. There can be more than
one, if you enable more than one.
... ; save registers
BTFSS INTCON,T0IF ; are we here for a timer interrupt?
GOTO ISR_NOT_TMR0 ; no, branch elsewhere
BCF INTCON,T0IF ; clear the timer interrupt
... ; process timer interrupt
BTFSS INTCON,INTF ; are we here for a RB0/INT interrupt?
GOTO ISR_NOT_INTF ; no, branch elsewhere
BCF INTCON,INTF ; clear the RB0/INT interrupt
... ; process RB0/INT interrupt
... ; restore registers
RETFIE ; return and enable interrupts
James Cameron (stl.dec.com) cameron
OpenVMS, Linux, Firewalls, Software Engineering, CGI, HTTP, X, C, FORTH,
COBOL, BASIC, DCL, csh, bash, ksh, sh, Electronics, Microcontrollers,
Disability Engineering, Netrek, Bicycles, Pedant, Farming, Home Control,
Remote Area Power, Greek Scholar, Tenor Vocalist, Church Sound, Husband.
"Specialisation is for insects." -- Robert Heinlein.
More... (looser matching)
- Last day of these posts
- In 1998
, 1999 only
- New search...