Very Fast Triangular Wave

I’m currently trying to create a triangular waveform that will go as fast as possible with an Arduino Due, and have it act as an input to another device. I currently have it generating a triangular wave from 0 to 5V in 1/255 increments with 1 microsecond per increment. However, I need it to go much faster than this. I understand that Arduino products have a clock cycle time of 62.5ns, and I would like to tap into this if possible, however there is no delay function smaller than microseconds. I am rather new at programming Arduino products, so any help would be greatly appreciated. I understand that this may mean that I need to hack into the Arduino, and the programming language completely changes when you do that. If that is the case then could someone please give me a link with instructions on how to work with this new programming language? My current program with the delay in microseconds is attached. I thank you all ahead of time for your assistance.

Due_waveform.ino (379 Bytes)

I understand that Arduino products have a clock cycle time of 62.5ns,

The Due doesn't. Please, just post your code, in code tags.

Some keywords that may help.

Port Manipulation Timer (hardware timers) such as Timer0,Timer1 etc.

Take a look at the 555 datasheet, page 11. A cap is charged/discharged to make a pretty decent looking triangular waveform. Would that shape be good enough? http://www.ti.com/lit/ds/symlink/ne555.pdf Perhaps you could achieve similar with some filtering of a '328P Arduino output. You achieve 2 MHz with simple code, or up to 16 MHz with a fuse change to output the system clock on an output pin. 16M,8M,4M,2M,1M, 512K, 256k, 128K with clock divider setting.

demonwolf6669: I'm currently trying to create a triangular waveform that will go as fast as possible with an Arduino Due, and have it act as an input to another device. I currently have it generating a triangular wave from 0 to 5V in 1/255 increments with 1 microsecond per increment.

How are you getting 5V from a Due?

If it is a fixed frequency, i.e., one frequency as fast as possible, you can output the quickest square wave you can and then use a switched constant current source and a capacitor.

The 555 is just an RC exponential, not a triangle since it does not use a constant current source. 555 Timer

Or get one of these and control if from the Arduino: AD function generator

It costs about $10

However, I need it to go much faster than this

You haven't specified what upper limit of frequency you are trying to achieve. Until you do, all you're going to get is guesswork.

Pete