Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

plz help me:lcd interfacing problem with pic16f874?

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 have written a code in mikro c without using lcd library, my lcd has a ST7066U driver and i have written for 8-bit interfacing. now i have test the code in proteus 7 but nothing is showing.


Note: i am not using lcd library given in mikroc because the code is for HD44780 and for 4-bit. Is there a library for 8 bit interfacing? And is ST7066U is fully compatible with HD44780?

Please help me, can anyone check my code and tell me about is there any wrong with the code;

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()
{
  TRISA=0;
  TRISB=0;
  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)
{
 PORTB=cmd_code;
 enable();
}
//************************************//

void Lcd_int()
{
 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;
while(*text!='\0')
{
  PORTB=*text++;                  // for outputing a single byte at a time
  enable();
}
}
//************************************//
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top