#include<STC12C5A60S2.h>
void pwm_init()
{
CMOD=0x0a;
CL=0x00;
CH=0x00;
}
void main()
{
pwm_init();
CCAP0H = CCAP0L = (2.5*256)/5; //PWM0 port output 50% duty cycle square wave
CCAPM0 = 0x42; //PCA module-0 work in 8-bit PWM mode
CCAP1H = CCAP1L = 0xff; //PWM1 port output 0% duty cycle square wave
PCA_PWM1 = 0x03;
CCAPM1 = 0x42; //PCA module-1 work in 8-bit PWM mode
CR = 1; //PCA timer start run
while (1);
}