CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

PIC24EP interrupts question

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
benoitstjean



Joined: 30 Oct 2007
Posts: 566
Location: Ottawa, Ontario, Canada

View user's profile Send private message

PIC24EP interrupts question
PostPosted: Mon Dec 18, 2017 1:01 pm     Reply with quote

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
Ttelmah



Joined: 11 Mar 2010
Posts: 19535

View user's profile Send private message

PostPosted: Mon Dec 18, 2017 2:06 pm     Reply with quote

I'd just read the interrupt flag registers and display any that have changed.
Suspicion would be that there is a fault with your old compiler not accessing the correct bits.

If you check my reply to your earlier thread:
<http://www.ccsinfo.com/forum/viewtopic.php?t=56828>

Your compiler was accessing the wrong bit for interrupt on change. Odds are this is not the only fault.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group