It's been awhile since I did any PIC programming so I got all of the necessary software and tools together today and I coded a little "hello world" program. Im using the 12F683 with MPLAB X 2.26 on Ubuntu 14.04.
Here's my code:
- Code: Select all
#if defined(__XC)
#include <xc.h> /* XC8 General Include File */
//include <stdint.h> /* For uint8_t definition */
//#include <stdbool.h> /* For true/false definition */
#include <pic12f683.h>
#pragma config WDTE = OFF
#pragma config PWRTE = OFF
#pragma config CP = OFF
#pragma config BOREN = OFF
#pragma config MCLRE = OFF
#pragma config FOSC = INTOSCIO
void main ()
{
unsigned int LED = 0;
unsigned int count = 0;
//all outputs
TRISIO = 0x00;
LED = 0;
count = 0;
while ( 1 )
{
while ( count < 10000 )
{
count++;
}
//Reset delay loop counter
count = 0;
//flip the LED
LED = !LED;
if ( LED ) GPIO = 0xFF ;
else GPIO = 0x00 ;
}
}
Here is the output:
- Code: Select all
CLEAN SUCCESSFUL (total time: 51ms)
(908) exit status = 1
make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory `/home/ile/MPLABXProjects/CLOQ.X'
make[2]: *** [build/default/production/_ext/1560481397/main.p1] Error 1
make[1]: *** [.build-conf] Error 2
make -f nbproject/Makefile-default.mk dist/default/production/CLOQ.X.production.hex
make: *** [.build-impl] Error 2
make[2]: Entering directory '/home/ile/MPLABXProjects/CLOQ.X'
"/opt/microchip/xc8/v1.33/bin/xc8" --pass1 --chip=12F683 -Q -G --double=24 --float=24 --opt=default,+asm,+asmfile,-speed,+space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,+osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -obuild/default/production/_ext/1560481397/main.p1 ../VC_CLOCK.X/main.c
:: error: (100) unterminated #if[n][def] block from line 5
nbproject/Makefile-default.mk:94: recipe for target 'build/default/production/_ext/1560481397/main.p1' failed
make[2]: Leaving directory '/home/ile/MPLABXProjects/CLOQ.X'
make[1]: Leaving directory `/home/ile/MPLABXProjects/CLOQ.X'
BUILD FAILED (exit value 2, total time: 55ms)
Also not sure if this is important but I got the following warnings in the "Configuration Warning Error" section of the compiler window:
- Code: Select all
warning: Configuration "XC8_PIC12F609" builds with "XC8" at "/Applications/microchip/xc8/v1.10/bin", but no toolchain of that type is installed there.
info: Configuration "XC8_PIC12F609" will build with toolchain "XC8" at "/opt/microchip/xc8/v1.33/bin".
warning: Configuration "XC8_PIC12F609" builds with "XC8" at "/Applications/microchip/xc8/v1.10/bin", but no toolchain of that type is installed there.
info: Configuration "XC8_PIC12F609" will build with toolchain "XC8" at "/opt/microchip/xc8/v1.33/bin".
warning: Configuration "XC8_PIC12F609" builds with "XC8" at "/Applications/microchip/xc8/v1.10/bin", but no toolchain of that type is installed there.
info: Configuration "XC8_PIC12F609" will build with toolchain "XC8" at "/opt/microchip/xc8/v1.33/bin".
Debugging this kind of thing is well above my skill level. Can anyone suggest where to start? I just set up MPLABX and the XC8, XC16 and XC32 compilers today on my new computer and this is the first program that I have tried to build so it is quite likely that I did something wrong at that step. Any help is greatly appreciated.