help me with this code? PIC interfacing with lcd

Status
Not open for further replies.

dashkil

Member level 2
Joined
Mar 3, 2012
Messages
45
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Activity points
1,620
I want to interface PIC18F4553 with LCD (having a controller of ST7066U) without using lcd library file. i have written a code using mikroc 2009 but it provides the following error messages: 1)';' expected but RS found
2) internal error

note: i am not willing to use lcd library because i am not sure ST7066U is it or is not compatible with HD44780?


I am posting the code; please help me,

Code:
sbit RS at RA0_bit;
sbit RW at RA1_bit;
sbit EN at RA2_bit;
//*************************************//
void enable();								             // for strobe control
void command(unsigned char cmd_code);		   // for instruction
void Lcd_string(unsigned char *text);		   // for writting a string
void Lcd_int();								             // for Lcd initialization
//***********************************//

void main()
{
  delay_ms(200);
  Lcd_int();
while(1)
{
  Lcd_string("ALMIGHTY *****");
  command(0x01);				                  // clear display
  command(0x02);                          // return cursor to origin
  delay_ms(200);
}
}
//***********************************//

void enable()
{
 EN=1;
 delay_ms(1);
 EN=0;
 delay_ms(2);
}
//************************************//

void command(unsigned char cmd_code)
{
 TRISB=0;
 PORTB=cmd_code;
 enable();
}
//************************************//

void Lcd_int()
{
 TRISA=0xFF;               // set portA as input
 RS=0;                    // for instruction data
 RW=0;				            // for write operation
 EN=0;			              // enable is low
 command(0x30);          // mode 8 bit, 1 line display,font 5x8
 command(0x30);
 command(0x0F);          // entire display on,cursor on,blinking on
 command(0x02);          // return cursor to origin
 command(0x01);	        // clear display
 command(0x06);	        // entry mode is set
}
//************************************//
void Lcd_string(unsigned char *text)
{
RS=1;
RW=0;
TRISB=0;
while(*text!='\0')
{
  PORTB=*text++;	          // for outputing a single byte at a time
  enable();
}
}
//************************************//
 
Last edited:

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…