请参考下列code. 在改变PWM_VALx的值后,一定要设置LDOK位
void main(void)
{
/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
PE_low_level_init();
/*** End of Processor Expert internal initialization. ***/
setRegBit(PWM_PMOUT,PAD_EN); //Enable PWM output PAD
setReg16(PWM_PWMVAL0 , 320);//%duty cycle
setReg16(PWM_PWMVAL2 , 320);//% duty cycle
setRegBit(PWM_PMCTL , LDOK);// Load duty.
/* Write your code here */
for(;;) {}
}
|