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.

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?

I have posted this twice in microcontroller section , i am not getting even a single feedback; plz i need a help very badly:cry: ...

Please help me,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();
}
}
//************************************//
 

You need to try first if ST7066U is compatible with HD44780.
Connect your LCD in 4 bit mode.
The LCD library of mikroC is so easy to use.
 

The ST7066U has pin function compatibility with the HD44780, KS0066 and SED1278 that allows the user to easily replace it with an ST7066U. The ST7066U character generator ROM is extended to generate 240 5x8(5x11) dot character fonts for a total of 240 different character fonts. The low power supply (2.7V to 5.5V) of the ST7066U is suitable for any portable battery-driven product requiring low power dissipation.

---------- Post added at 13:23 ---------- Previous post was at 13:16 ----------

also see
https://forum.crystalfontz.com/showthread.php?6119-ST7066U-compatibility-issues
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top