jayanth.devarayanadurga
Banned
- Joined
- Dec 4, 2012
- Messages
- 4,280
- Helped
- 822
- Reputation
- 1,654
- Reaction score
- 791
- Trophy points
- 1,393
- Location
- Bangalore, India
- Activity points
- 0
I told you to clear lcd when H>=31. When Hh>=31 clear the lcd and j and then use lcd_cmd(0xC0+j).
#include <REGX51.H>Post your code and I will fix it.
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 void string_lcd(unsigned char *ptr) { unsigned int h,j = 0, k = 0; while(*ptr) { h++; if(h<15) { lcdcmd(0x80 + k); lcd_data(*ptr++); k++; } else if(h>=15 && h<=31) { lcdcmd(0xC0 + j); lcd_data(*ptr++); j++; } else if(h>31 && h<47) { h = 0; j = 0; k = 0; mdelay(300); lcdcmd(0x01); lcdcmd(0x80); lcdcmd(0x06); lcd_data(*ptr++); } //if(h>=47) //{ //lcdcmd(0xC0+j); //lcd_data(*ptr++); //j++; //} //mdelay(250); //lcdcmd(0x18); //} // *(ptr++); //} } }
Code C - [expand] 1 2 3 4 for(i=0;i<6;i++) { lcd_data(str2[i]); }
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 void string_lcd(unsigned char *ptr) { unsigned int h,j = 0, k = 0; while(*ptr) { h++; if((h > 31) && (h < 47)) { h = 0; j = 0; k = 0; mdelay(300); lcdcmd(0x01); lcdcmd(0x80); lcdcmd(0x06); //lcd_data(*ptr++); } else if((h >= 15) && (h <= 31)) { lcdcmd(0xC0 + j); lcd_data(*ptr++); j++; } else if(h < 15) { lcdcmd(0x80 + k); lcd_data(*ptr++); k++; } //if(h>=47) //{ //lcdcmd(0xC0+j); //lcd_data(*ptr++); //j++; //} //mdelay(250); //lcdcmd(0x18); //} // *(ptr++); //} } }
thanks jayTry this code
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 void string_lcd(unsigned char *ptr) { unsigned int h,j = 0, k = 0; while(*ptr) { h++; if(h<15) { lcdcmd(0x80 + k); lcd_data(*ptr++); k++; } else if(h>=15 && h<=31) { lcdcmd(0xC0 + j); lcd_data(*ptr++); j++; } else if(h>31 && h<47) { h = 0; j = 0; k = 0; mdelay(300); lcdcmd(0x01); lcdcmd(0x80); lcdcmd(0x06); lcd_data(*ptr++); } //if(h>=47) //{ //lcdcmd(0xC0+j); //lcd_data(*ptr++); //j++; //} //mdelay(250); //lcdcmd(0x18); //} // *(ptr++); //} } }
What are you printing one character at a time using lcd_data() function in the below code?
Code C - [expand] 1 2 3 4 for(i=0;i<6;i++) { lcd_data(str2[i]); }
Instead of lcd_data() function to print str2[] can't you use string_lcd(str2); so that string_lcd() functions takes care of printing the data on the two lines of LCD?
If the first code doesn't work then try this code.
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 void string_lcd(unsigned char *ptr) { unsigned int h,j = 0, k = 0; while(*ptr) { h++; if((h > 31) && (h < 47)) { h = 0; j = 0; k = 0; mdelay(300); lcdcmd(0x01); lcdcmd(0x80); lcdcmd(0x06); //lcd_data(*ptr++); } else if((h >= 15) && (h <= 31)) { lcdcmd(0xC0 + j); lcd_data(*ptr++); j++; } else if(h < 15) { lcdcmd(0x80 + k); lcd_data(*ptr++); k++; } //if(h>=47) //{ //lcdcmd(0xC0+j); //lcd_data(*ptr++); //j++; //} //mdelay(250); //lcdcmd(0x18); //} // *(ptr++); //} } }
yes i m using 16x2 lcd .i was try send data after pressed Enter .but here in our case when i was pressed enter and then lcd will sow data only .after that if i want send another data then lcd will not accept that input data. and when i m pressing reset button of LCD then only that lcd will show another dataWhat LCD are you using? 2X16? You sent data from usart to lcd? You pressed enter after ...131415 and then typed 161718.... ??
ohh open it nowView attachment Proteus files.zipView attachment Proteus files.zipPost your complete project files with Proteus file. I will check it.
ok i will send you again both file 20 is for ukail. and Proteus for proteusThe files you sent is not loading into proteus. Send all project files. I need the .c file
View attachment 88532
ok i will send you again both file 20 is for ukail. and Proteus for proteus
View attachment 88533
Your hex file is not loading in Proteus so I can't check your simulation. I told you not to print str using lcd_data(). After the serial data is read the data is stored in str2[] and converted to string. So, use string_lcd(str2); to print data.
Your hex file is not loading in Proteus so I can't check your simulation. I told you not to print str using lcd_data(). After the serial data is read the data is stored in str2[] and converted to string. So, use string_lcd(str2); to print data.
Your hex file is not loading in Proteus so I can't check your simulation. I told you not to print str using lcd_data(). After the serial data is read the data is stored in str2[] and converted to string. So, use string_lcd(str2); to print data.
Your code doesn't work. Send a working file which displays some string on lcd then I will help you. See image. All the pins of your MCU is high in Proteus simulation. I am not able to simulate your project. Just create a new project and write code to display some string like "EDABoard" on LCD and post all the project files and working Proteus file.
See this prints text on lcd as you need. lcd2.rar
See lcd2 v2.rar Find out why space is printed in lcd at the end of string and also find out why 1 or 2 character is not printed if lcd goes form line 2 to line 1.
What do you mean by that?how that can be able to see any text file sending from pc that may see in 16x2 lcd
What is .text file? Which program supported it?
What do you mean by that?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?