Andreas Oeri

HC908QY4A PWM initialization with low-level on output

Discussion created by Andreas Oeri on Mar 13, 2007
Latest reply on Mar 15, 2007 by Andreas Oeri

I initialized my HC908QY4A with a PWM to let an LED go on and off. That's working fine from 0 to 100%. After a reset the system starts with a dutycycle of 0%. My problem is that during the initialization of the PWM the LED flashes for a short moment. I realized that the PWM-output is set to a high level after the initialization. I think I reach the 0%-duty-cycle after starting the timer and reaching the first Toggle-On-Overflow.

So my question is: Is it possible to initialize a PWM whithout getting this short high level out of the port during the initialization?

Thanks a lot,


My code is:

TCH1H = 0;
TCH1L = 0;/* Store values to the duty-compare register */

setReg8(TSC, 0x10); /* Stop and reset counter */

//Set PWM-Mode with 0% DutyCycle
clrReg8Bits(TSC1, 0x03); /* Set conditions of 0 percent duty-cycle */

setReg8(TSC1, 0x58); /* Set up PWM mode => SETS OUTPUT TO HIGH LEVEL*/

clrReg8Bits(TSC, 0x80); /* Reset request flag and */
setReg8Bits(TSC, 0x40); /* enable interrupt */
setReg8(TMODH, 0x3F); /* and to the period-modulo register */
setReg8(TMODL, 0xFF);
TSC_PS = 0x00;//Val; /* Store given value to the prescaler */

clrReg8Bits(TSC, 0x20); /* Timer Start */

Message Edited by Soror on 2007-03-1303:12 PM