sir , It's give me better result ..
peevishly it was shown me garbage values .. but now it shows numbers only .. ^_^
Thank u so muuuuch mdorian and every one else helped ..
but still i m having problem .. now see .. this is the initialization
Code:
char seconds = 0;
char minutes = 0;
char i;
char txt[4];
and this is the function of timer in main :
Code:
if(Timer==0) //check Timer set button press
{
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,2,"Countdown ");
Timerr(); //call Timer set function
}
and her is the function Timerr():
Code:
Timerr() // set Timer
{
k=1;
minutes=0;
Lcd_Cmd(0xc4);
ByteToStr(minutes,txt);// to see something if no button pressed
while(K!=6)
{
if(inc==0)
{ minutes++;while(inc==0);
ByteToStr(minutes,txt);
Lcd_Cmd(0xc4);
Lcd_Out_Cp(txt);
}
if(dec==0)
{
minutes--; while(inc==0);
ByteToStr(minutes,txt);
Lcd_Cmd(0xc4);
Lcd_Out_Cp(txt);
}
if(next==0)
{k=6;while(next==0);}
}
}
}
The problem is when i first ckliked inc buttons , it shows mw 46 then i cliked again it shows 78 then 22 then 53 ...
What do u think the problem can be ? ?
- - - Updated - - -
IT woooooooorks ..
Thanks for every body who helped me .. I m really thankful to u ppl so much
Yes .. I m using MikroC program ,, and this is the initialization data :
This is the if statment in main function :
Code:
char seconds = 0;
char minutes = 0;
char i;
char txt[4];
Code:
if(Timer==0) //check alarm set button press
{
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,2,"Countdown ");
Timerr(); //call Timer set function
for (i=60; i >= 0; i--)
{
seconds = i;
minutes = i / 60;
seconds = seconds - (minutes * 60);
Delay_ms(500);
IntToStr(seconds, txt);
Lcd_Out(2, 5, txt);
IntToStr(minutes, txt);
Lcd_Out(2, 1, txt);
Delay_ms(100);
}
and this is the Timerr() function :
Code:
Timerr() // set Timer
{
k=1;
minutes=0;
Lcd_Cmd(0xc4);
ByteToStr(minutes,txt);// to see something if no button pressed
while(K!=6)
{
if(inc==0)
{ minutes++;while(inc==0);
ByteToStr(minutes,txt);
Lcd_Cmd(0xc4);
Lcd_Out_Cp(txt);
}
if(dec==0)
{
minutes--; while(dec==0);
ByteToStr(minutes,txt);
Lcd_Cmd(0xc4);
Lcd_Out_Cp(txt);
}
if(next==0)
{k=6;while(next==0);}
}
}
I want to take the minutes that is taken from the user and start the countingdown function ..
the role that i wrote is nor function right ..
minutes = i / 60;
seconds = seconds - (minutes * 60);
Any one can suggest me a good way to do that ?
Thank u so much again .. i really appreciated