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

Interrupt number not found

I am getting the following error:
*** ERROR L125: INTERRUPT NUMBER NOT DEFINED SYMBOL: XP0INT

I am not sure why because the symbol is a standard interrupt vector for CAN. Here is my code:

void CAN_vIsr(void) interrupt XP0INT
{
        if (XP0IR)
        {
                if (CAN_OBJ[1].MCR & 0x0300 == 0x0200)
                        {
                                if(CAN_OBJ[1].MCR & 0x0c00 == 0x0800)
                                        {
                                                for(i=0;i=7;i++)
                                                        {
                                                                CAN_OBJ[0].Data[i] = CAN_OBJ[1].Data[i];
                                                                can_data[i] = CAN_OBJ[1].Data[i];
                                                        }
                                        }
                                CAN_OBJ[1].MCR = 0xF5FD;
                        }
        }
        XP0IR = 0;
    RTCvalue = (can_data[0]*3600) + (can_data[1]*60);
        currentRT();
}


The DAVE code (a GUI tool by Keil to develop files the user can then modify) uses the same interrupt vector.

Parents
  • I ma back to basic debugging skills which apparently I lack. I changed the code a bit and now am exposed to problems whose solutions are not being obvious to me. Code:

    //*********************************************
    // CAN transmit code
    //*********************************************
    
    #include "main.h"
    #include "reg164.h"
    int i;
    unsigned int can_data[8];
    extern RTCvalue;
    extern struct
    {
            int daysa;
            int daysb;
            int hour;
            int minute;
            int seconds;
        int day;
            int month;
            int year1;
            int year2;
    }time;
    //extern XP0INT;
    void CANinit(void)
    {
     //initializing CAN control registers
     C1CSR = 0x41; // initializes CAN controller
     C1BTR = 0x3453; //50Kb baudrate
     BFLD(DP4,0x0020,0x0000);
     BFLD(DP4,0x0040,0x0040);
     C1GMS = 0xE0FF;
    // enabling interrupts from the CAN module
     XP0IC = 0x69; //GLVL = 01, ILVL = 10.
     XP0IE = 1;
    
     //initializing CAN messgae object and registers
     CAN_OBJ[0].MCR = 0x5695;
     CAN_OBJ[0].UAR = 0x60D0;//ID=0x683 (NQS_TIME&DATE)
     CAN_OBJ[0].LAR = 0x0000;
     CAN_OBJ[0].MCFG = 0x68; //DLC=6,DIR=1(TX), StdId
    
    //initializing data for CAN_OBJ[0]
     CAN_OBJ[0].Data[0] = 0x00;
     CAN_OBJ[0].Data[1] = 0x00;
     CAN_OBJ[0].Data[2] = 0x00;
     CAN_OBJ[0].Data[3] = 0x00;
     CAN_OBJ[0].Data[4] = 0x00;
     CAN_OBJ[0].Data[5] = 0x00;
     CAN_OBJ[0].Data[6] = 0x00;
     CAN_OBJ[0].Data[7] = 0x00;
    //end of data bytes
    
    //initializing CAN_OBJ[1] for NIT_Time_Date
    CAN_OBJ[1].MCR = 0x5695;
    CAN_OBJ[1].UAR = 0xE0DA; //ID of 0x6D7
    CAN_OBJ[1].LAR = 0x0000;
    CAN_OBJ[1].MCFG = 0x60; //DLC = 6, DIR=0(RX), StdID
    CAN_OBJ[1].Data[0] = 0x00;
    CAN_OBJ[1].Data[1] = 0x00;
    CAN_OBJ[1].Data[2] = 0x00;
    CAN_OBJ[1].Data[3] = 0x00;
    CAN_OBJ[1].Data[4] = 0x00;
    CAN_OBJ[1].Data[5] = 0x00;
    CAN_OBJ[1].Data[6] = 0x00;
    CAN_OBJ[1].Data[7] = 0x00;
    
    //end of initializing CAN_OBJ[1]
    
    
    
    //Following data objects are not used but still must be initialized. byte MSGVAL is set to invalid
     CAN_OBJ[2].MCR = 0x5555;//message object invalid
     CAN_OBJ[3].MCR = 0x5555;//message object invalid
     CAN_OBJ[4].MCR = 0x5555;//message object invalid
     CAN_OBJ[5].MCR = 0x5555;//message object invalid
     CAN_OBJ[6].MCR = 0x5555;//message object invalid
     CAN_OBJ[7].MCR = 0x5555;//message object invalid
     CAN_OBJ[8].MCR = 0x5555;//message object invalid
     CAN_OBJ[9].MCR = 0x5555;//message object invalid
     CAN_OBJ[10].MCR = 0x5555;//message object invalid
     CAN_OBJ[11].MCR = 0x5555;//message object invalid
     CAN_OBJ[12].MCR = 0x5555;//message object invalid
     CAN_OBJ[13].MCR = 0x5555;//message object invalid
     CAN_OBJ[14].MCR = 0x5555;//message object invalid
    
    // Resetting the CSR otherwise the module would get into an initialization loop
    C1CSR = 0x0000;
    RTCinit();
    
    }
    
    void CAN_NQS_time_date(void)
    {
     CAN_OBJ[0].Data[0] = time.hour;
     CAN_OBJ[0].Data[1] = time.minute;
     CAN_OBJ[0].Data[2] = time.day;
     CAN_OBJ[0].Data[3] = time.month;
     CAN_OBJ[0].Data[4] = time.year1;
     CAN_OBJ[0].Data[5] = time.year2;
     CAN_OBJ[0].Data[6] = 0x00;
     CAN_OBJ[0].Data[7] = 0x00;
    
    CAN_OBJ[0].MCR = 0xe7ff;
    }
    void CAN_viIsr(void) interrupt XP0INT
    {
    
            for(i=0; i<=7; i++)
                    {
                            CAN_OBJ[0].Data[i] = CAN_OBJ[1].Data[i];
                    }
                    CAN_OBJ[1].MCR = 0xF5FD;
            for(i=0; i<=2; i++)
                    {
                            can_data[i] = CAN_OBJ[1].Data[i];
                    }
            XP0IR = 0;
        RTCvalue = (can_data[0]*3600) + (can_data[1]*60);
    }
    


    Errors:

    CAN_2.C(104): error C25: syntax error near ';'
    CAN_2.C(107): error C25: syntax error near '='
    CAN_2.C(107): error C25: syntax error near '<='
    CAN_2.C(107): error C25: syntax error near '++'
    CAN_2.C(109): error C25: syntax error near 'struct'
    CAN_2.C(109): error C25: syntax error near ')'
    CAN_2.C(109): error C109: illegal constant expression
    CAN_2.C(109): error C144: 'array': initialization needs curly braces
    CAN_2.C(110): error C25: syntax error near '}'
    CAN_2.C(111): error C25: syntax error near 'struct'
    CAN_2.C(111): error C25: syntax error near ')'
    CAN_2.C(112): error C25: syntax error near 'for'
    CAN_2.C(112): error C25: syntax error near '='
    CAN_2.C(112): error C7: compilation aborted

