Questions about MPLAB X IDE 5.30

Thread Starter

StrongPenguin

Joined Jun 9, 2018
307
I installed MPLAB X IDE, along with the XC8. I am used to Code Composer Studio, and there, when I create a new project, all the various files are generated automatically. I never gave attention to actually what these files do, nor do I remember names. But when I create a Project in MPLAB, basically nothing is created, except a bunch of empty folders.

For a small project, I would usually only need "Header Files" and "Important Files", right? The other folders (Linker, Source, Libs, Loadables) are for bigger projects, right?

In CCS, I always used to have a header file open for my specific microcontroller (MSP430G2553.h i think..), where I could see all the keywords that the IDE recognised. But I can't find this file here..?

What are the .XML files for?
 

AlbertHall

Joined Jun 4, 2014
12,338
For a small project, I would usually only need "Header Files" and "Important Files", right? The other folders (Linker, Source, Libs, Loadables) are for bigger projects, right?
You would at least one source code file else you would not have a project that would do anything.
 

Ian Rogers

Joined Dec 12, 2012
1,136
In CCS, I always used to have a header file open for my specific microcontroller (MSP430G2553.h i think..), where I could see all the keywords that the IDE recognised. But I can't find this file here..?
With the XC compilers all you need is the XC.H as it'll pick the processor up from the project.

I hate the code composer and will never use it... It creates generic code and make reading the source impossible..

XML!! No idea... never needed them either!!
 

Thread Starter

StrongPenguin

Joined Jun 9, 2018
307
You would at least one source code file else you would not have a project that would do anything.

You are very right about that, AlbertHall. My concern was if I needed something to fill in all those folders for my puny blinky project, or if it was usually the bigger projects who required all those folders.

@Ian Rogers Ok, I will just use the xc.h, then. I found the other file I was looking for, in the install folder. Makes the transition a bit easier from CCS.

Ok, I tried to compile this, using PICkit 3 programmer and a PIC16F1615 chip. No luck.

Note0: It may be worth mentioning, that I only connected MCLR, Vss and Vdd of the PICkit3, because I read somewhere those were the ones needed for "normal" projects.
Note1: Tested with all pins on PICkit3 connected. Still nothing.

Code:
#include <stdio.h>
#include <stdlib.h>
#include <xc.h>

#define _XTAL_FREQ 8000000

// BEGIN CONFIG
#pragma config FOSC = HS // Oscillator Selection bits (HS oscillator)
#pragma config WDTE = ON // Watchdog Timer Enable bit (WDT enabled)
#pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled)
#pragma config BOREN = ON // Brown-out Reset Enable bit (BOR enabled)
#pragma config LVP = OFF // Low-Voltage (Single-Supply) In-Circuit Serial Programming Enable bit (RB3 is digital I/O, HV on MCLR must be used for programming)
#pragma config CPD = OFF // Data EEPROM Memory Code Protection bit (Data EEPROM code protection off)
#pragma config WRT = OFF // Flash Program Memory Write Enable bits (Write protection off; all program memory may be written to by EECON control)
#pragma config CP = OFF // Flash Program Memory Code Protection bit (Code protection off)
//END CONFIG

int main()
{
  TRISA4 = 0; //RB0 as Output PIN
  while(1)
  {
    RA4 = 1;  // LED ON
    __delay_ms(1000); // 1 Second Delay
    RA4 = 0;  // LED OFF
    __delay_ms(1000); // 1 Second Delay
  }
  return 0;
}
The error code was this
Code:
make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory '/home/klamint/Engineering/PIC/Project Location/BlinkyTesting.X'
make  -f nbproject/Makefile-default.mk dist/default/production/BlinkyTesting.X.production.hex
make[2]: Entering directory '/home/klamint/Engineering/PIC/Project Location/BlinkyTesting.X'
"/opt/microchip/xc8/v2.10/bin/xc8-cc"  -mcpu=16F1615 -c    -fno-short-double -fno-short-float -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -DXPRJ_default=default  -msummary=-psect,-class,+mem,-hex,-file  -ginhx032 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall   -std=c99 -gdwarf-3 -mstack=compiled:auto:auto     -o build/default/production/main.p1 main.c
"/opt/microchip/xc8/v2.10/bin/xc8-cc"  -mcpu=16F1615 -Wl,-Map=dist/default/production/BlinkyTesting.X.production.map  -DXPRJ_default=default  -Wl,--defsym=__MPLAB_BUILD=1    -fno-short-double -fno-short-float -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -msummary=-psect,-class,+mem,-hex,-file  -ginhx032 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -std=c99 -gdwarf-3 -mstack=compiled:auto:auto      -Wl,--memorysummary,dist/default/production/memoryfile.xml -o dist/default/production/BlinkyTesting.X.production.elf  build/default/production/main.p1    
main.c:20:: error: (1363) unknown configuration setting/register (CPD = OFF) used
(908) exit status = 1
nbproject/Makefile-default.mk:138: recipe for target 'dist/default/production/BlinkyTesting.X.production.hex' failed
make[2]: Leaving directory '/home/klamint/Engineering/PIC/Project Location/BlinkyTesting.X'
nbproject/Makefile-default.mk:91: recipe for target '.build-conf' failed
make[1]: Leaving directory '/home/klamint/Engineering/PIC/Project Location/BlinkyTesting.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
make[2]: *** [dist/default/production/BlinkyTesting.X.production.hex] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 980ms)
 
Last edited:

AlbertHall

Joined Jun 4, 2014
12,338
You do always need to connect all five connections to the PICKIT.
Delete the line '#pragma config CPD = OFF' as this relates to the EEPROM but that chip doesn't have an EEPROM. Instead it uses 'high endurance flash'
 

AlbertHall

Joined Jun 4, 2014
12,338
Immediately before the 'TRISA4' line add a line 'ANSELA = 0'.
This sets the pins to digital I/O. Without this line the pins are set for analogue input.
It shouldn't affect digital outputs though, but it's worth trying.
 

Thread Starter

StrongPenguin

Joined Jun 9, 2018
307
Ok, I finally succeeded in getting KiCAD to work on my Linux machine so I could come up with a schematic. Haven't quite gotten proficient at using it yet, so bare with me. All the wires lead to the PICkit3, which I don't know how to draw. The chip in use is a PIC16F1615, which is not in the KiCAD library.

I can't remember the size of the cap, but it's small.

@AlbertHall I got the code to compile by just deleting lines until it worked. But it won't flash the PIC.
Yes, there is a 220 Ohm resistor in series. I will soon receive my Curiosity HPC board, so I will be free of all this PICkit3 hassle, but I would be fun to see it work, though.
 

Attachments

Top