5 Replies Latest reply on May 2, 2012 3:30 AM by JoMe_264151

    Setting up PWM on a CY8C9560A


       Hi, I'm helping to develop a device driver for a module that uses the CY8C9560A.  I'm having a problem getting PWM to send a signal.  The data sheet isn't very clear to me regarding the exact steps or sequence that needs to be taken to activate PWM for a pin.  The code I'm using is below but all I am getting is a solid 1.63V output from PWM8.  Can you help point out what I might be missing?  


      From some of the other posts, I gathered that it might be necessary to reset the device before the PWM settings take effect.  Is this the case?  Is there a way to soft reset this device?  If this is necessary then is there a way to reset just the one pin so that others are not interrupted?  Thanks!



      io60p16.SetPwm(7, 0, 0x5e, 0x2f);  // Port 7, pin 0 = PWM8




              public void SetPwm(byte port, byte pin, byte period, byte pulseWidth)        {            WriteRegister(0x18, port);          // Select port              var b = ReadRegister(0x1a);                      b &= (byte)(~(1 << pin));                        WriteRegister(0x1a, b);             // select PWM for port output              b = ReadRegister(0x1C);                          b &= (byte)(~(1 << pin));                        WriteRegister(0x1C, b);             // Set pin for output.              WriteRegister(0x28, (byte)(0x08 + pin));          // Select the PWM pin to configure.            WriteRegister(0x29, 0x00);          // Config PWM (select 32kHz clock source)            WriteRegister(0x2a, period);        // set the period (0-256)            WriteRegister(0x2b, pulseWidth);    // set the pulse width (0-(period-1))        }