UyAb
Junior Member level 2
- Joined
- Mar 6, 2013
- Messages
- 20
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Location
- Tacloban City, Philippines
- Activity points
- 1,416
something's wrong with the display of my countdown timer..here's the problem..
for example: if I input 1:36,then the countdown starts from 1:36,1:35,1:34....and when the last digit becomes "0",after 1sec it should be "9" right?but instead it becomes "6"..
and same goes to the second digit..please help me finish this code..I think I need to put additional routines but I don't know how..
Some0ne out there,please show me how to do it..tnx
for example: if I input 1:36,then the countdown starts from 1:36,1:35,1:34....and when the last digit becomes "0",after 1sec it should be "9" right?but instead it becomes "6"..
and same goes to the second digit..please help me finish this code..I think I need to put additional routines but I don't know how..
Some0ne out there,please show me how to do it..tnx
Code:
void display_time()
{
Lcd_Chr(2,8,h+48);
Lcd_Chr(2,9,':');
Lcd_Chr(2,10,m2+48);
Lcd_Chr(2,11,m1+48);
}
void countdown_timer()
{
Lcd_Cmd(Lcd_Clear);
Lcd_Out(1,1,"Time Left:");
Lcd_Out(2,14,"H:M");
for(h=code[0]-48;h>-1;h--)
{ display_time();
for(m2=code[1]-48;m2>-1;m2--)
{ display_time();
for(m1=code[2]-48;m1>-1;m1--)
{display_time();
delay_ms(1000);
}
}
}
}
Last edited: