Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

PSoC™ 4 Forum Discussions

D_Sd_3235936
Level 4
Level 4
25 sign-ins 50 questions asked 25 replies posted

I would like to configure the pin to LOW whenever PWM is not active.

1. How can i do that?

2. How should i configure in PSOC the initial state? Initial Drive state LOW is disabled on PIN.

PWM and the PIN configuration: (issue in green circle)

pastedImage_0.pngpastedImage_1.pngpastedImage_2.png

0 Likes
1 Solution

Dear DimaSidi-san,

Thank you very much for your response.

I re-thought what was the problem with writing compare 0,

then realized that if the 0 is written during the cycle, which usually is,

it won't be applied till next PWM cycle.

Then I read the datasheet of PWM and wondered why we can not use "stop()"

according to the datasheet, stop also makes the signal to inactive state.

So I grabbed an Oscilloscope and gave a try.

Following pictures are

ch1 Yellow signal is PWM

ch2 Blue signal is TCPWM

ch3 magenta signal is enable(1) / disable(0) of PWM using each methods.

(1) using PWM_WriteCompare(0)

   As written above this is not a good choice for this purpose.

(2) using PWM_Stop()

  It works, but the transition from High to Low is rather slow.

So this may not be appropriate if you need immediate shut-off.

(3) using ControlReg with AND (Bob-san's method)

  Clearly the winner, sharp shut-off.

  But with a cost of a ControlReg and an AND gate, which should not be expensive though.

(1) Using PWM_WriteCompare(0) (and TCPWM_WriteCompare(0))

Using_Comp0.JPG

(2) Using PWM_Stop() (and TCPWM_Stop())

Using_Stop.JPG

(3) Using ControlReg and AND

Using_AND.JPG

Best Regards,

5-Feb-2019

Motoo Tanaka

View solution in original post

9 Replies
jepaz
Level 4
Level 4
25 replies posted 10 replies posted 10 questions asked

I know this is not solving what you asked but you can also use the inverted output, you can configure that in the pwm tab. That would do the trick too

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

You may use an AND gate and a control register to force the output low.

Bob

Thanks,

Is there an example for the control register i can use?

0 Likes

Which PSoC kit do you use? CY8CKIT-0??

Bob

0 Likes

Hi,

I am using the CYBLE-224110-00

0 Likes

Your device has got the required resources. See attached project.

Bob

Hi,

I'm just curious, but doesn't set compare to 0 do the same thing without any additional circuit?

    PWM_WriteCompare(0) ;

moto

0 Likes

I remember reading in some post that this is not a good solution.

0 Likes

Dear DimaSidi-san,

Thank you very much for your response.

I re-thought what was the problem with writing compare 0,

then realized that if the 0 is written during the cycle, which usually is,

it won't be applied till next PWM cycle.

Then I read the datasheet of PWM and wondered why we can not use "stop()"

according to the datasheet, stop also makes the signal to inactive state.

So I grabbed an Oscilloscope and gave a try.

Following pictures are

ch1 Yellow signal is PWM

ch2 Blue signal is TCPWM

ch3 magenta signal is enable(1) / disable(0) of PWM using each methods.

(1) using PWM_WriteCompare(0)

   As written above this is not a good choice for this purpose.

(2) using PWM_Stop()

  It works, but the transition from High to Low is rather slow.

So this may not be appropriate if you need immediate shut-off.

(3) using ControlReg with AND (Bob-san's method)

  Clearly the winner, sharp shut-off.

  But with a cost of a ControlReg and an AND gate, which should not be expensive though.

(1) Using PWM_WriteCompare(0) (and TCPWM_WriteCompare(0))

Using_Comp0.JPG

(2) Using PWM_Stop() (and TCPWM_Stop())

Using_Stop.JPG

(3) Using ControlReg and AND

Using_AND.JPG

Best Regards,

5-Feb-2019

Motoo Tanaka