Fan174
Member level 2
Hello everyone
I have just started to learn about PIC. I would like to simply light a led with a microchip "PIC16F877A" I have installed MPLABX IDE
My code
I am struggling with first project I don't understand what's the problem Please guide me in right way
I have just started to learn about PIC. I would like to simply light a led with a microchip "PIC16F877A" I have installed MPLABX IDE
My code
Code:
#include <[I]stdio.h[/I]>
#include <[I]stdlib.h[/I]>
int main(int argc, char** argv) {
TRISA=0x00; //Configure PORT A as Output
TRISB=0x00; //Configure PORT B as Output
TRISC=0x00; //Configure PORT C as Output
TRISD=0x00; //Configure PORT D as Output
TRISE=0x00; //Configure PORT E as Output
PORTA=0;
PORTB=0;
PORTC=0;
PORTD=0;
PORTE=0;
while(1)
{
PORTA=~PORTA;
PORTB=~PORTB;
PORTC=~PORTC; //Toggle the All PORTS
PORTD=~PORTD;
PORTE=~PORTE;
__delay_ms(500);//Delay 500 milliseconds
}
return (EXIT_SUCCESS);
}
Code:
make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory 'F:/Software/PiC Development/PIC DEVELOPMENT BOARD/Example Programs FOR 16F877A/2. LCD/LCD 8 Bit/LED.X'
make -f nbproject/Makefile-default.mk dist/default/production/LED.X.production.hex
make[2]: Entering directory 'F:/Software/PiC Development/PIC DEVELOPMENT BOARD/Example Programs FOR 16F877A/2. LCD/LCD 8 Bit/LED.X'
"C:\Program Files (x86)\Microchip\xc8\v1.45\bin\xc8.exe" --pass1 --chip=16F877A -Q -G --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist -DXPRJ_default=default --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/newmain.p1 newmain.c
make[2]: *** [build/default/production/newmain.p1] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
newmain.c:4: error: (192) undefined identifier "TRISA"
newmain.c:5: error: (192) undefined identifier "TRISB"
newmain.c:6: error: (192) undefined identifier "TRISC"
newmain.c:7: error: (192) undefined identifier "TRISD"
newmain.c:8: error: (192) undefined identifier "TRISE"
newmain.c:10: error: (192) undefined identifier "PORTA"
newmain.c:11: error: (192) undefined identifier "PORTB"
newmain.c:12: error: (192) undefined identifier "PORTC"
newmain.c:13: error: (192) undefined identifier "PORTD"
newmain.c:14: error: (192) undefined identifier "PORTE"
newmain.c:23: warning: (361) function declared implicit int
(908) exit status = 1
nbproject/Makefile-default.mk:106: recipe for target 'build/default/production/newmain.p1' failed
make[2]: Leaving directory 'F:/Software/PiC Development/PIC DEVELOPMENT BOARD/Example Programs FOR 16F877A/2. LCD/LCD 8 Bit/LED.X'
nbproject/Makefile-default.mk:90: recipe for target '.build-conf' failed
make[1]: Leaving directory 'F:/Software/PiC Development/PIC DEVELOPMENT BOARD/Example Programs FOR 16F877A/2. LCD/LCD 8 Bit/LED.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
BUILD FAILED (exit value 2, total time: 2s)
I am struggling with first project I don't understand what's the problem Please guide me in right way
Last edited by a moderator: