- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,I want to set an output like below pic,the period of 100%(duty cycle) is 60 us another one(20%) is 120 us
but the result on oscilloscope is not what I want,how can I do?
thanks
Solved! Go to Solution.
- Labels:
-
PSoC 4 Architecture
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
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).
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
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
schematic
pins
main.c
====================
#include "project.h"
void init_hardware(void)
{
CyGlobalIntEnable; /* Enable global interrupts. */
PWM_Init() ;
IDAC_Start() ;
}
void ConfigPWM(uint16_t period, uint16_t compare)
{
PWM_Stop() ;
PWM_WritePeriod(period) ;
PWM_WriteCompare(compare) ;
PWM_WriteCounter(0) ;
PWM_Start() ;
}
void ConfigIDC(uint8_t value)
{
IDAC_SetValue(value) ;
}
int main(void)
{
init_hardware() ;
ConfigPWM(180, 60) ;
for(;;)
{
IDAC_SetValue(100) ;
CyDelayUs(60) ;
IDAC_SetValue(20) ;
CyDelayUs(120) ;
}
}
====================
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.
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
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).
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thank you so much.
Finally, I used PWM to complete this project.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
YuCh,
You can find more possible solutions in this thread
Ideas how to switch output voltage between V1 and V2 on TTL signal?
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.
/odissey1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
180us
180us->0.00018s
f = 1/T =1/0.00018 = 5555,5Hz
check the formula T = 1/f = 1/5555,5 =1,8e-4(0,00018)s
calculate the period value for the frequency 5555,5Hz
12 000 000/5555,5-1 = 2159
Compare value @ 80% = (1-0.8)*(2159+1)=0,2*2160 =432
So I tested with CY8CKIT-049-41XX
Clock 12MHz
36us=20% 144us=80%
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Regards,
Noriaki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks everyone for providing many ways.
but why is the low output of PWM result not 0?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
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.
moto