PDA

View Full Version : Multiple HW Interrupts



Radiance
- 11th August 2003, 22:55
I've just begun a project using the 18F2320, that requires two hardware interrupts. Is the best(fastest?) way to determine WHICH interrupt was fired to loop through the INTCONx register, checking the INT2IF and INT1IF bits?

Thanks,

Nik

Melanie
- 12th August 2003, 19:47
Pretty much. Check for the Interrupt with the highest priority first.

What you can also do is alias the flags in PBP to a name of your choice, and then just check the alias in your program...

PressureHigh var INTCON3.0
PressureLow var INTCON3.1

.. ..

If PressureLow=1 then Panic
If PressureHigh=1 then ReallyPanic

Melanie

Radiance
- 12th August 2003, 20:15
Yes, that's exactly what I had intended. Funny thing about PBP, I usually just make the assumption that a register for a specific chip exists. Is this the case? Can I assume that if a chip is considered "supported" by a version of PBP that all registers and special features can be aliased according to registername.pin#?

Nik

Melanie
- 13th August 2003, 23:35
Well yes... I make that assumption and it works for me. Check the respective INC file for your chip to see that the register you need is listed - they generally are - or at least I've not found an instance yet of something missing.

If it doesn't work, then the compiler will soon complain if it doesn't like something.

Melanie