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.

Display in only 1st line and 3rd line not on 2nd and 4th line in LCD

Status
Not open for further replies.

imranahmed

Advanced Member level 3
Joined
Dec 4, 2011
Messages
817
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,298
Location
Karachi,Pakistan
Activity points
6,492
Please let me know that i wrote the LCD program it is run successfully but problem is that the display shows only 1st and 3rd line but not show on 2nd line and 4th line ,how this problem be solved?
Can anyone interested to tell me?
 

Attachments

  • LCD_INTF.txt
    979 bytes · Views: 52

imranahmed said:
problem is that the display shows only 1st and 3rd line but not show on 2nd line and 4th line
The first thing that comes to mind by viewing your code is that you are missing a main loop. Both while(1) statements are satisfied under circumstances. Embedded software must never return from main().
As for the question, I can't imagine how it even reaches line 3. If you take under consideration that the LCD initialization is done by the following code:

Code:
void lcd()
{
  lcdcmd(0x0F);
  lcdcmd(0x01);
  lcdcmd(0x06);
  lcdcmd(0x80);  //This means that cursor will go to first line, first column.
}

Then the printed letters should be only in line 1 (because before every print you call lcd() function). Anyway, you could make a simpler code for starters, which writes on the four lines sequentially:

Code:
while (1)
{
  lcdcmd(0x80);   //cursor at line 1
  for(x=0;x<4;x++)
    lcddata(LCD[x]);

  lcdcmd(0x94);   //cursor at line 2
  for(x=0;x<4;x++)
    lcddata(LCD1[x]);

  lcdcmd(0xC0);   //cursor at line 3
  for(x=0;x<4;x++)
    lcddata(LCD[x]);

  lcdcmd(0xD4);   //cursor at line 4
  for(x=0;x<4;x++)
    lcddata(LCD1[x]);
}

So on LCD screen it should be printed:

Momo
Toto
Momo
Toto

As you realize by writing lcdcmd(0xXX); the cursor will go to position 0xXX.


Hope this helps,
Alexandros
 
Please let me know that if i want to display message of 25 or 26... characters of LCD 20x2 for e.g Message :"This is my first LCD program" how can i write this.
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top