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.
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.
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.
CyDelay(5000); //Leds flash for 5 seconds
CyDelay(2000); //Leds off for 2 seconds
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 -
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.
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.