• AVR Freaks

PIC24FJ64GA002 UART Undeclared Issue With MPLAB IDE 5.30, XC16 1.41

Author
s78eow3h
New Member
  • Total Posts : 2
  • Reward points : 0
  • Status: offline
2020/01/03 16:48:29 (permalink)
0

PIC24FJ64GA002 UART Undeclared Issue With MPLAB IDE 5.30, XC16 1.41

Hi everyone,
 
First time with PICs and first post on this forum (wasn’t sure if it should be in the PIC24, XC16 section or the IDE section).
 
I am trying to take some old code written by someone else for a PIC24FJ64GA002 and recompile it with some modifications. The item in question is a v3.6 Bus Pirate and the original code I am trying to compile with MPLab X IDE (v5.30) and XC16 cross compiler (v1.41) on a x64 bit Windows 7 computer can be found attached as firmware-XSVFplayer.
There appear to be some issues with the code, I have attempted to fix them and the exact code I am trying to compile is attached as MaxLen32CopyTest.X.
 
However for some reason it appears that the variables for UART can never be declared as when I compile I get:
UART.c: In function 'UART1RX':
UART.c:6:11: error: 'U1STAbits' undeclared (first use in this function)
UART.c:6:11: note: each undeclared identifier is reported only once for each function it appears in
UART.c:7:9: error: 'U1RXREG' undeclared (first use in this function)
UART.c: In function 'UART1TX':
UART.c:13:8: error: 'U1STAbits' undeclared (first use in this function)
UART.c:14:5: error: 'U1TXREG' undeclared (first use in this function)
UART.c: In function 'InitializeUART1':
UART.c:20:2: error: 'RPINR18bits' undeclared (first use in this function)
UART.c:21:2: error: 'RPOR1bits' undeclared (first use in this function)
UART.c:22:5: error: 'U1BRG' undeclared (first use in this function)
UART.c:23:5: error: 'U1MODE' undeclared (first use in this function)
UART.c:24:5: error: 'U1MODEbits' undeclared (first use in this function)
UART.c:25:5: error: 'U1STA' undeclared (first use in this function)
UART.c:27:5: error: 'U1STAbits' undeclared (first use in this function)
UART.c:28:5: error: 'IFS0bits' undeclared (first use in this function)
UART.c: In function 'UART1RX':
UART.c:8:1: warning: control reaches end of non-void function
nbproject/Makefile-default.mk:149: recipe for target 'build/default/production/UART.o' failed
 
My guess is that it is a bad IDX/XC16 install or the newer IDE does not support UART in the way this code implements it. Would anyone have any insight on how to fix this issue? I have previously posted in two other (non-microchip) forums however I don’t think they will get much traction as this seems to be a niche issue related to the IDE/cross compiler.
 
Any help would be appreciated.
 
Thanks.
#1

2 Replies Related Threads

    ric
    Super Member
    • Total Posts : 25244
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: PIC24FJ64GA002 UART Undeclared Issue With MPLAB IDE 5.30, XC16 1.41 2020/01/08 05:42:39 (permalink)
    5 (1)
    Every C module should #include xc.h
    Your uart.c does not.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #2
    s78eow3h
    New Member
    • Total Posts : 2
    • Reward points : 0
    • Status: offline
    Re: PIC24FJ64GA002 UART Undeclared Issue With MPLAB IDE 5.30, XC16 1.41 2020/01/10 21:22:04 (permalink)
    4 (1)
    I have added in the includes and now have no trouble.
     
    Thankyou so much for your help ric.
    #3
    Jump to:
    © 2020 APG vNext Commercial Version 4.5