Go Down

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

Steve Pate

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.

mem

#1
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
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy