in these waveforms, I want to control the duty cycle or width of these pulses from a potentiometer by analog pin for both waveforms and also I need to have it on high frequencies such as 100-200khz. it would be of great help for me. Thankyou in advance.
I already tried a lot to make this waveform, but I have little to no knowledge of using timers for this Arduino check out the code below: - and the waveform that is generated.
but the problem is, that this waveform is set for a 50% duty cycle which means if I try to increase or decrease its width it will go out of phase from each other which is undesirable.
You have to be very careful with values of your components and their placement to get a DC-DC converter to work.
Hence SMPS ICs. and their suggested component layouts.
also as you can see that time is in "ms" which means the frequency is very low, meanwhile i need it in microseconds and this is the output waveforms when I try the delayMicroseconds function.
now my problems in this waveforms are: -
1st as you can see the yellow and blue waveforms are apart from each other and not turn on and off simultaneously which means when yellow is falling at same time blue must be rising .
2nd when i used this delaymicroseconds function the delay increased beyond the need value which inturn reduced the overall timing of the cycle.
3rd the gap between yellow and blue waveforms keeps on increasing without their starting condition in consideration.
kindly ask me any doubt related to this, i'm free and in need to make this work so the more we are is the more better. Thanks
Hello sir, I already used UNO upto 400khz without problem for simple pulses, I respect your opinion on the note that uno is not good at variable pulses for high frequency
you want 100-200khz frequencies ➜ 200KHz means 5µs for a period in which you need to change state...
If you want on top of that to keep multiple pins in sync, that's not something you'll reach by using blocking codes with delays (the delayMicroseconds function is not suitable for less than 3µs)
given the Uno runs at 16MHz, You will have to explore timers and register level stuff
yes you are right, that's why I am not able to generate the required waveforms with my needs, can you just direct me to where can I learn the timers and registers level stuff, I even tried to learn that from Arduino timers pdf but everything went off my head and then i was looking for alternate solutions, I think Interrupts will work than delays, I haven't tried that yet!!!
You have register access to flip a pin executed in 1 clock cycle (touching the PINx registers) and the clock period is 1 / 16M = 62.5 ns
500ns is 8 x 62.5. So I would not say it's not possible to go fast, but it is quite challenging to be precise and not every precise duty cycle will be achievable