Hi,
Interrupt on a falling edge on PS5 can be configured as:
DDRS_DDRS5 = 0; /* PS5, input */
PPSS_PPSS5 = 0; /* PS5. Pull-up device selected, falling edge selected */
PERS_PERS5 = 1; /* PS5, Pull device enabled */
PIES_PIES5 = 1; /* PS5, Interrupt enabled */
To put the MCU into stop mode use:
asm ANDCC #0x7f; /* Clear S bit, enable STOP instruction */
asm STOP;
And clear the interrupt flag in the PortS_ISR after wakeup:
interrupt VectorNumber_Vports void PortS_ISR(void){
PIFS_PIFS5 = 1; /* Clear the PS5 interrupt flag */
}
Regards,
Daniel