My goal is to measure PWM pulses. But to achive that I'm making baby steps, so my first goal is to set a pin when an edge of the PWM signal is detected. The PWM signal enters the microcontroller (pic18f25k80, Datasheet) on the INT1 pin (RB1). I wrote the code to initialize the external interrupt:
#include <stdio.h> #include <stdlib.h> #include <pic18f25k80.h> #include "config.h" void main() { TRISB1 = 1; // INT1 as input LATB1 = 0; // Clear INT1 TRISC6 = 0; // RC6 as output LATC6 = 0; // Clear RC6 //Setup of INT1 RCONbits.IPEN = 0; //Disable priorities INTCONbits.GIE_GIEH = 1; //Enable Global interrupt INTCONbits.PEIE_GIEL = 1; //Enable peripheral interrupts INTCON2bits.INTEDG1 = 1; // Edge select for INT1 INTCON3bits.INT1IE = 1; // Enable the INT1 external interrupt //INTCON3bits.INT1IP = 0; // Low priority INTCON3bits.INT1IF = 0; //Clear external interrupt flag bit while(1) { } } //Interrupt Service Routine #pragma code isr=0x08 #pragma interrupt isr void isr(void) { if(INTCON3bits.INT1IF){ LATC6 = 1; } } #pragma code It seems that the interrupt flag doesn't go high, because the RC6 pin is low. I've measured that with an oscilloscope. What am I doing wrong?
BTW is that the correct way to call a ISR?

