Quantcast
Channel: MEL PICBASIC Forum
Viewing all articles
Browse latest Browse all 4746

Hot to handle multiple interrupt sources?

$
0
0
Hi guys, I'm working on a project and using PIC16F877A. I need to use multiple interrupts sources as TMR0, TMR1, RB0 etc. but i don't know how to proccess them in different interrupt routines. Is there any way to direct them to releated interrupt routine other than polling their interrupt flags?
I mean, I know following codes won't work but is there a way to use interrupts like following codes,

Code:

ON TMR0 INTERRUPT GOTO tmr0_int
ON TMR1 INTERRUPT GOTO tmr1_int
ON RB0 INTERRUPT GOTO rb0_int

Or do I must use polling methode like following

Code:

ON INTERRUPT GOTO INTCHCK
....
....
INTCHCK:
IF INTCON.2=1 THEN
GOTO tmr0_int
ENDIF
IF PIR.0=1 THEN
GOTO tmr1_int
ENDIF
IF INTCON.0=1 THEN
GOTO rb0_int
ENDIF

PS: I would not prefer polling methode since it will lose time while checking flags, it would be great if there is a way to run releated interrupt subroutine directly like some other microcontroller models

Viewing all articles
Browse latest Browse all 4746

Trending Articles