51输出方波
#include<reg51.h>
unsinged char pwm_count;
pwm_count=0;
void timer_init();
void timer_init()
{
Tmod=0x20;
Th1=0x38;
Tl1=0x38;
Et1=1;
Ea=1;
}
void main
{
p1^0=1;
timer_init();
while(1)
}
void time1() interrupt
{
a++;
if(pwm_count==5)
p1^0=0
if(pwm_count=1)
{p1^0=1;
pwm_count=0;
}
}
用这个中断是不是只能输出高电平了