PWM and PSOC 1 on Cypress

Status
Not open for further replies.

bianchi77

Advanced Member level 4
Joined
Jun 11, 2009
Messages
1,313
Helped
21
Reputation
44
Reaction score
20
Trophy points
1,318
Location
California
Activity points
9,442
Hello Guys, anyone has experience on developing code for PWM on PSOC 1 ?
thanks
 

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: 105
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…