Keil Logo


Information in this article applies to:

  • µVision Version 2.20


I am working on a PWM project using the Philips 87LPC768. In the µVision Debugger, the reported PWM frequency does not appear to be correct.


The following program:

void main( void )
        CNSW0 = 0xFF;                                   //PWM Clock Count set to Maximum.
        CNSW1 = 0X03;

        CPSW0 = 0xCC;                                   //Setting duty cycle of channel 0 to 80%
        CPSW1 = 0x98;                                   //Setting duty cycle of channel 1 to 60%
        CPSW2 = 0x64;                                   //Setting duty cycle of channel 2 to 40%
        CPSW3 = 0x30;                                   //Setting duty cycle of channel 3 to 20%

        CPSW4 = 0xE4;                                   //Setting 8-9 bits of output registers

        PWMCON0 |= 0x40;                                //Setting all channels to non-iverted.

        PWMCON1 &= 0x00;                                //Braking disabled  Shadow Memory transfered.

        PWMCON0 |= 0x80;                                //RUN PWM.



configures the PWM to divide the CPU Clock by 1024. If the oscillator frequency is 20MHz, the CPU Clock is 3.333333MHz. Dividing by 1024 gives is PWM Frequency of approximately 3.255KHz.

This is an error. The actual value should be 19.531kHz.

This problem will be corrected in a subsequent release.

Last Reviewed: Monday, June 28, 2004

Did this article provide the answer you needed?
Not Sure
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.