system
September 9, 2009, 8:55pm
1
Looking to use an Arduino as a function generator. Lets start simple: a square wave. 1hz is easy. How fast can I get the Arduino to puls? I am using the 16MHz chip.
Right from the example code.
int ledPin = 13;
void setup()
{
pinMode(ledPin, OUTPUT);
}
void loop()
{
digitalWrite(ledPin, HIGH);
digitalWrite(ledPin, LOW);;
}
How fast is pin 13 pulsing? 16MHz?
mem
September 9, 2009, 9:25pm
2
Not much faster than 200khz.
See this thread for info on how to speed things up: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1226290298
system
September 9, 2009, 9:52pm
3
Good to know.
Any way to get up to the 16~20MHz range? perhaps an external device controlled by the Arduino.
system
September 9, 2009, 9:59pm
4
isn't there a function generator shield around for the arduino? google it
system
September 9, 2009, 10:11pm
5
dont see it in my googlings.... Any one have a link?
system
September 9, 2009, 10:18pm
6
my memory failed me again... here's a link:
its not a shield, just a kit
florinc
September 9, 2009, 10:25pm
7
system
September 9, 2009, 10:25pm
8
"Can be modified to 0.01Hz to 1MHz."
"Any way to get up to the 16~20MHz range?"
system
September 9, 2009, 10:48pm
9
The AD9833 looks like a great option
"Any way to get up to the 16~20MHz range?"
So with a system with a 16MHz clock you want an output going at 20MHz. As my son would say "have a word with yourself".
The best you can hope to do is to programme one of the timers to toggle an output line, you might get 2MHz like that.
Other than that you need something external with a faster clock. It all depends what you want to do with the signal once you have it.
westfw
September 11, 2009, 3:23pm
12
There was some extensive discussion here: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1230286016
You can get a nice 2MHz square wave, and 4MHz if you're willing to give up "square."
See also http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1244864818/ which is more about removing other overhead from timed loops.