Search code examples
assemblymicrocontrollerpic

Included file not found for PIC10F200


I am trying to compile some code on a PIC10F200 and I am using MPLABX.
The following code is the main.asm file:

#include "p10f200.inc"
; CONFIG
    __CONFIG _WDT_OFF & _CP_OFF & _MCLRE_OFF
    ORG 0x0000
INIT ; We are initializing the microcontroller over the next three lines.
    MOVLW ~(1 << GP1)  ;these two lines set GP1 as an output
    TRIS GPIO
    BSF GPIO, GP1 ;this line is where we set GP1 output high to light the LED
LOOP 
    GOTO LOOP                          ; loop forever
END ; Needed to end the program.


The error says that the compiler cannot find the p10f200.inc file.

"C:\Program Files\Microchip\xc8\v2.20\bin\xc8-cc.exe" -c  -mcpu=10F200   -mdfp="C:/Program Files (x86)/Microchip/MPLABX/v5.40/packs/Microchip/PIC10-12Fxxx_DFP/1.3.46/xc8"  -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   -o build/default/production/main.o  main.asm 
::: advisory: (2049) C99 compliant libraries are currently not available for baseline or mid-range devices, or for enhanced mid-range devices using a reentrant stack; using C90 libraries
main.asm:1:10: fatal error: 'p10f200.inc' file not found
#include "p10f200.inc"
         ^~~~~~~~~~~~~
1 error generated.
make[2]: *** [build/default/production/main.o] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
(908) exit status = 1
nbproject/Makefile-default.mk:113: recipe for target 'build/default/production/main.o' failed
make[2]: Leaving directory 'C:/Users/build/MPLABXProjects/Demo Final.X'
nbproject/Makefile-default.mk:91: recipe for target '.build-conf' failed
make[1]: Leaving directory 'C:/Users/build/MPLABXProjects/Demo Final.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed

BUILD FAILED (exit value 2, total time: 457ms)

Sorry if this is a basic error, I am super new to using micro-controllers and assembly.


Solution

  • I know this won't be a complete answer, but I hope it will place you on the right track.

    Microchip replaced its old assembler with a new one in the latest releases of XC8. There are lots of changes, including the syntax, which is hard to summarize in this answer. You need to refer to the manual of the new assembler. Unfortunately, most of the examples you can find on internet are not valid anymore.

    For example, you need just #include "xc.inc" at the beginning. Absolute memory allocation is not supported anymore. Configs also have a different syntax, like CONFIG WRT = OFF. And a lot more... Again, you need to refer to the manual.