- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you trying to change the PWM parameters via APIs at run-time?
-Bobby
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Danielek,
This can be implemented using a 16bit PWM component.
I'll upload a project shortly.
Regards,
dasg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've just done this using a counter (16-bit) producing 200Hz to 900KHz on a 24MHz clock. I know exactly what you mean about the non-linearity (f=1/T)!
The code I wrote for the loading of the conter is:
count=(abs((1/counter)*(scale)));
compare=((count)/2);
Counter_1_WritePeriod(count);
Counter_1_WriteCompare(compare);
where "count" (uint16) is the number to load into the Counter
"counter" (uint16) is the value of your pot or encoder for inputting the frequency
"scale" is simply the range of frequency required.
I am using this to generate quadrature encoder output frequecy using a flag for direction change (hence the use of "abs" - as I'm generating the +/- elsewhere.
Hope it helps!
Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Generating square wave of increasing frequency from 0Hz to 50KHz in steps of 1Hz might not be possible in a straight forward manner.
For example, increasing the frequency in steps of 1Hz, that is, 0Hz, 1Hz, 2Hz - - - 49,998Hz, 49,999Hz and then 50,000Hz using only a single PWM looks quite tricky.
Can anyone come up with algorithm/ strategy to attain this?
Regards,
dasg
- 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 Danielek,
How to do frequency sweeping on step 1 hz .sweeping from 1mhz on evert step 1 hz using AD9833.i am new to this.please help.