Go Down

Topic: Generating a 1Mhz Pulse (Read 880 times) previous topic - next topic


Hey guys, I'm new to arduino and I need help.
My project requires me to generate a 1Mhz pulse from the Atmega328 Arduino. How do I go about doing that? Any ideas?
Thanks in advance.


Aug 10, 2009, 10:18 pm Last Edit: Aug 10, 2009, 10:18 pm by mem Reason: 1
There is a library called FrequencyTimer2 that can toggle a pin aa user defined periods  as short as 1 microsecond. I have not tried running it that fast but its worth a go. See: http://www.arduino.cc/playground/Code/FrequencyTimer2

Install the library and add this code to your setup:

[font=Courier New]  pinMode(11,OUTPUT);  // frequencyTimer2 is hard coded to output on this pin
 FrequencyTimer2::setPeriod(1); // 1us
 FrequencyTimer2::enable();  // start toggling[/font]

I would be interested to read how you get on.

Go Up