Hi guys, I'm quite new to PIC and MPLAB coding process. I made a project with using MPLAB MCC but when i try to build the project I'm getting some errors which I don't know how to fix. Any help is appreciated. Compiler is XC8 v2.31 and PIC is 18F25K22
The output of the program
CLEAN SUCCESSFUL (total time: 6ms)
make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory 'D:/Dersler/Master/UNAM/Thesis_PCB/Pic_Codes/TxTrialPic18FXC8v231.X'
make -f nbproject/Makefile-default.mk dist/default/production/TxTrialPic18FXC8v231.X.production.hex
make[2]: Entering directory 'D:/Dersler/Master/UNAM/Thesis_PCB/Pic_Codes/TxTrialPic18FXC8v231.X'
"D:\Program Files\Microchip\xc8\v2.31\bin\xc8-cc.exe" -mcpu=18F25K22 -c -mdfp="D:/Program Files/Microchip/MPLABX/v5.45/packs/Microchip/PIC18F-K_DFP/1.4.87/xc8" -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include" -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include/c90" -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include/c99" -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include/legacy" -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include/proc" -I"mcc_generated_files" -mwarn=-3 -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -std=c99 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/default/production/mcc_generated_files/device_config.p1 mcc_generated_files/device_config.c
"D:\Program Files\Microchip\xc8\v2.31\bin\xc8-cc.exe" -mcpu=18F25K22 -c -mdfp="D:/Program Files/Microchip/MPLABX/v5.45/packs/Microchip/PIC18F-K_DFP/1.4.87/xc8" -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include" -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include/c90" -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include/c99" -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include/legacy" -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include/proc" -I"mcc_generated_files" -mwarn=-3 -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -std=c99 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/default/production/mcc_generated_files/pin_manager.p1 mcc_generated_files/pin_manager.c
"D:\Program Files\Microchip\xc8\v2.31\bin\xc8-cc.exe" -mcpu=18F25K22 -c -mdfp="D:/Program Files/Microchip/MPLABX/v5.45/packs/Microchip/PIC18F-K_DFP/1.4.87/xc8" -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include" -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include/c90" -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include/c99" -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include/legacy" -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include/proc" -I"mcc_generated_files" -mwarn=-3 -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -std=c99 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/default/production/mcc_generated_files/epwm3.p1 mcc_generated_files/epwm3.c
"D:\Program Files\Microchip\xc8\v2.31\bin\xc8-cc.exe" -mcpu=18F25K22 -c -mdfp="D:/Program Files/Microchip/MPLABX/v5.45/packs/Microchip/PIC18F-K_DFP/1.4.87/xc8" -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include" -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include/c90" -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include/c99" -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include/legacy" -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include/proc" -I"mcc_generated_files" -mwarn=-3 -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -std=c99 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/default/production/mcc_generated_files/epwm2.p1 mcc_generated_files/epwm2.c
"D:\Program Files\Microchip\xc8\v2.31\bin\xc8-cc.exe" -mcpu=18F25K22 -c -mdfp="D:/Program Files/Microchip/MPLABX/v5.45/packs/Microchip/PIC18F-K_DFP/1.4.87/xc8" -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include" -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include/c90" -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include/c99" -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include/legacy" -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include/proc" -I"mcc_generated_files" -mwarn=-3 -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -std=c99 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/default/production/mcc_generated_files/mcc.p1 mcc_generated_files/mcc.c
"D:\Program Files\Microchip\xc8\v2.31\bin\xc8-cc.exe" -mcpu=18F25K22 -c -mdfp="D:/Program Files/Microchip/MPLABX/v5.45/packs/Microchip/PIC18F-K_DFP/1.4.87/xc8" -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include" -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include/c90" -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include/c99" -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include/legacy" -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include/proc" -I"mcc_generated_files" -mwarn=-3 -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -std=c99 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/default/production/mcc_generated_files/tmr4.p1 mcc_generated_files/tmr4.c
"D:\Program Files\Microchip\xc8\v2.31\bin\xc8-cc.exe" -mcpu=18F25K22 -c -mdfp="D:/Program Files/Microchip/MPLABX/v5.45/packs/Microchip/PIC18F-K_DFP/1.4.87/xc8" -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include" -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include/c90" -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include/c99" -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include/legacy" -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include/proc" -I"mcc_generated_files" -mwarn=-3 -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -std=c99 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/default/production/main.p1 main.c
"D:\Program Files\Microchip\xc8\v2.31\bin\xc8-cc.exe" -mcpu=18F25K22 -c -mdfp="D:/Program Files/Microchip/MPLABX/v5.45/packs/Microchip/PIC18F-K_DFP/1.4.87/xc8" -fno-short-double -fno-short-float -memi=wordwrite -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include" -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include/c90" -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include/c99" -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include/legacy" -I"../../../../../../Program Files/Microchip/xc8/v2.31/pic/include/proc" -I"mcc_generated_files" -mwarn=-3 -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-download -mdefault-config-bits -std=c99 -gdwarf-3 -mstack=compiled:auto:auto:auto -o build/default/production/mcc_generated_files/tmr2.p1 mcc_generated_files/tmr2.c
mcc_generated_files/epwm2.c:96:42: warning: implicit conversion loses integer precision: 'unsigned int' to 'unsigned char' [-Wconversion]
CCP2CON = ((uint8_t)(CCP2CON & 0xCF) | ((dutyValue & 0x0003)<<4));
~ ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:64:19: error: subscripted value is not an array, pointer, or vector
if (number[31 - i] == 1) {
~~~~~~^~~~~~~
1 error generated.
make[2]: *** [build/default/production/main.p1] Error 1
make[2]: *** Waiting for unfinished jobs....
(908) exit status = 1
nbproject/Makefile-default.mk:219: recipe for target 'build/default/production/main.p1' failed
mcc_generated_files/epwm3.c:96:42: warning: implicit conversion loses integer precision: 'unsigned int' to 'unsigned char' [-Wconversion]
CCP3CON = ((uint8_t)(CCP3CON & 0xCF) | ((dutyValue & 0x0003)<<4));
~ ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
terminate called after throwing an instance of 'std::invalid_argument'
what(): No such file or directory
error: clang frontend command failed with exit code 3 (use -v to see invocation)
(908) exit status = 1
nbproject/Makefile-default.mk:187: recipe for target 'build/default/production/mcc_generated_files/mcc.p1' failed
terminate called after throwing an instance of 'std::invalid_argument'
what(): No such file or directory
error: clang frontend command failed with exit code 3 (use -v to see invocation)
make[2]: *** [build/default/production/mcc_generated_files/mcc.p1] Error 1
make[2]: *** [build/default/production/mcc_generated_files/tmr2.p1] Error 1
(908) exit status = 1
nbproject/Makefile-default.mk:179: recipe for target 'build/default/production/mcc_generated_files/tmr2.p1' failed
terminate called after throwing an instance of 'std::invalid_argument'
what(): No such file or directory
error: clang frontend command failed with exit code 3 (use -v to see invocation)
make[2]: *** [build/default/production/mcc_generated_files/tmr4.p1] Error 1
(908) exit status = 1
nbproject/Makefile-default.mk:195: recipe for target 'build/default/production/mcc_generated_files/tmr4.p1' failed
terminate called after throwing an instance of 'std::invalid_argument'
what(): No such file or directory
error: clang frontend command failed with exit code 3 (use -v to see invocation)
(908) exit status = 1
nbproject/Makefile-default.mk:211: recipe for target 'build/default/production/mcc_generated_files/epwm2.p1' failed
make[2]: *** [build/default/production/mcc_generated_files/epwm2.p1] Error 1
make[2]: *** [build/default/production/mcc_generated_files/epwm3.p1] Error 1
terminate called after throwing an instance of 'std::invalid_argument'
what(): No such file or directory
error: clang frontend command failed with exit code 3 (use -v to see invocation)
(908) exit status = 1
nbproject/Makefile-default.mk:203: recipe for target 'build/default/production/mcc_generated_files/epwm3.p1' failed
make[2]: *** [build/default/production/mcc_generated_files/pin_manager.p1] Error 1
terminate called after throwing an instance of 'std::invalid_argument'
what(): No such file or directory
error: clang frontend command failed with exit code 3 (use -v to see invocation)
(908) exit status = 1
nbproject/Makefile-default.mk:171: recipe for target 'build/default/production/mcc_generated_files/pin_manager.p1' failed
terminate called after throwing an instance of 'std::invalid_argument'
what(): No such file or directory
error: clang frontend command failed with exit code 3 (use -v to see invocation)
(908) exit status = 1
nbproject/Makefile-default.mk:163: recipe for target 'build/default/production/mcc_generated_files/device_config.p1' failed
make[2]: Leaving directory 'D:/Dersler/Master/UNAM/Thesis_PCB/Pic_Codes/TxTrialPic18FXC8v231.X'
make[2]: *** [build/default/production/mcc_generated_files/device_config.p1] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
nbproject/Makefile-default.mk:91: recipe for target '.build-conf' failed
make[1]: Leaving directory 'D:/Dersler/Master/UNAM/Thesis_PCB/Pic_Codes/TxTrialPic18FXC8v231.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
BUILD FAILED (exit value 2, total time: 2s)
The main file that I use:
#include "mcc_generated_files/mcc.h"
/*
Main application
*/
#include <xc.h>
#include <stdio.h> // for sprintf
#include <stdint.h> // include stdint header
void send_signal(uint32_t number) {
int8_t i;
//Send 9 ms burst
TMR4_StartTimer();
__delay_ms(9);
//Send 4.5 ms space
TMR4_StopTimer();
__delay_us(4500);
for (i = 0; i < 32; i++) {
// If bit is 1 send 560us pulse and 1680us space
if (number[31 - i] == 1) {
TMR4_StartTimer();
__delay_us(560);
TMR4_StopTimer();
__delay_us(1680);
} // If bit is 0 send 560us pulse and 560us space
else {
TMR4_StartTimer();
__delay_us(560);
TMR4_StopTimer();
__delay_us(560);
}
}
// Send end bit
TMR4_StartTimer();
__delay_us(560);
TMR4_StopTimer();
__delay_us(560);
}
void main(void) {
// Initialize the device
SYSTEM_Initialize();
// If using interrupts in PIC18 High/Low Priority Mode you need to enable the Global High and Low Interrupts
// If using interrupts in PIC Mid-Range Compatibility Mode you need to enable the Global and Peripheral Interrupts
// Use the following macros to:
// Enable the Global Interrupts
//INTERRUPT_GlobalInterruptEnable();
// Disable the Global Interrupts
//INTERRUPT_GlobalInterruptDisable();
// Enable the Peripheral Interrupts
//INTERRUPT_PeripheralInterruptEnable();
// Disable the Peripheral Interrupts
//INTERRUPT_PeripheralInterruptDisable();
while (1) {
while (!PORTAbits.RA0) {
send_signal(0x40BF00FF);
__delay_ms(500);
}
while (!PORTAbits.RA1) {
send_signal(0x40BF807F);
__delay_ms(500);
}
while (!PORTAbits.RA2) {
send_signal(0x40BF40BF);
__delay_ms(500);
}
while (!PORTAbits.RA3) {
send_signal(0x40BF20DF);
__delay_ms(500);
}
while (!PORTAbits.RA4) {
send_signal(0x40BFA05F);
__delay_ms(500);
}
}
}