T89C51AC2 PCA in PWM mode?

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Hi,

I've searched and read all I could find on the T89c51AC2 PCA in 8bit PWM
mode, yet still can't make it go. This is the Intel PCA cookbook method of
setting up the counter array for PWM operation, but it doesn't work for me.

/***************************************************************************
**
 *
 *                              pwm_init()
 *

****************************************************************************
*/
void pwm_init(void)
{
    // Set PCA counter to mode 1. Increment at XTAL / 12 in X1 mode
    // i.e. 256kHz with 18.432MHz Xtal in X1 mode
    CMOD = 0x00;

    // Reset PCA low and high counter registers.
    CL = 0x00;
    CH = 0x00;

    // Set PCA counter 1 to auto reloading 8-bit PWM mode.
    // i.e. ECOM1 = 1, PWM1 = 1.
    CCAPM1 = 0x42;

    // Set PCA counter 2 to auto reloading 8-bit PWM mode.
    // i.e. ECOM2 = 1, PWM2 = 1.
    CCAPM2 = 0x42;

    // Reset PCA counter compare register.
    CCAP1L = 0x00;
    CCAP2L = 0x00;

    // Start with 50% duty cycle in reload registers.
    CCAP1H = 127;
    CCAP2H = 127;

    // Set PCA counter running
    CR = 1;

    return;
}

Any helpful suggestions, or perhaps links would be greatly appreciated.

Regards,
Murray R. Van Luyn.



Site Timeline