
2个回答
展开全部
你好,这是我用89C2051写的时钟程序,约2K BIT,如下是一个按键为移位的程序.:
CASE0,CASE1就是功能转换,
另两个按键分别为加减,且有加速功能.程序功能强大,容量小,是我得意之作.
尊重他人知识,请不抄袭.
程序很长,这是片断,如你有意用我的硬件,软件方案,请联系.多谢!
void scan_enter_key()
{
unsigned char data time_key=0;
if(enter_key==0)
{
dely_ms55();//while(~ms55);//while(ms55);
// if(enter_key==0)
{ if(enter_key==0&&ad_key==0){while(enter_key==0){dely_ms55();time_key=70;min50=0;} }
if(enter_key==0){while(enter_key==0){dely_ms55();time_key++;min50=0;} }
if(time_key>10){ se=~se;
if(psw_psw==0)
{be0_ok=~be0_ok;if(be0_ok==1)bell_1s();}
if(psw_psw==1)
{
if(B_OutA_Time_end==1&&B_OutB_Time_end==1)
{ OutA_Time_H=OutA_Time_M=0;
OutB_Time_H=OutB_Time_M=0;
B_OutA_Time_end=B_OutB_Time_end=0;
}
Bcount_on=1;be1_ok=~be1_ok;
if(be1_ok==1)bell_1s();}
if(time_key>60)//3--10秒 是否铃响?/?//按下大于6秒,该状态数据清零
{
switch(psw_psw)
{
case 0:hour=min=ms51=0;mon=day=1;break;
case 1:B_Run_Able=~B_Run_Able;break;
default:time_key=0;break;
}
}//是否清除 ?
}
else {
se=0;psw_psw++;if(psw_psw>1){psw_psw=0;} //
}
}
}
}
CASE0,CASE1就是功能转换,
另两个按键分别为加减,且有加速功能.程序功能强大,容量小,是我得意之作.
尊重他人知识,请不抄袭.
程序很长,这是片断,如你有意用我的硬件,软件方案,请联系.多谢!
void scan_enter_key()
{
unsigned char data time_key=0;
if(enter_key==0)
{
dely_ms55();//while(~ms55);//while(ms55);
// if(enter_key==0)
{ if(enter_key==0&&ad_key==0){while(enter_key==0){dely_ms55();time_key=70;min50=0;} }
if(enter_key==0){while(enter_key==0){dely_ms55();time_key++;min50=0;} }
if(time_key>10){ se=~se;
if(psw_psw==0)
{be0_ok=~be0_ok;if(be0_ok==1)bell_1s();}
if(psw_psw==1)
{
if(B_OutA_Time_end==1&&B_OutB_Time_end==1)
{ OutA_Time_H=OutA_Time_M=0;
OutB_Time_H=OutB_Time_M=0;
B_OutA_Time_end=B_OutB_Time_end=0;
}
Bcount_on=1;be1_ok=~be1_ok;
if(be1_ok==1)bell_1s();}
if(time_key>60)//3--10秒 是否铃响?/?//按下大于6秒,该状态数据清零
{
switch(psw_psw)
{
case 0:hour=min=ms51=0;mon=day=1;break;
case 1:B_Run_Able=~B_Run_Able;break;
default:time_key=0;break;
}
}//是否清除 ?
}
else {
se=0;psw_psw++;if(psw_psw>1){psw_psw=0;} //
}
}
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询