Stefan Mardale

PWM prescale

Discussion created by Stefan Mardale on Mar 14, 2008
Latest reply on Mar 15, 2008 by Stefan Mardale
    hello, I'm using an MCS12C32 and I want to generate a 60Hz PWM signal. On paper every thing is ok, but not in the real world. I'm using a LED to test, and it blinks every 4-5 sec. Can anyobody help me? The qurtz works at 16Mhz, this means a 8Mhz bus clock(right?).

SA=BUS clk/2*PSCLA     
BUS clk=8Mhz/128=62.5Khz

here is the init():

void init_pwm(void)

 PWMPOL_PPOL0=1; //start pol
 PWMCLK_PCLK0=1;//ch1- SA
 PWMPRCLK_PCKA0=1;//prescale bus clk  with 128     8Mhz/128=62.5Khz
 PWMSCLA=0xFFFF;  //prescale SA with 512