2019-03-24 19:37发布
#include<reg51.h>#include<INTRINS.H>unsigned char Count1,fen1,shi1,miao1;sbit RELAY=P1^0;void main(void){TMOD=0x01;IE=0x82;TH0 = (65536-45872)/256;TL0 = (65536-45872)%256;TR0=1; while(1);//按键或别滴程序}
void T0_Int() interrupt 1{ TH0 = (65536-45872)/256; TL0 = (65536-45872)%256; Count1++; if(Count1==20) { Count1=0; miao1--; if(miao1==-1) { fen1--; miao1=59; if(fen1==-1) { //TR0=0;在按键中启动 shi1--; fen1=59; if(shi1==0)shi1=0; shi1=0; miao1=0; fen1=0; RELAY=~RELAY; //继电器动作 } } }}
最多设置5个标签!
不识庐山真面目
#include<reg51.h>
#include<INTRINS.H>
unsigned char Count1,fen1,shi1,miao1;
sbit RELAY=P1^0;
void main(void)
{
TMOD=0x01;
IE=0x82;
TH0 = (65536-45872)/256;
TL0 = (65536-45872)%256;
TR0=1;
while(1);//按键或别滴程序
}
void T0_Int() interrupt 1
[ 本帖最后由 xu__changhua 于 2011-11-8 09:45 编辑 ]{
TH0 = (65536-45872)/256;
TL0 = (65536-45872)%256;
Count1++;
if(Count1==20)
{
Count1=0;
miao1--;
if(miao1==-1)
{
fen1--;
miao1=59;
if(fen1==-1)
{
//TR0=0;在按键中启动
shi1--;
fen1=59;
if(shi1==0)shi1=0;
shi1=0;
miao1=0;
fen1=0;
RELAY=~RELAY; //继电器动作
}
}
}
}
一周热门 更多>