- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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)
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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))
(2) Using PWM_Stop() (and TCPWM_Stop())
(3) Using ControlReg and AND
Best Regards,
5-Feb-2019
Motoo Tanaka
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You may use an AND gate and a control register to force the output low.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks,
Is there an example for the control register i can use?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Which PSoC kit do you use? CY8CKIT-0??
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am using the CYBLE-224110-00
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm just curious, but doesn't set compare to 0 do the same thing without any additional circuit?
PWM_WriteCompare(0) ;
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I remember reading in some post that this is not a good solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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))
(2) Using PWM_Stop() (and TCPWM_Stop())
(3) Using ControlReg and AND
Best Regards,
5-Feb-2019
Motoo Tanaka