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.

Pic 32 and Mplab X

Status
Not open for further replies.

be80be

Well-Known Member
Been playing at this can't figure what I missing here
Code:
CLEAN SUCCESSFUL (total time: 423ms)
make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory 'C:/Users/USER/MPLABXProjects/blink32.X'
make  -f nbproject/Makefile-default.mk dist/default/production/blink32.X.production.hex
make[2]: Entering directory 'C:/Users/USER/MPLABXProjects/blink32.X'
In file included from main.c:4:0:
c:\program files\microchip\xc32\v1.43\pic32mx\include\lega-c\plib.h:41:30: fatal error: peripheral/adc10.h: No such file or directory
 #include <peripheral/adc10.h>
                              ^
compilation terminated.
"C:\Program Files\Microchip\xc32\v1.43\bin\xc32-gcc.exe" -g -x c -c -mprocessor=32MX250F128B -MMD -MF build/default/production/main.o.d -o build/default/production/main.o main.c -DXPRJ_default=default -legacy-libc 
nbproject/Makefile-default.mk:111: recipe for target 'build/default/production/main.o' failed
make[2]: Leaving directory 'C:/Users/USER/MPLABXProjects/blink32.X'
nbproject/Makefile-default.mk:84: recipe for target '.build-conf' failed
make[1]: Leaving directory 'C:/Users/USER/MPLABXProjects/blink32.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
make[2]: *** [build/default/production/main.o] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 1s)
Code:
#include <stdio.h>
#include <stdlib.h>
#include <xc.h>
#include <plib.h>

#define SYS_FREQ         (80000000L)

 main() {
    SYSTEMConfig(SYS_FREQ, 0);
   
    mPORTAClearBits(BIT_0);                    //Clear bits to ensure light is off.
    mPORTASetPinsDigitalOut(BIT_0);            //Set port as output

    int i;
    int j;
   
    while(1) {                                //This loop determines the initial time between blinks.
       
        j = 100000;
       
        while (j){                            //This loop controlls how quickely blinking speeds up.
            mPORTAToggleBits(BIT_0);        //Toggle light status. (Can be viewed in LATA SFR)
           
            i = j;                            //Time to wait in between toggle.
            while(i--) {}                    //Kill time.
           
            j = j - 1000;                    //Increase constant to increas blinking speed faster.
        }
    }
 
Your plib.h isn't pointing to the right place..

Is the legacy peripheral library installed???
Have you got MPLAB 32-suite installed... These are the libraries then are on about.
https://www.microchip.com/mplab/compilers

Select downloads and right at the bottom... Pic32 legacy peripheral librabray - windows.
 
There Installed it still can't find them you can see them but its not using them
blink.png
 
Last edited:
Your error states!

c:\program files\microchip\xc32\v1.43\pic32mx\include\lega-c\plib.h:

If this directory is incorrect, you need to sort it..

The bit that gets me is that the libraries aren't even used in your code?? Just delete that line..
 
That helped some lol but I still don't understand this is a sample code for microstick
Code:
CLEAN SUCCESSFUL (total time: 120ms)
make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory 'C:/Users/USER/MPLABXProjects/blink32.X'
make  -f nbproject/Makefile-default.mk dist/default/production/blink32.X.production.hex
make[2]: Entering directory 'C:/Users/USER/MPLABXProjects/blink32.X'
main.c: In function 'main':
main.c:11:18: error: 'BIT_0' undeclared (first use in this function)
  mPORTAClearBits(BIT_0);     //Clear bits to ensure light is off.
                  ^
main.c:11:18: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [build/default/production/main.o] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
"C:\Program Files\Microchip\xc32\v1.43\bin\xc32-gcc.exe" -g -x c -c -mprocessor=32MX250F128B -MMD -MF build/default/production/main.o.d -o build/default/production/main.o main.c -DXPRJ_default=default -legacy-libc 
nbproject/Makefile-default.mk:111: recipe for target 'build/default/production/main.o' failed
make[2]: Leaving directory 'C:/Users/USER/MPLABXProjects/blink32.X'
nbproject/Makefile-default.mk:84: recipe for target '.build-conf' failed
make[1]: Leaving directory 'C:/Users/USER/MPLABXProjects/blink32.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed

BUILD FAILED (exit value 2, total time: 930ms)
 
Oh lol v1.43 I have v1.40
I think I figured this out the microstick sample for the 33 and 24 chips works fine but the 32 chips
I don't have all the needed files to rebuild the proj guess I'll just read the datasheet and start from scratch
 
Last edited:
mPORTAClearBits if I can find the file for this Id be in business

It's not in there no more PIC32MX250F128B processor header

So here's the problem
Warning: Project "BlinkLED" refers to file "C:\Users\USER\Desktop\MicroStickII PIC32 Code Example (3)\MicroStickII PIC32 Code Example\BlinkLED.c" that contains spaces or odd characters in its name or its path.
Some of the files in this Project "BlinkLED" contain spaces or odd characters in their name or their path. This could potentially cause issues during the build process. This is a limitation of GNU Make tool that we use as part of our build process. Removing spaces from all file and folder names included in this project will eliminate this potential issue.
 
Last edited:
All the definitions are in ports.h..
Ok Ian I spent haft a day looking I don't have a ports.h
Now in the Pic32 legacy peripheral library there is but like you said I'm not using it it's only used if you add #include <plib.h> I'm using xc32 something wrong with windows 10 and how it installed mplab X

If I use a pic 33 or the 24 they use the same port stuff like toggle mPORTAClearBits but for some reason xc32 is not

Whats even funner is that xc32 clearly has plib.h which points to ports.h but no ports.h
 
Last edited:
OK after all day with this I finely got it figured out. The pic32 has way to many setting lol.
But I got it going with Mplab X v3.35 and xC32.
The problem is after xC32 1.40 so guess what I have both but mplab just installed 1.43 and when I added the legacy files where do they in 1.40 which has it lol not 1.43 which my mplab ide is using.
 
Guess your on your own now days
Why doesn't this work
Code:
 _LATA0 != _LATA0
xc 32 doesn't say it's wrong but the led never toggles.
But if I use the micro for
Code:
 mPORTAToggleBits(BIT_0)
it works look like both would work.
 
Now got figure all the crazy naming they got going on
Code:
 _LATA0 =~ _LATA0
works
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top