重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
#includesbit L1=P0^1;
sbit L8=P0^7;
void Delay1ms() //@12.000MHz
{unsigned char i, j;
i = 12;
j = 169;
do
{while (--j);
} while (--i);
}
void delay(unsigned int t)
{unsigned int i;
for(i=0;iDelay1ms();
}
}
void hc38(unsigned int num)
{switch(num)
{case 4:P2=(P2&0x1f)|0x80;break;
case 5:P2=(P2&0x1f)|0xa0;break;
case 6:P2=(P2&0x1f)|0xc0;break;
case 7:P2=(P2&0x1f)|0xe0;break;
}
}
void working()
{L1=0;
delay(500);
L1=1;
delay(500);
}
void int0init()
{IT0=1;
EX0=1;
EA=1;
}
void main()
{int0init();//中断初始化
hc38(4);
while(1)
{working();
}
}
void int0() interrupt 0
{hc38(4);
L8=0;
delay(1000);
L8=1;
}
定时器#includeunsigned int count;
sbit L1=P0^0;
sbit L8=P0^7;
void hc38()
{P2=0x80;
}
void time0init()
{TMOD=0X01;
TH0=(65536-50000)/256;//50 毫秒
TL0=(65536-50000)%256;
ET0=1;
EA=1;
TR0=1;
}
void time0() interrupt 1
{TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
count++;
count=count%200;//10秒为0
}
void main()
{count=0;
hc38();
time0init();
while(1)
{if(count%20<10)
{L1=0;
}
else
{L1=1;
}
if(count<100)
{L8=0;
}
else
{L8=1;
}
}
}
你是否还在寻找稳定的海外服务器提供商?创新互联www.cdcxhl.cn海外机房具备T级流量清洗系统配攻击溯源,准确流量调度确保服务器高可用性,企业级服务器适合批量采购,新人活动首月15元起,快前往官网查看详情吧