#include <reg52.h>
#include <function.h>//详见第六章第8讲
#include <timer.h> //详见第八章第11讲
sbit PWMOUT = P1^7;
void
main()
{
LED_Init();
EA = 1;
TIM0_Init(100,9);
while
(1);
}
void
TIM0_IRQHandler() interrupt 1
{
static
u8 pwm=0;
TH0 = T0RH;
TL0 = T0RL;
pwm++;
if
(pwm>=200)pwm=0;
if
(pwm<10)PWMOUT=1;
else
PWMOUT=0;
}