AT89C51单片机,定时器1,50ms中断,用c语言写出初始化程序和中断函数程序

2025-01-02 14:25:09
推荐回答(1个)
回答1:

#include
void InitTimer1(void)
{
TMOD = 0x10;
TH1 = 0x3C;
TL1 = 0x0B0;
EA = 1;
ET1 = 1;
TR1 = 1;
}
void main(void)
{
InitTimer1();
}
void Timer1Interrupt(void) interrupt 3
{
TH1 = 0x3C;
TL1 = 0x0B0;
//add your code here!
}