I want to setup the fast external interrupt 0 (EXI0)on the Infineon XC16x board (pin P1H.0). My functions look like this:
void EXI0_Int (void) interrupt 24 { // Interrupt routine } void EXI0_Init (void) { EXICON |= 0x02; // Falling edge EXI0 CC1_CC8IC = CALC_IC (0, 1, 13, 0); // ILVL = 13, Interrupt enable PSW_IEN = 1; }
Did you set corresponding CAPCOM node ( Mode register ) to capture? The user-manual says so!
The register EXICON is write protected when global int is enabeled. Look if there is an global int enable in the startup file. This happend to me. The global int enable must be set after writing to EXICON.
Hallo! Did you find a solution? I need the EX1IN too anf it also doesn't work! Please send me your working example!
You can use the code generated by DAVE (command 0 to 4 as described in the SU user's manual) to get write access to the EXICON register after the EINIT (end of initialization) instruction has been executed:
// Unlock procedure void MAIN_vUnlockProtecReg(void) { unsigned char ubPASSWORD; //if low protected mode if((SCUSLS & 0x1800) == 0x0800) { ubPASSWORD = SCUSLS & 0x00FF; ubPASSWORD = ~ubPASSWORD; SCUSLC = 0x8E00 | ubPASSWORD; //command 4 } //if write protected mode if((SCUSLS & 0x1800) == 0x1800) { SCUSLC = 0xAAAA; //command0 SCUSLC = 0x5554; //command1 ubPASSWORD = SCUSLS & 0x00FF; ubPASSWORD = ~ubPASSWORD; SCUSLC = 0x9600 | ubPASSWORD; //command 2 SCUSLC = 0x0800; //command 3 ubPASSWORD = SCUSLS & 0x00FF; ubPASSWORD = ~ubPASSWORD; SCUSLC = 0x8E00 | ubPASSWORD; //command 4 } }
Thanks a lot! This was the problem! After I used the unprotected algorithm it works perfectly!