I am trying to create a signal generator that will output sinewaves, squarewaves (with varying duty cycle), triangle waves and sawtooth waves.
The most efficient way of doing this (it seems) is using the DDS algorithm described here -
http://en.wikipedia.org/wiki/Direct_Digital_Synthesis.
In order to create higher frequencies, the algorithm must be as time efficient as possible. And the guys at scienceprog managed to make it 10 cpu cycles long. I can't see how they made it so short, so i would really like to understand that one..
I have made some progress in understanding it. The %0, %1 etc are variables that were passed in from the C-code to the assembly.
The line "add r18, %0" is the same as "add r18, ad0". This is because the first variable in the list at the bottom of the assembly is ad0.
What i still don't understand is the %A3 which is in the 6th line.
Can you offer any help with that?