News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

24HJ128GP504 interrupt problem

Started by charliecoutas, Jul 03, 2022, 12:28 PM

Previous topic - Next topic

charliecoutas

I have used this device (24HJ128GP504) a few times with great success. But I can't get INTERRUPT 1 to work.

I have this to assign PORTB.12 to INT1:-   PPS_Input(cIn_Pin_RP12, cIn_Fn_int1)   

INT1 is enabled and the edge to falling, pin PORTB.12 is TRISsed as input.

I can see pin PORTB.12 going up and down, but the interrupt is not triggering.

I have an LED flash trap at the start of the ISR, it's never running.

Any ideas of what I may have overlooked?

Charlie


charliecoutas

Found it. I had forgotten to set the priority for INT1. By default it's zero, which means it will never fire.

Charlie

top204

The interrupt priorities on the PIC24 and dsPIC33 devices have caught me out a few times in the past, so I now set them all to high and let the natural order of them dictate their priority.