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.

string fetching on lcd

Status
Not open for further replies.

rajrahul2391

Junior Member level 1
Joined
May 22, 2013
Messages
19
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,404
hi,
i m using jhd 16x2 lcd where i m sending string of data greater than a row .can any body suggest me what should be the command or code to show this data on to next row as well.
 

Hi,

Use string length built in function to calculate the length of string and if the characters are greater than a row print first 15 and use if condition to print rest on to the second line. An example of how to calculate string length is described in the linkhttps://www.cplusplus.com/reference/cstring/strlen/?kw=strlen

enjoy!
 
Last edited by a moderator:

sir can u please give me example regarding to 8051 uc,i m new in embedded world .
 

Do you want your program to automatically type 2nd row when it finishes first row i.e.,16 characters..
Can you give more explanation..
for second line LCD command is 0xc0
 

yes sir you r right i want automatically turn my cursor to next line if text size is greater than 16 in 16x2 lcd.may u plz explain with example.
 


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
void lcd_dtring(unsigned char *str){
 
    while(*str){
 
        if(ctr < 17)lcd_cmd(0x80 + ctr)
        if((ctr >=17) && (ctr < 33))lcd_cmd(0xC0 + ctr - 16)
        lcd_data(*str++);
        ctr++;
 
    }
 
}

 
Last edited:
  • Like
Reactions: rajrahul2391

    rajrahul2391

    Points: 2
    Helpful Answer Positive Rating
    V

    Points: 2
    Helpful Answer Positive Rating
Try this code...
Hope you know the code to write for lcd_cmd and lcd_data and delay..
Code:
void lcd_data_string(unsigned char *string)
{
	unsigned short m=0;
	while(string[m]!='\0')
	{
 	  	if(m>16)
               {
                  n=m-17;
                  lcd_cmd(0xc0+n);
                  if(n>16)
                  {
                     m=0; 
                     delay_ms(300);
                     lcd_cmd(0x01);
                   }  
                }              
                lcd_data(string[m]);				  
 	  	m++;
   	}
}
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top