Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Wierd compiler problem

Status
Not open for further replies.

magvitron

Active Member
Hi,
I was playing with PIC18f25k80 's ECAN module. Generated a code from application maestro and then compiled with the C-18 compiler. Everything else compiles but the CAN.c wont. It shows the below error. I have changed the PIR3 registers which the can interrupt registers supposed to have of the default IC that the application maestro generated code to the pic that i have, the pic have those to PIR5 and PIE5. I have included the files and everything and whne I compile it , it shows the below error.

B.png
attaching the whole project
 

Attachments

  • 123.zip
    89.4 KB · Views: 198
OK!!

You need to edit the "can.c " It seems as the definitions for the pic18f25k80 are overwritten causing untold pain..

This code has been modified for use in the hi-tech... XC8 compiler... You need to go through the definitions one by one as the CAN seems to be hard written to a different device.... I have rem'd out the definitions and now the TRISB is warning me...
 
Changed the bits according to the spec of the xc8 compiler, liek Still showing errors with Xc8 compilers too, with 16 bit shifts, unknown pragmas etc.
Code:
void CANISR(void)
{
    unsigned char TempCANCON;

    if(PIR5 & PIE5)
    {
        TempCANCON = CANCON;
//        PIE.RXB0IE=0;
        if(PIR5bits.RXB0IF && PIE5bits.RXB0IE)
        {
            RXB0IF = 0;        //Clear interrupt flag
            CANCON = CANCON & 0xF0 | RXB0Interrupt;
            CANGetMessage();
        }
        else if(RXB1IF && PIE5bits.RXB1IE)
        {
            RXB1IF = 0;        //Clear interrupt flag
            CANCON = CANCON & 0xF0 | RXB1Interrupt;
            CANGetMessage();
        }
        else if(TXB0IF && PIE5bits.TXB0IE)
        {
            CANCON = CANCON & 0xF0 | TXB0Interrupt;
            if(CANPutMessage())
                PIE5bits.TXB0IE = 0;
            else
                TXB0IF = 0;
        }
        else if(TXB1IF && PIE5bits.TXB1IE)
        {
            CANCON = CANCON & 0xF0 | TXB1Interrupt;
            if(CANPutMessage())
                PIE5bits.TXB1IE = 0;
            else
                TXB1IF = 0;
        }
        else if(TXB2IF && PIE5bits.TXB2IE)
        {
            CANCON = CANCON & 0xF0 | TXB2Interrupt;
            if(CANPutMessage())            //if there wasn't any more messages to send
                PIE5bits.TXB2IE = 0;                //disable interrupts for TXB2 and leave TXB2IF
            else                        //still on so PutCAN() can reenable the interrupt and instantly vector to ISR
                TXB2IF = 0;                //message was sent, just clear the interrupt flag.
        }
        else if(ERRIF && ERRIE)
        {
            ERRIF = 0;            //Clear interrupt flag
#ifdef CAN_ERROR_HANDLER_ENABLE
            CANErrorHandler();
#endif           
                                //No error handler implemented!!!
        }
        else if(WAKIF && WAKIE)
        {
            WAKIF = 0;            //Clear interrupt flag
        }

        CANCON = TempCANCON;
    }
}

Build E:\123\123 for device 18F25K80
Using driver C:\Program Files\Microchip\xc8\v1.12\bin\xc8.exe

Make: The target "E:\123\UARTIntC.p1" is out of date.
Executing: "C:\Program Files\Microchip\xc8\v1.12\bin\xc8.exe" --pass1 E:\123\UARTIntC.c -q --chip=18F25K80 -P --runtime=default --opt=default -N-1 -D__DEBUG=1 -g --asmlist "--errformat=Error [%n] %f; %l.%c %s" "--msgformat=Advisory[%n] %s" "--warnformat=Warning [%n] %f; %l.%c %s"
Error [100] ; . unterminated #if[n][def] block from line 49
(908) exit status = 1
Make: The target "E:\123\Can.p1" is up to date.
Make: The target "E:\123\CANInt.C18.ex.p1" is out of date.
Executing: "C:\Program Files\Microchip\xc8\v1.12\bin\xc8.exe" --pass1 E:\123\CANInt.C18.ex.c -q --chip=18F25K80 -P --runtime=default --opt=default -N-1 -D__DEBUG=1 -g --asmlist "--errformat=Error [%n] %f; %l.%c %s" "--msgformat=Advisory[%n] %s" "--warnformat=Warning [%n] %f; %l.%c %s"
Warning [335] E:\123\CANInt.C18.ex.c; 6.1 unknown pragma "interrupt"
Warning [335] E:\123\CANInt.C18.ex.c; 12.1 unknown pragma "code"
Error [195] E:\123\CANInt.C18.ex.c; 15.1 expression syntax
Error [312] E:\123\CANInt.C18.ex.c; 16.1 ";" expected
Warning [335] E:\123\CANInt.C18.ex.c; 19.1 unknown pragma "code"
(908) exit status = 1

********** Build failed! **********

this is the output that I get from the build output
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top