- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I set up a PWM with clock to drive a LED in hardware. I started the PWM and it runs fine.
I assumed I could use PWM_Start() and Stop to control control the PWM in software but the LEDs continue to blink after I issue the Stop API command.
To get it running, I put a constant "1" logic on Enable of the PWM. My guess is there is another logical function I could drop onto the enable and set it high or low in software. Is this correct and what component do I use.
Or, is there a better way to enable and disable the PWM in software.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You may control a PWM using a control register. Depending on your underlying hardware (PSoC 4 or 5) there are some signals you can control. A PWM_Stop() disables the component, so the LED cannot blink. If it does as you reported, there must be something wrong.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Several ways -
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A couple of corrections in comments -
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Guys,
My code is below and schematic attached.When I run, the Leds start flashing at 500ms rate, I expect them to flash for 5 seconds and stop flashing for 2 seconds.
int main()
{
CyGlobalIntEnable;
PWM_Start();
for(;;)
{
CyDelay(5000); //Leds flash for 5 seconds
PWM_Stop();
CyDelay(2000); //Leds off for 2 seconds
PWM_Start();
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Bye the way, how did you get images into the post. Did you copy and paste or use the image box from menu or something?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you select stuff on schematic, copy to clipboard, and paste using Firefox works
most of the time.
Note on PWM you can also use kill input to force PWM out to a known state.
I have filed a CASE because datasheets do not discuss what state output is
in when a Stop() is issued, or a disable for that materr.
Lastly here is another approach, using PrISM for led driving -
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Will the Prism module output a constant on/off signal at say 500ms? It appears to be referred to a psuedo random number thta would result in "random" pulse output?
I suppose the other way is to set the value of te PWM to 0. Could I just use the clock directly onto the LED?
It is just to blink an LED in hardware. And enable/disable it as needed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The PrISM is a density output, so not a fixed puslewidth.
In PSOC 3/5LP you can route a clock to an output pin.
For PSOC 4 take a look at this http://www.cypress.com/?rID=80799
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The particulars back from Cypress -
In the Fixed function implementation the pwm ouput retainins the previous state if a Stop() is issued.
In UDB implementation the output pwm1 or pwm2 will reset to logic 0.
A doc update will be done inclduing this info.
Regards, Dana.