The issue appears to be related to the following #define macros:
Code:
#define RS [COLOR="#FF0000"]PORTCbits.RC0[/COLOR]
#define RW [COLOR="#FF0000"]PORTCbits.RC1[/COLOR]
#define EN [COLOR="#FF0000"]PORTCbits.RC2[/COLOR]
Particularly the predefined structure elements in
red, I suspect the pic18f4550.h header file in your version of the compiler is the source of the issue.
Upload the pic18f4550.h from the
include directory of your compiler, as well as the htc.h and pic18.h header files.
If you examine your code listing:
Code:
#include<htc.h>
#include<string.h>
#define _XTAL_FREQ 20000000
#define RS PORTCbits.RC0
#define RW PORTCbits.RC1
#define EN PORTCbits.RC2
#define LED RA0
void lcd_cmd(unsigned char a);
void lcd_data1(unsigned char b);
//void lcd_write(unsigned char);
//unsigned char name[]="ABHISHEK";
void main()
{
unsigned char i=0;
TRISB=0;
LATB=0;
TRISC=0;
LATC=0;
TRISA=0;
lcd_cmd(0x38);
__delay_ms(10);
lcd_cmd(0x0E);
__delay_ms(10);
lcd_cmd(0x06);
__delay_ms(10);
lcd_cmd(0x01);
__delay_ms(10);
lcd_data1('A');
LED=1;
while(1);
}
void lcd_cmd(unsigned char a)
{
RS=0; [COLOR="#FF0000"]// line 37[/COLOR]
RW=0; [COLOR="#FF0000"]// line 38[/COLOR]
LATC=a;
EN=1; [COLOR="#FF0000"]// line 40[/COLOR]
__delay_ms(10);
EN=0; [COLOR="#FF0000"]// line 42[/COLOR]
}
void lcd_data1(unsigned char b)
{
RS=1; [COLOR="#FF0000"]// line 47[/COLOR]
RW=0; [COLOR="#FF0000"]// line 48[/COLOR]
LATC=b;
EN=1; [COLOR="#FF0000"]// line 50[/COLOR]
__delay_ms(10);
EN=0; [COLOR="#FF0000"]// line 52[/COLOR]
}
And compare it to the build messages:
Executing: "C:\Program Files (x86)\HI-TECH Software\PICC-18\PRO\9.65\bin\picc18.exe" --pass1 "E:\Embedded Program\PIC18F4550\LCD\lcd_pic.c" -q --chip=18F4550 -P --runtime=default --opt=default -D__DEBUG=1 -g --asmlist "--errformat=Error [%n] %f; %l.%c %s" "--msgformat=Advisory[%n] %s" "--warnformat=Warning [%n] %f; %l.%c %s"
Error [255] E:\Embedded Program\PIC18F4550\LCD\lcd_pic.c; 37.14 not a member of the struct/union ""
Error [182] E:\Embedded Program\PIC18F4550\LCD\lcd_pic.c; 37.16 illegal conversion between types
Error [255] E:\Embedded Program\PIC18F4550\LCD\lcd_pic.c; 38.14 not a member of the struct/union ""
Error [182] E:\Embedded Program\PIC18F4550\LCD\lcd_pic.c; 38.16 illegal conversion between types
Error [255] E:\Embedded Program\PIC18F4550\LCD\lcd_pic.c; 40.14 not a member of the struct/union ""
Error [182] E:\Embedded Program\PIC18F4550\LCD\lcd_pic.c; 40.16 illegal conversion between types
Error [255] E:\Embedded Program\PIC18F4550\LCD\lcd_pic.c; 42.14 not a member of the struct/union ""
Error [182] E:\Embedded Program\PIC18F4550\LCD\lcd_pic.c; 42.16 illegal conversion between types
Error [255] E:\Embedded Program\PIC18F4550\LCD\lcd_pic.c; 47.14 not a member of the struct/union ""
Error [182] E:\Embedded Program\PIC18F4550\LCD\lcd_pic.c; 47.16 illegal conversion between types
Error [255] E:\Embedded Program\PIC18F4550\LCD\lcd_pic.c; 48.14 not a member of the struct/union ""
Error [182] E:\Embedded Program\PIC18F4550\LCD\lcd_pic.c; 48.16 illegal conversion between types
Error [255] E:\Embedded Program\PIC18F4550\LCD\lcd_pic.c; 50.14 not a member of the struct/union ""
Error [182] E:\Embedded Program\PIC18F4550\LCD\lcd_pic.c; 50.16 illegal conversion between types
Error [255] E:\Embedded Program\PIC18F4550\LCD\lcd_pic.c; 52.14 not a member of the struct/union ""
Error [182] E:\Embedded Program\PIC18F4550\LCD\lcd_pic.c; 52.16 illegal conversion between types
********** Build failed! **********
You will notice a correlation between the line number of the code listing, the build messages and your #define macros.
I suspect you have either not specified the correct device in the project wizard
Or the structure referred to in your #defined macros,
PORTCbits, is not defined or defined differently in your compilers version of the pic18f4550.h device specific header file.
BigDog