PWM and PSOC 1 on Cypress

Status
Not open for further replies.
Simply drop a PWM8 or PWM16 user module into an unused digital block and connect the clock and output. The "code" (API) is described in the datasheet. You need to start it using PWM8_Start() and set the pulse width with PWM8_WritePulseWidth(BYTE bPulseWidth).

Sample code is given in the datasheet

Code:
/* include the Counter8 API header file  */

#include  "PWM8.h"



/* function prototype */

void GenerateOneThirdDutyCycle(void);



/* Divide by eight function */

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();

}

Keith
 

Attachments

  • PWM8.pdf
    284.8 KB · Views: 127
Last edited:
How can I develope this spec?
Operating Speed (4.8V no load) : 0.131sec / 60 degrees
 

bianchi77 are you trying to interface Servo motor with PSoC1 using PWM in it?
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…