周期10ms,占空比开始为5ms,晶振频率11.0592MHZ
输出LED常亮,无变化
求教啊
#include<reg52.h>
#include<intrins.h>
typedef unsigned char uchar;
typedef unsigned int uint;
sbit V_OUT=P1^0;
sbit V_OUT1=P1^4;
uint t1=56320,t2=60928;
void
timer0_timer1_init(void)
{
TMOD=0x11;
TH0=0xDC;
TL0=0x00;
TR0=1;
ET0=1;
TH1=0xEE;
TL1=0x00;
TR0=1;
ET0=1;
EA=1;
}
void timer0()interrupt 1 using 0
{
V_OUT=~V_OUT;
TH0=t1/256;
TL0=t1%256;
}
void timer1()interrupt 3 using 1
{
V_OUT=~V_OUT;
TH1=t2/256;
TL1=t2%256;
}
void main(void)
{
timer0_timer1_init();
V_OUT=1;
while(1)
{
if(t1<56320)t1=56320;
if(t2<60928)t2=60928;
t2+=1000;
}
}解决这个问题,并解决闪烁问题,以身相许!!!
一周热门 更多>