Рет қаралды 27,216
digitalWrite command of Arduino is very slow and with that you can only achieve 150 kHz signals (full period, ON and OFF) at best.
In this video I show you that using port manipulation and while loop you can get up to 4 MHz signals (ON period less than OFF period) and 2.66 MHz with 50% duty cycle.
Also you will learn how to produce multiple signals at exactly the same time. this is something which is useful if you want to make a pulse with a multilevel converter, I mean at sometimes you want to drive the switches independently to make sine wave or other waveform, but if you want make a lightning impulse with the multilevel converter, it is necessary to turn on all switches at the same time.
At the end I summarized the results and based on this experimental work I concluded the number of clock cycles that it takes to run each command. If you see some mistake somewhere, let me know.
The probe and scope should have sufficient bandwidth to capture the signals properly. I used the probe at 10X to increase the bandwidth. Even so steel the signal is filtered a bit.
The following pages/videos are good references to look at:
www.arduino.cc...
roboticsbacken...
• Port Register Control ...