Jul 31, 2010 #1 I incognito_prince Newbie level 1 Joined Jul 31, 2010 Messages 1 Helped 0 Reputation 0 Reaction score 0 Trophy points 1,281 Location Indonesia Activity points 1,288 Hi.. I'm using ATMega8535 to control my 2x16 LCD. My problem is when I use sprintf to convert the number to be displayed on LCD the LCD repeat the character after the desired character that I want to display. Anyone can help me? Thanks before.. here is the code: char buff[33]; ...... while(1) { //lcd_gotoxy(2,0); //lcd_putsf("Actual Time"); lcd_gotoxy(0,0); sprintf(buff,"%02d:%02d:%02d",hour,minute,second); lcd_puts(buff); detect_key(); if(dtkey==0xC) { jump=1; menu(); } } .......
Hi.. I'm using ATMega8535 to control my 2x16 LCD. My problem is when I use sprintf to convert the number to be displayed on LCD the LCD repeat the character after the desired character that I want to display. Anyone can help me? Thanks before.. here is the code: char buff[33]; ...... while(1) { //lcd_gotoxy(2,0); //lcd_putsf("Actual Time"); lcd_gotoxy(0,0); sprintf(buff,"%02d:%02d:%02d",hour,minute,second); lcd_puts(buff); detect_key(); if(dtkey==0xC) { jump=1; menu(); } } .......
Jul 31, 2010 #2 bassa Super Moderator Staff member Joined Jul 15, 2007 Messages 1,815 Helped 191 Reputation 402 Reaction score 156 Trophy points 1,353 Location Sri Lanka Activity points 11,256 you may try this modification Code: while(1) { //lcd_gotoxy(2,0); //lcd_putsf("Actual Time"); //lcd_gotoxy(0,0); //This line commented lcd_clear(); //Add this line sprintf(buff,"%02d:%02d:%02d",hour,minute,second); lcd_puts(buff); delay_ms(200); //may need this, check delay time detect_key(); if(dtkey==0xC) { jump=1; menu(); } }
you may try this modification Code: while(1) { //lcd_gotoxy(2,0); //lcd_putsf("Actual Time"); //lcd_gotoxy(0,0); //This line commented lcd_clear(); //Add this line sprintf(buff,"%02d:%02d:%02d",hour,minute,second); lcd_puts(buff); delay_ms(200); //may need this, check delay time detect_key(); if(dtkey==0xC) { jump=1; menu(); } }