I’m pretty new to Arduino, programming and now Xod.
I’m just experimenting at the moment. I’m firstly trying to output a square wave to a port, the easiest method appears to be assigning the output to an led and using that port number, as the output ports do not appear to support this?
Also, I’m not able to output any sort of (half decent) sine wave, any advice would be appreciated.
In xod/core you’ll find nodes for generating various waveforms, including
Hope this helps.
Thanks for your reply.
I had found all the wave generators you have mentioned, but am having difficulty adding further items/nodes to allow me to direct the outputs to actual pins on the Arduino, to allow me to view and change the wave-forms on a scope. I have only had success with the square wave, outputting to an led output.
Also a heads up on some settings say for now a 50Hz sine wave output. Many thanks
You need to use digital-write or analog-write to send output to a pin. “led” is one of many nodes based on one of these. You can double-click on the led node to open it and see how it uses analog-write.
For a square wave, any pin will work. For a sine wave, you will need to use a pin that supports PWM (Pulse Width Modulation). Some boards designate PWM by printing a tilda (~) next to those pins. Which pins (and how many of them) support PWM will vary by Arduino model.
Thank you so much for your help, very much appreciated.
The software sine generation is too slow for me. I use an Analog Devices A9833 module to do this. I’m doing some of this on an ESP32 using a SPI bus to talk to the module. It works fairly well up to about 5 MHz. The chip also can generate square and triangle waves.
You can make high-frequency sines under digital control using cheaper chips if you only need a limited range of output frequencies. See e.g. figures 4, 5 and 6:
You’ll need a variable frequency square-wave clock at a multiple of the desired output frequency, 8x for a 4-flop ring counter, for example. 74VHC logic should be good for output modified sines up to maybe 20 MHz running at 160MHz input clock.
An analog filter, active or passive depending, can remove the “steps”
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.