demedeiros
Joined: 27 Dec 2013 Posts: 71
|
Rising Edge Interrupt On PIC24FJ64GA004 [Solved] |
Posted: Tue Dec 06, 2022 9:38 am |
|
|
Hi All,
Trying to setup a rising edge interrupt on a PIC24FJ64GA004. I have the signal connected to B12 (Or B13 if needed...).
Looking at the datasheet (PDF page 5), it looks like pins B12 and B13 are listed as Interrupt-on-Change inputs, so I am assuming I have an issue with my code. Any thoughts?
Code: | #include <main.h>
#include "flex_lcd.c"
#int_EXT1
void EXT1_isr(void)
{
if(input(ENC_B))
{
encoderCount += 1;
}else
{
encoderCount -= 1;
}
}
void main()
{
ext_int_edge(14,L_TO_H); //I assumed the source input was the CN#, but I think I am wrong?
enable_interrupts(INT_EXT1);
enable_interrupts(GLOBAL);
lcd_init();
// Clear the LCD.
printf(lcd_putc, "\f");
delay_ms(500);
output_high(BACKLIGHT);
while(TRUE)
{
printf(lcd_putc, "\fEnc: %lu", encoderCount);
delay_ms(250);
}
} |
|
|