This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Fast external interrupt on XC164

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;
}
The interrupt doesn't work. Could anyone help me with the right settings?

Parents Reply Children
  • 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!