I am trying to interface lcd 16*2 and I have MPLABx IDE V4.15 (xc8 compiler ) and I have PIC16F877A
I am following link here
https://electrosome.com/lcd-pic-mplab-xc8/
output
How to resoloved problem ?
I am following link here
https://electrosome.com/lcd-pic-mplab-xc8/
C:
#define _XTAL_FREQ=20000000
#define RS RD2
#define EN RD3
#define D4 RD4
#define D5 RD5
#define D6 RD6
#define D7 RD7
// PIC16F877A Configuration Bit Settings
// 'C' source line config statements
// 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)
#include <xc.h>
#include "lcd.h";
void main(void) {
unsigned int a;
TRISD = 0x00;
Lcd_Init();
while(1)
{
Lcd_Clear();
Lcd_Set_Cursor(1,1);
Lcd_Write_String("LCD Library for");
Lcd_Set_Cursor(2,1);
Lcd_Write_String("MPLAB XC8");
__delay_ms(2000);
Lcd_Clear();
Lcd_Set_Cursor(1,1);
Lcd_Write_String("Developed By");
Lcd_Set_Cursor(2,1);
Lcd_Write_String("electroSome");
__delay_ms(2000);
Lcd_Clear();
Lcd_Set_Cursor(1,1);
Lcd_Write_String("www.electroSome.com");
for(a=0;a<15;a++)
{
__delay_ms(300);
Lcd_Shift_Left();
}
for(a=0;a<15;a++)
{
__delay_ms(300);
Lcd_Shift_Right();
}
Lcd_Clear();
Lcd_Set_Cursor(2,1);
Lcd_Write_Char('e');
Lcd_Write_Char('S');
__delay_ms(2000);
}
}
Code:
make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory 'E:/3. Embedded System/2. PIC/6. Sample Project/LCD.X'
make -f nbproject/Makefile-default.mk dist/default/production/LCD.X.production.hex
make[2]: Entering directory 'E:/3. Embedded System/2. PIC/6. Sample Project/LCD.X'
"C:\Program Files (x86)\Microchip\xc8\v1.33\bin\xc8.exe" --pass1 --chip=16F877A -Q -G --double=24 --float=24 --opt=default,+asm,+asmfile,-speed,+space,-debug --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/lcd.p1 lcd.c
lcd.h:32: error: (195) expression syntax
lcd.h:32: error: (187) too few function arguments
lcd.h:32: error: (194) ")" expected
lcd.h:32: error: (195) expression syntax
lcd.h:37: warning: (371) missing basic type; int assumed
lcd.h:66: error: (195) expression syntax
lcd.h:66: error: (187) too few function arguments
lcd.h:66: error: (194) ")" expected
lcd.h:66: error: (195) expression syntax
lcd.h:68: error: (195) expression syntax
lcd.h:68: error: (187) too few function arguments
lcd.h:68: error: (194) ")" expected
lcd.h:68: error: (195) expression syntax
lcd.h:70: error: (195) expression syntax
lcd.h:70: error: (187) too few function arguments
lcd.h:70: error: (194) ")" expected
lcd.h:70: error: (195) expression syntax
lcd.h:90: error: (195) expression syntax
lcd.h:90: error: (187) too few function arguments
lcd.h:90: error: (194) ")" expected
lcd.h:90: error: (195) expression syntax
lcd.h:94: error: (195) expression syntax
lcd.h:94: advisory: (1) too many errors (21)
nbproject/Makefile-default.mk:106: recipe for target 'build/default/production/lcd.p1' failed
make[2]: Leaving directory 'E:/3. Embedded System/2. PIC/6. Sample Project/LCD.X'
nbproject/Makefile-default.mk:90: recipe for target '.build-conf' failed
make[1]: Leaving directory 'E:/3. Embedded System/2. PIC/6. Sample Project/LCD.X'
(908) exit status = 1
make[2]: *** [build/default/production/lcd.p1] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
BUILD FAILED (exit value 2, total time: 24s)