1 of 1 people found this helpful
Usually PWM component generate 0 and 1 output.
If you want to have 100% and 20% output,
you can either use IDAC or DC bias PWM output.
So I tested with CY8CKIT-044
CyGlobalIntEnable; /* Enable global interrupts. */
void ConfigPWM(uint16_t period, uint16_t compare)
void ConfigIDC(uint8_t value)
ConfigPWM(180, 60) ;
The result oscilloscope view was
The red signal is output of IDAC via 2k (kind of 100% and 20%)
The yellow signal is output of PWM (100% and 0%)
Since IDAC is controlled by FW, they are not synced.
This is my solution for your request using CY8CKIT-044
This project consists of two PWMs. The PWM_FAST generates 20%/100% duty waveform. The PWM_FAST is controlled by PWM_SLOW. When the control signal is HIGH, PWM_FAST generates 100% duty sticking at HIGH. The configuration of PWM_FAST is as follows.
Please set the input mode of three input signals proper. The carrier frequency of PWM_FAST is set to 1.2MHz (24MHz/20)
PWM_SLOW generates 60us/120us waveform with following configuration.
Because I have no oscilloscope in home, I confirm the behavior with a handy DMM by decrease the control signal.
Please confirm the waveform with your oscilloscope.
DutyDuty.cyprj.Archive01.zip 491.5 K
yup,I got it wrong,PWM just adjusts pulse width
restate my questions,I want to control the time of high and low,then I adjust period and use the command(WriteCompare) to solve the problem.
At the beginning I had plans to use IDAC,but I need a high voltage is around 3V,but the maximum current of IDAC is 612uA,it can't output the voltage I want.
May I assume that your problem is solved now?
> At the beginning I had plans to use IDAC,
> but I need a high voltage is around 3V,but the maximum current of IDAC is 612uA,it can't output the voltage I want.
"Conceptually", if you replace 2K of my schematic to around 5K or higher, you can get 3V,
but driving capability is very low (as you know, 612uA).
If you double click the Digital Output pin in your schematic,
You will see the configuration window something like below.
In the left-bottom corner, there is "Datasheet" button.
We can access the datasheet of the component from there.
In the datasheet, VOL is stated as 0.4 ~ 0.8 MAX.
So we may(?) see some floating value from the ground.
I know that this is not ideal, but it is the way it is.
You can find more possible solutions in this thread
Using Opamp and PWM, it is possible to hardware switch between V1 and V2. This is simplest method if adjustment of V1 and V2 is not required at the run-time.
thank you so much.
Finally, I used PWM to complete this project.