PDA

View Full Version : Interrupts Identification (handling)



RodSTAR
- 21st April 2008, 08:52
Hello all again;

In a program I want to do, I want to handle more than an interrupt source, so I enable theese interrupts:
-RB Port Change Interrupt
-Timer1 Overflow Interrupt

in the ON INTERRUPT part, ¿How can I identify which interrupt was triggered?

(if relevant, PIC is a 16F628A)

regards
Rod

Acetronics2
- 21st April 2008, 09:01
Hi,

Just check if corresponding interrupt flags are set ... before clearing them !

that's all !

Alain

RodSTAR
- 21st April 2008, 09:27
Hi,

Just check if corresponding interrupt flags are set ... before clearing them !

that's all !

Alain

LOL so simple ! thank you.
-something like:


...
ON INTERRUPT GOTO IntHandler
...
...
IntHandler:
If PIR1.0=1 then
PIR1.0=0 'Clear flag
..do my thing...
RESUME
EndIF

If INTCON.0=1 then
INTCON.0=0 'Clear flag
..do my thing...
RESUME
EndIF


but.. if I have 10 interrupts enabled and the last interrupt checking ('If' statement) was the triggered, will I always have to check the previous 9 each??, sounds like it will.

PD: ENABLE & DISABLE are optional, am I ok?

Ioannis
- 21st April 2008, 12:06
Why not use Darrels Interrupts?

Ioannis

Acetronics2
- 21st April 2008, 13:16
LOL so simple ! thank you.
-something like:
[code]
...
?

Yess ... so simple




but.. if I have 10 interrupts enabled and the last interrupt checking ('If' statement) was the triggered, will I always have to check the previous 9 each??, sounds like it will.
?

You see anther way to check which has triggered ???

it's a Pic specifics !!!




PD: ENABLE & DISABLE are optional, am I ok


?

heuuuuu, disable before the interrupt stubb !!! or it will be fun ...

Ioannis ( hello ...) is right ... BUT if your device shows ~> 2K prog space min. ( say ~> 100 SRAM Bytes ...). The 12F683 is the minimum size to allow something "usable" ...

Alain

Ioannis
- 21st April 2008, 13:40
Hi Alain. He stated that the device is F628, so it might fit the budget! But on the other hand, On Interrupts, depending on the length of the PBP program might consume RAM too.

Ioannis