• AVR Freaks

Hot!C32 giving error for TRISB ??

Author
BHUSHAN
Starting Member
  • Total Posts : 62
  • Reward points : 0
  • Joined: 2019/02/04 23:17:18
  • Location: 0
  • Status: offline
2019/05/02 04:21:41 (permalink)
0

C32 giving error for TRISB ??

Hi!
Today onward I am getting this weird problem when compiling for my code for PIC32MX795F512L. Few days back same code was getting properly compiled.
 
void main(){
unsigned char i=0;
AD1PCFG = 0xFFFF;
TRISB = 0; // C32 is stating error: 'TRISB' undeclared (first use in this function)
LATB = 0xF0;
TRISFbits.TRISF2 = 1;
TRISFbits.TRISF8 = 0;
timer1_init();
InitI2C();
UART_init();//initialize UART
}
If I remove this line then code is getting compiled successfully otherwise it is showing error. Few days back same code was getting compiled. What may be the issue?
 
#1

9 Replies Related Threads

    Mysil
    Super Member
    • Total Posts : 3326
    • Reward points : 0
    • Joined: 2012/07/01 04:19:50
    • Location: Norway
    • Status: offline
    Re: C32 giving error for TRISB ?? 2019/05/02 05:04:15 (permalink)
    0
    Hi,
    Do you have any header file other than #include <p32xxxx.h>
    in the program file,
    or any other code before the main() function that define a symbol:  TRISB
     
        Mysil
    #2
    BHUSHAN
    Starting Member
    • Total Posts : 62
    • Reward points : 0
    • Joined: 2019/02/04 23:17:18
    • Location: 0
    • Status: offline
    Re: C32 giving error for TRISB ?? 2019/05/02 22:08:19 (permalink)
    0
    Mysil
    Hi,
    Do you have any header file other than #include <p32xxxx.h>
    in the program file,
    or any other code before the main() function that define a symbol:  TRISB
     
        Mysil




     
    Hello!
    I am using MPLAB v8.88 ide and C32 compiler(v2.02). C32 has provided controller specific header file #include<proc/p32mx795f512l.h>. I am using this header file with some of my own header files. in any of my header file I am not defining TRISB. Weird thing is that "proc/p32mx795f512l.h" has defined TRISB and TRISBbits. TRISBbits.x is getting compiled but TRISB is not. Also if I use TRISA or TRISD or TRISF or TRISG then there is no compilation error but TRISB is giving error.
    #3
    Mysil
    Super Member
    • Total Posts : 3326
    • Reward points : 0
    • Joined: 2012/07/01 04:19:50
    • Location: Norway
    • Status: offline
    Re: C32 giving error for TRISB ?? 2019/05/04 03:28:06 (permalink)
    0
    Hi,
    Works for me, with code shown in message #1.
    Using MPLAB IDE v8.92 and C32 compiler v2.02.
    Compilation is successfull,
    but of course Linking fail, since there are calls to functions that are not provided in the problem example.
     
    Problem example is incomplete,
    problem is caused by mistake(s) in code that is not shown.
    Error or warning from Compiler is caused by mistake in the same source file, or files #included in the file.
    Error or warning from Linker may be caused by mistake in any file in the project.
     
    To get any sensible help, you must show all code and header files in the project.
    In MPLAB there is a 'Package Project' tool with a wrapped package icon in the toolbar,
    it will produce a .zip file that may be used as attachment to a forum message.
    Use 'Open Full Version' in forum 'Quick Reply' editor.
     
    See also:  http://sscce.org/
     
        Mysil
    #4
    BHUSHAN
    Starting Member
    • Total Posts : 62
    • Reward points : 0
    • Joined: 2019/02/04 23:17:18
    • Location: 0
    • Status: offline
    Re: C32 giving error for TRISB ?? 2019/05/04 04:53:33 (permalink)
    0
    Thanks Mysil for your attention. Right now I don't have access to the complete project code. Maybe on Monday I will be able to provide you with full code. Sorry for inconvenience.
    #5
    BHUSHAN
    Starting Member
    • Total Posts : 62
    • Reward points : 0
    • Joined: 2019/02/04 23:17:18
    • Location: 0
    • Status: offline
    Re: C32 giving error for TRISB ?? 2019/05/05 22:11:59 (permalink)
    0
    Hi Mysil . I have attached my whole project with this post. The project is not same as what I posted earlier, however, nature of error is same. I compiled this project few weeks back and as you can see in main() there is an instruction TRISB = 0. That time this project got successfully compiled but now compiler is popping error for the very same instruction.
    Please suggest the cause of this error.
         Thank You
    #6
    BHUSHAN
    Starting Member
    • Total Posts : 62
    • Reward points : 0
    • Joined: 2019/02/04 23:17:18
    • Location: 0
    • Status: offline
    Re: C32 giving error for TRISB ?? 2019/05/06 22:24:54 (permalink)
    0
    Now my interrupts are also not working. My whole project got halted. Did my provided project compiled on your systems ?
    #7
    Mysil
    Super Member
    • Total Posts : 3326
    • Reward points : 0
    • Joined: 2012/07/01 04:19:50
    • Location: Norway
    • Status: offline
    Re: C32 giving error for TRISB ?? 2019/05/07 06:15:28 (permalink)
    +1 (1)
    Hi,
    Works for me, building and running program in simulator,
    and building program for programming with PICkit 3.
    Debug build of project `D:\Microchip Solutions\Forum\Bhushan_TRISB\test2\CAN rx\test2.mcp' started.
    Language tool versions: pic32-as.exe v2.02, pic32-gcc.exe v2.02, pic32-ld.exe v2.02, pic32-ar.exe v2.02
    Preprocessor symbol `__DEBUG' is defined.
    Target debug platform is `__MPLAB_DEBUGGER_PK3=1'.
    Debug platform options are: `__ICD2RAM=1'.
    Tue May 07 14:20:19 2019
    ----------------------------------------------------------------------
    Make: The target "D:\Microchip Solutions\Forum\Bhushan_TRISB\test2\CAN rx\test2.o" is out of date.
    Executing: "C:\Program Files (x86)\Microchip\MPLAB C32 Suite\bin\pic32-gcc.exe" -mprocessor=32MX795F512L -x c -c "test2.c" -o"test2.o" -MMD -MF"test2.d" -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -g
    Make: The target "D:\Microchip Solutions\Forum\Bhushan_TRISB\test2\CAN rx\test2.elf" is out of date.
    Executing: "C:\Program Files (x86)\Microchip\MPLAB C32 Suite\bin\pic32-gcc.exe" -mdebugger -mprocessor=32MX795F512L "test2.o" -o"test2.elf" -Wl,-L"C:\Program Files (x86)\Microchip\MPLAB C32 Suite\lib",-L"C:\Program Files (x86)\Microchip\MPLAB C32 Suite\pic32mx\lib",--defsym=__MPLAB_BUILD=1,--defsym=__MPLAB_DEBUG=1,--defsym=__MPLAB_DEBUGGER_PK3=1,--defsym=__ICD2RAM=1,-Map="test2.map"
    Executing: "C:\Program Files (x86)\Microchip\MPLAB C32 Suite\bin\pic32-bin2hex.exe" "D:\Microchip Solutions\Forum\Bhushan_TRISB\test2\CAN rx\test2.elf"
    Loaded D:\Microchip Solutions\Forum\Bhushan_TRISB\test2\CAN rx\test2.elf.
    ----------------------------------------------------------------------
    Debug build of project `D:\Microchip Solutions\Forum\Bhushan_TRISB\test2\CAN rx\test2.mcp' succeeded.
    Language tool versions: pic32-as.exe v2.02, pic32-gcc.exe v2.02, pic32-ld.exe v2.02, pic32-ar.exe v2.02
    Preprocessor symbol `__DEBUG' is defined.
    Target debug platform is `__MPLAB_DEBUGGER_PK3=1'.
    Debug platform options are: `__ICD2RAM=1'.
    Tue May 07 14:20:21 2019
    ----------------------------------------------------------------------
    BUILD SUCCEEDED 

     
     
    Then in directory where device support files are located, e.g.:
    "C:\Program Files (x86)\Microchip\MPLAB C32 Suite\pic32mx\include\proc    

    Check that all files have the same date and time,also: p32mx795f512l.h   
    shall have the same date and time as all other files in the directory:  28.11.2011 14.44
     
        Mysil
     
    #8
    BHUSHAN
    Starting Member
    • Total Posts : 62
    • Reward points : 0
    • Joined: 2019/02/04 23:17:18
    • Location: 0
    • Status: offline
    Re: C32 giving error for TRISB ?? 2019/05/07 21:51:11 (permalink)
    0
    Mysil
    Hi,
    Works for me, building and running program in simulator,
    and building program for programming with PICkit 3.
    Debug build of project `D:\Microchip Solutions\Forum\Bhushan_TRISB\test2\CAN rx\test2.mcp' started.
    Language tool versions: pic32-as.exe v2.02, pic32-gcc.exe v2.02, pic32-ld.exe v2.02, pic32-ar.exe v2.02
    Preprocessor symbol `__DEBUG' is defined.
    Target debug platform is `__MPLAB_DEBUGGER_PK3=1'.
    Debug platform options are: `__ICD2RAM=1'.
    Tue May 07 14:20:19 2019
    ----------------------------------------------------------------------
    Make: The target "D:\Microchip Solutions\Forum\Bhushan_TRISB\test2\CAN rx\test2.o" is out of date.
    Executing: "C:\Program Files (x86)\Microchip\MPLAB C32 Suite\bin\pic32-gcc.exe" -mprocessor=32MX795F512L -x c -c "test2.c" -o"test2.o" -MMD -MF"test2.d" -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -g
    Make: The target "D:\Microchip Solutions\Forum\Bhushan_TRISB\test2\CAN rx\test2.elf" is out of date.
    Executing: "C:\Program Files (x86)\Microchip\MPLAB C32 Suite\bin\pic32-gcc.exe" -mdebugger -mprocessor=32MX795F512L "test2.o" -o"test2.elf" -Wl,-L"C:\Program Files (x86)\Microchip\MPLAB C32 Suite\lib",-L"C:\Program Files (x86)\Microchip\MPLAB C32 Suite\pic32mx\lib",--defsym=__MPLAB_BUILD=1,--defsym=__MPLAB_DEBUG=1,--defsym=__MPLAB_DEBUGGER_PK3=1,--defsym=__ICD2RAM=1,-Map="test2.map"
    Executing: "C:\Program Files (x86)\Microchip\MPLAB C32 Suite\bin\pic32-bin2hex.exe" "D:\Microchip Solutions\Forum\Bhushan_TRISB\test2\CAN rx\test2.elf"
    Loaded D:\Microchip Solutions\Forum\Bhushan_TRISB\test2\CAN rx\test2.elf.
    ----------------------------------------------------------------------
    Debug build of project `D:\Microchip Solutions\Forum\Bhushan_TRISB\test2\CAN rx\test2.mcp' succeeded.
    Language tool versions: pic32-as.exe v2.02, pic32-gcc.exe v2.02, pic32-ld.exe v2.02, pic32-ar.exe v2.02
    Preprocessor symbol `__DEBUG' is defined.
    Target debug platform is `__MPLAB_DEBUGGER_PK3=1'.
    Debug platform options are: `__ICD2RAM=1'.
    Tue May 07 14:20:21 2019
    ----------------------------------------------------------------------
    BUILD SUCCEEDED 

     
     
    Then in directory where device support files are located, e.g.:
    "C:\Program Files (x86)\Microchip\MPLAB C32 Suite\pic32mx\include\proc    

    Check that all files have the same date and time,also: p32mx795f512l.h   
    shall have the same date and time as all other files in the directory:  28.11.2011 14.44
     
        Mysil
     




     
    Thanks Mysil for your guidance and cooperation. My compiler has different dates and time. I will search the compiler on internet and if then I face any problem,I will let you know.
    Last but not the least, thanks a lot.
    #9
    qhb
    Superb Member
    • Total Posts : 9998
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: offline
    Re: C32 giving error for TRISB ?? 2019/05/07 22:56:22 (permalink)
    +1 (1)

    Nearly there...
    #10
    Jump to:
    © 2019 APG vNext Commercial Version 4.5