Reply
  • I ma back to basic debugging skills which apparently I lack. I changed the code a bit and now am exposed to problems whose solutions are not being obvious to me. Code:

    //*********************************************
    // CAN transmit code
    //*********************************************
    
    #include "main.h"
    #include "reg164.h"
    int i;
    unsigned int can_data[8];
    extern RTCvalue;
    extern struct
    {
            int daysa;
            int daysb;
            int hour;
            int minute;
            int seconds;
        int day;
            int month;
            int year1;
            int year2;
    }time;
    //extern XP0INT;
    void CANinit(void)
    {
     //initializing CAN control registers
     C1CSR = 0x41; // initializes CAN controller
     C1BTR = 0x3453; //50Kb baudrate
     BFLD(DP4,0x0020,0x0000);
     BFLD(DP4,0x0040,0x0040);
     C1GMS = 0xE0FF;
    // enabling interrupts from the CAN module
     XP0IC = 0x69; //GLVL = 01, ILVL = 10.
     XP0IE = 1;
    
     //initializing CAN messgae object and registers
     CAN_OBJ[0].MCR = 0x5695;
     CAN_OBJ[0].UAR = 0x60D0;//ID=0x683 (NQS_TIME&DATE)
     CAN_OBJ[0].LAR = 0x0000;
     CAN_OBJ[0].MCFG = 0x68; //DLC=6,DIR=1(TX), StdId
    
    //initializing data for CAN_OBJ[0]
     CAN_OBJ[0].Data[0] = 0x00;
     CAN_OBJ[0].Data[1] = 0x00;
     CAN_OBJ[0].Data[2] = 0x00;
     CAN_OBJ[0].Data[3] = 0x00;
     CAN_OBJ[0].Data[4] = 0x00;
     CAN_OBJ[0].Data[5] = 0x00;
     CAN_OBJ[0].Data[6] = 0x00;
     CAN_OBJ[0].Data[7] = 0x00;
    //end of data bytes
    
    //initializing CAN_OBJ[1] for NIT_Time_Date
    CAN_OBJ[1].MCR = 0x5695;
    CAN_OBJ[1].UAR = 0xE0DA; //ID of 0x6D7
    CAN_OBJ[1].LAR = 0x0000;
    CAN_OBJ[1].MCFG = 0x60; //DLC = 6, DIR=0(RX), StdID
    CAN_OBJ[1].Data[0] = 0x00;
    CAN_OBJ[1].Data[1] = 0x00;
    CAN_OBJ[1].Data[2] = 0x00;
    CAN_OBJ[1].Data[3] = 0x00;
    CAN_OBJ[1].Data[4] = 0x00;
    CAN_OBJ[1].Data[5] = 0x00;
    CAN_OBJ[1].Data[6] = 0x00;
    CAN_OBJ[1].Data[7] = 0x00;
    
    //end of initializing CAN_OBJ[1]
    
    
    
    //Following data objects are not used but still must be initialized. byte MSGVAL is set to invalid
     CAN_OBJ[2].MCR = 0x5555;//message object invalid
     CAN_OBJ[3].MCR = 0x5555;//message object invalid
     CAN_OBJ[4].MCR = 0x5555;//message object invalid
     CAN_OBJ[5].MCR = 0x5555;//message object invalid
     CAN_OBJ[6].MCR = 0x5555;//message object invalid
     CAN_OBJ[7].MCR = 0x5555;//message object invalid
     CAN_OBJ[8].MCR = 0x5555;//message object invalid
     CAN_OBJ[9].MCR = 0x5555;//message object invalid
     CAN_OBJ[10].MCR = 0x5555;//message object invalid
     CAN_OBJ[11].MCR = 0x5555;//message object invalid
     CAN_OBJ[12].MCR = 0x5555;//message object invalid
     CAN_OBJ[13].MCR = 0x5555;//message object invalid
     CAN_OBJ[14].MCR = 0x5555;//message object invalid
    
    // Resetting the CSR otherwise the module would get into an initialization loop
    C1CSR = 0x0000;
    RTCinit();
    
    }
    
    void CAN_NQS_time_date(void)
    {
     CAN_OBJ[0].Data[0] = time.hour;
     CAN_OBJ[0].Data[1] = time.minute;
     CAN_OBJ[0].Data[2] = time.day;
     CAN_OBJ[0].Data[3] = time.month;
     CAN_OBJ[0].Data[4] = time.year1;
     CAN_OBJ[0].Data[5] = time.year2;
     CAN_OBJ[0].Data[6] = 0x00;
     CAN_OBJ[0].Data[7] = 0x00;
    
    CAN_OBJ[0].MCR = 0xe7ff;
    }
    void CAN_viIsr(void) interrupt XP0INT
    {
    
            for(i=0; i<=7; i++)
                    {
                            CAN_OBJ[0].Data[i] = CAN_OBJ[1].Data[i];
                    }
                    CAN_OBJ[1].MCR = 0xF5FD;
            for(i=0; i<=2; i++)
                    {
                            can_data[i] = CAN_OBJ[1].Data[i];
                    }
            XP0IR = 0;
        RTCvalue = (can_data[0]*3600) + (can_data[1]*60);
    }
    


    Errors:

    CAN_2.C(104): error C25: syntax error near ';'
    CAN_2.C(107): error C25: syntax error near '='
    CAN_2.C(107): error C25: syntax error near '<='
    CAN_2.C(107): error C25: syntax error near '++'
    CAN_2.C(109): error C25: syntax error near 'struct'
    CAN_2.C(109): error C25: syntax error near ')'
    CAN_2.C(109): error C109: illegal constant expression
    CAN_2.C(109): error C144: 'array': initialization needs curly braces
    CAN_2.C(110): error C25: syntax error near '}'
    CAN_2.C(111): error C25: syntax error near 'struct'
    CAN_2.C(111): error C25: syntax error near ')'
    CAN_2.C(112): error C25: syntax error near 'for'
    CAN_2.C(112): error C25: syntax error near '='
    CAN_2.C(112): error C7: compilation aborted

Children
  • It always helps if you mark which lines are mentioned in the error messaes.

    It seems like the compiler goes wrong at the XP0INT keyword and complains about a ';' character. Have you somewhere in any header file played with the XP0INT define, and somewhere added a ';' in the #define?

    You should think about pre-processing the source and look at the result after all #define has been expanded. Then it will be obvious why the compiler complains.