- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Create a Square Wave (0 – 5 V) where frequency lies in the range of 150 Hz to 15 kHz with
varying duty (1 % resolution). (USE PWM BLOCK)
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Andrew7 ,
If you want to vary the frequency then it can be altered from firmware.
At first, take a clock and configure source to IMO (3 MHz) and a PWM with period value as 1 to vary the frequency. (Kindly refer the attachments given below)
For varying frequency from 150 Hz to 15 KHz.
- While configuring the clock, if divider is 10000 so you will get 150 Hz:
Input clock/divider = 3 x 106 / 10000 = 300 Hz
Now the period of PWM is 1 so, 300/2 = 150 Hz
- Similarly, if divider is 100 then you will get 15 KHz:
Input clock/divider = 3 x 106 / 100 = 30000
Now the period of PWM is 1 so, 30000/2 = 15000 Hz = 15KHz
Now you got the divider values, so you need to vary divider from 10000 to 100 to vary frequency from 150 Hz to 15 KHz. (Take a loop and use Clock_SetDividerValue() API in firmware to assign the divider). As per your functionality adjust both clock divider and period of a PWM.
Best Regards,
Rakesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Andrew7 ,
If you want to create a square wave between 150 Hz and 15 kHz, kindly Change the input clock's frequency and alter the period value to generate a square wave in the desired frequency range. Can you please be more specific about the frequency, whether it should be dynamic or static within the range, and the duty cycle you want to vary.
Best Regards,
Rakesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Frequency should be variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Andrew7 ,
If you want to vary the frequency then it can be altered from firmware.
At first, take a clock and configure source to IMO (3 MHz) and a PWM with period value as 1 to vary the frequency. (Kindly refer the attachments given below)
For varying frequency from 150 Hz to 15 KHz.
- While configuring the clock, if divider is 10000 so you will get 150 Hz:
Input clock/divider = 3 x 106 / 10000 = 300 Hz
Now the period of PWM is 1 so, 300/2 = 150 Hz
- Similarly, if divider is 100 then you will get 15 KHz:
Input clock/divider = 3 x 106 / 100 = 30000
Now the period of PWM is 1 so, 30000/2 = 15000 Hz = 15KHz
Now you got the divider values, so you need to vary divider from 10000 to 100 to vary frequency from 150 Hz to 15 KHz. (Take a loop and use Clock_SetDividerValue() API in firmware to assign the divider). As per your functionality adjust both clock divider and period of a PWM.
Best Regards,
Rakesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can It be used as Square wave Voltammatry??? Let me know.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can It be used as Square wave Voltammatry??? Let me know.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
shuvra1,
It is my understanding that voltammetry requires varying voltage levels. The PWM output directly only supplies 0V (Vss) and VDDIO (usually 5V).
"Engineering is an Art. The Art of Compromise."