#include“reg52.h” //头文件,包含各种寄存器定义及函数库
time0() interrupt 1 using 0
{
TH0=0x3C;TLO=0xB0;
P1_0=~P1_0;
}
main()
{
TMOD=0x01; TH0=0x3C;TLO=0xB0;
//12MHz下,50ms定时所对应的初值
EA=1;ET0=1;TRO=1;
while(1)
{
}
}

#include“reg52.h” //头文件,包含各种寄存器定义及函数库
time0() interrupt 1 using 0
{
TH0=0x3C;TLO=0xB0;
P1_0=~P1_0;
}
main()
{
TMOD=0x01; TH0=0x3C;TLO=0xB0;
//12MHz下,50ms定时所对应的初值
EA=1;ET0=1;TRO=1;
while(1)
{
}
}
本文标题:C语言编程(定时器50ms)
本文链接:https://www.haomeiwen.com/subject/nkcdnqtx.html
网友评论