- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Anyone have a good example (source and HW set-up) of using a PWM in a 1 shot configuration and changing the pulse width value. creater 3 environment.
- Labels:
-
PSoC 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Creator 3?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Actually quite simple, place on schematic, double click,
and config, trigger can be single trigger or multiple trigger.
The just start up with API and give it the trigger. Reset after
event, or other possibilities via interrupt.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Probably you are using Creator 2.2 and a PSoC3.
Set the trigger in the "Advanced" configuration tab to "multi-trigger" . While the PWM is waiting for a trigger pulse you may set the pulse-width with the API WriteCompare() to any value within the given limit.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK
The multiple trigger is not quite giving me what I want, but I have more basic question.
How does the 3 of these interact?
PWM_1_WriteCounter(19);
PWM_1_WritePeriod(counterValue);
PWM_1_WriteCompare(2);
With the multitrigger setup you suggested, I'm finally able to vary the distance between pulses by setting the period value, but get many of them. I suspect there are knob setting to just get one, but I'm still tinkering to find the right combination.
What I'm after is simply to vary the width of the pulse, one time.
- 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
- WritePeriod() sets the length of the complete PWM period (the maximum counter value - with normal PWM, it therefore sets the PWM frequency)
- WriteCompare() sets the counter value when the PWM output changes from high to low (so it sets the duty cycle)
- WriteCounter() sets the current counter value, so it influences when the next compare event happens (by going either forward or backward in the PWM timespace)
When using the multi-trigger mode, the next trigger event will only be start a new cycle after a complete PWM period has been completed (in the component data sheet, look at page 32ff).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is what I ended up with (just the schematic loaded).
comments...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No image to see here...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you are trying to post an image, post as .BMP, and make it the last
thing you paste in the thread. I have found Firefox most of the time will
do this, whereas IE rarely.
Regards, Dana.