benoitstjean
Joined: 30 Oct 2007 Posts: 566 Location: Ottawa, Ontario, Canada
|
PIC24EP interrupts question |
Posted: Mon Dec 18, 2017 1:01 pm |
|
|
Compiler: 5.026
Device: PIC24EP512GP806
Quick question... as far as I know, I disable all interrupts before putting the PIC to sleep except for a few that will be used to wake-up the PIC.
Something else is waking-up the MCU because when it wakes-up, I check all interrupts using the following:
Code: |
fprintf( MONITOR_SERIAL, "\n\rINT_RDA: %u -- UART", interrupt_active( INT_RDA ));
fprintf( MONITOR_SERIAL, "\n\rINT_EXT0: %u -- SD Card", interrupt_active( INT_EXT0 ));
fprintf( MONITOR_SERIAL, "\n\rINT_EXT1: %u -- Input 1", interrupt_active( INT_EXT1 ));
fprintf( MONITOR_SERIAL, "\n\rINT_EXT2: %u -- Input 2", interrupt_active( INT_EXT2 ));
fprintf( MONITOR_SERIAL, "\n\rINT_EXT3: %u -- Motion ON", interrupt_active( INT_EXT3 ));
fprintf( MONITOR_SERIAL, "\n\rINT_EXT4: %u -- Motion OFF", interrupt_active( INT_EXT4 ));
|
On some occasions, none of the above show as being active meaning that something else woke-up the MCU.
Should I be reading IFS0/IEC0 to IF8/IEC8 registers to show what triggered the interrupt? Not sure if I'm doing this right. They all seem to be returning some values that doesn't make sense.
Note here that I never really use direct MCU registers but rather CCS functions... so sorry for my ignorance.
Thanks!
Ben |
|