• AVR Freaks

Hot!MPLABX newbie question

Author
upand_at_them
Super Member
  • Total Posts : 765
  • Reward points : 0
  • Joined: 2005/05/16 07:02:38
  • Location: Pennsylvania
  • Status: offline
2020/11/18 19:45:02 (permalink)
0

MPLABX newbie question

Never used MPLABX before.  I have a simple program, and it does compile, but the editor still shows underlined "warnings" such as "Unable to resolve identifier ANSELA".
 
Here's one example line:
 
ANSELA = 0;

 
Again, it does build successfully.
 
Here's the full program:
 
#include <xc.h>

#define _XTAL_FREQ 1000000

void main(void) {
   ANSELA = 0;
   ANSELB = 0;
   ANSELC = 0;
   ADCON0 = 0;
   ADCON1 = 0;
   ADCON2 = 0;
   CM1CON0 = 0;
   CM1CON1 = 0;
   CM2CON0 = 0;
   CM2CON1 = 0;
   TRISA = 0;
   TRISB = 0;
   TRISC = 0;
   LATA = 0;
   LATB = 0;
   LATC = 0;
            
   while(1)
   {
       LATBbits.LATB0 = 1;
       __delay_ms(100);
       LATBbits.LATB0 = 0;
       __delay_ms(400);
   }
}

 
Also, the "include" line throws an warning that "cannot find include file <xc.h>".
 
post edited by upand_at_them - 2020/11/18 19:55:28
#1

5 Replies Related Threads

    davea
    Super Member
    • Total Posts : 585
    • Reward points : 0
    • Joined: 2016/01/28 13:12:13
    • Location: Tampa Bay FL USA
    • Status: offline
    Re: MPLABX newbie question 2020/11/18 20:46:00 (permalink)
    -1 (1)
    Attachments are not available: Download requirements not met

    is this a new install
    windows search shows it's in a pack
    and the newest pack for this part shown here is unusable 
    post edited by davea - 2020/11/18 21:21:23

    Attachment(s)

    Attachments are not available: Download requirements not met
    #2
    upand_at_them
    Super Member
    • Total Posts : 765
    • Reward points : 0
    • Joined: 2005/05/16 07:02:38
    • Location: Pennsylvania
    • Status: offline
    Re: MPLABX newbie question 2020/11/19 05:53:03 (permalink)
    0
    It's a recent install of MPLABX v4.10.  But I already had a Microchip folder with other stuff installed, such as MPLAB 8.86.  (It's a WinXp machine.)
     
    Here's my project properties:
     

    Attachment(s)

    Attachments are not available: Download requirements not met
    #3
    oliverb
    Super Member
    • Total Posts : 369
    • Reward points : 0
    • Joined: 2009/02/16 13:12:38
    • Location: 0
    • Status: offline
    Re: MPLABX newbie question 2020/11/19 08:54:23 (permalink)
    0 (2)
    MPLAB X has a reputation for random warnings in the IDE. It seems as if the parser that is used to do syntax highlighting isn't properly synchronised with the build environment. In my experience the highlighting usually settles down after a successful compile.
     
    What seems to go wrong is that sometimes the highlighter fails to follow the #include link, meaning that everything that is defined in that include gets flagged. In this case xc.h wasn't found so all the PIC register names failed.
     
     
     
    #4
    upand_at_them
    Super Member
    • Total Posts : 765
    • Reward points : 0
    • Joined: 2005/05/16 07:02:38
    • Location: Pennsylvania
    • Status: offline
    Re: MPLABX newbie question 2020/11/19 18:30:57 (permalink)
    0
    Well, like I said, it compiles fine.  So compiling certainly doesn't fix the highlighting.
     
    Do I need to install a newer XC8?
    #5
    Mysil
    Super Member
    • Total Posts : 4065
    • Reward points : 0
    • Joined: 2012/07/01 04:19:50
    • Location: Norway
    • Status: online
    Re: MPLABX newbie question 2020/11/19 22:39:23 (permalink)
    +1 (1)
    Hi,
    There are issues with some versions of MPLAB X combined with some versions of XC8.
    You may try with an older version of XC8, e.g.   XC8 v2.10
    or a newer version of MPLAB X,   (e.g. newer than v5.45 is not there yet).
     
    See the screen capture in message #2: 
    different versions of XC8 are installed in different directories. 
    This is in connection with changing both XC8 and MPLAB X changing from 32 bit to 64 bit build.
    Each version of XC8 know where include files are stored,
    but the C language parsing stuff in MPLAB source code editor cannot always figure out what to use.
     
    About Windows XP, 
    Microchip have stopped testing new versions of MPLAB X on Windows XP,
    so you may rather figure out vhat versions work together, and stay with that.
    Although WinXP is able to run 64 bit images, there will be issues with installations and java versions,
    and it will break without developers knowing, or beeing willing or able to fix it.
     
        Mysil
    #6
    Jump to:
    © 2021 APG vNext Commercial Version 4.5