Pages: [1]   Go Down
Author Topic: Generating a 1Mhz Pulse  (Read 511 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 1
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6255
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:

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



I would be interested to read how you get on.
« Last Edit: August 10, 2009, 03:18:33 pm by mem » Logged

Pages: [1]   Go Up
Jump to: