标题:
闪烁灯程序
[打印本页]
作者:
51单片机资料
时间:
2018-4-22 13:55
标题:
闪烁灯程序
#include<reg51.h>
unsigned char cnt=0;
sbit led=P1^0;
void t0isr() interrupt 1
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
cnt++;
if(cnt>=10)led=~led;
}
main()
{
TMOD=0x01;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
TR0=1;
ET0=1;
EA=1;
while(1);
}
欢迎光临 (http://www.51hei.com/bbs/)
Powered by Discuz! X3.1