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.

Ask about sprintf in ATMega8535

Status
Not open for further replies.

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();
}
}
.......
 

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();
}
}
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top