9 Replies Latest reply on Jun 13, 2013 4:59 AM by junichi.hiraoka

    PWM problem

    nivedhitha.selvakumaran

       hi, m very new to this and i guess this sounds rather basic, but i really need help..

         

      in my project i have just a pwm block that is used to activate the LED. It seems the pwm is executing just one cycle and then there is no change. LED remains off initially, goes on and then remains in the same state. the code:

         

      #include <m8c.h>        // part specific constants and macros

         

      #include "PSoCAPI.h"    // PSoC API definitions for all User Modules

         

      #include  "PWM8.h"

         

      int val;

         

      void GenerateOneThirdDutyCycle(void)

         

      {

         

          /* set period to eight clocks */

         

          PWM8_WritePeriod(23);

         

       

         

          /* set pulse width to generate a 33% duty cycle */

         

          PWM8_WritePulseWidth(7);

         

       

         

          /* ensure interrupt is disabled */

         

          PWM8_DisableInt();

         

       

         

          /* start the PWM8! */

         

          PWM8_Start();

         

      }

         

       

         

      void main(void)

         

      {

         

      void GenerateOneThirdDutyCycle(void);

         

      M8C_EnableGInt ; // Uncomment this line to enable Global Interrupts

         

      // Insert your main routine code here.

         

       

         

      /* function prototype */

         

       

         

      /* Divide by eight function */

         

      for(;;)

         

      {

         

      GenerateOneThirdDutyCycle();

         

      }

         

      }

         

      I tried the same with global interrupts disabled as well.. got the same result.. please help..