I have a special interest to use the timer(s) to generate in-phase and quadrature square waves at up to 1MHz each. This is for an application in Software Defined Radio to use the Arduino to both drive a DDS for tuning the radio and to generate the quadrature signals to drive the Tayloe detector.
Can anyone help with programming the timers to output two squarewave signals on two pins with 90deg phase shift.
I'm bumping this thread because I'm interested in the answer, too. I imagine there must be some trick that a skilled programmer can do without much trouble, but I don't know what it is.
I suspect there is no answer because you can't do it, well not at 1MHz at least.
The simple technique is to set a timer driven interrupt at four times the maximum frequency and simply output levels to the two pins to give a quadrature signal.
But at 1MHz that means the interrupts have to be going off at 4MHz which is too fast to service an ISR on a 16MHz processor.
AntonyWatts:
I have a special interest to use the timer(s) to generate in-phase and quadrature square waves at up to 1MHz each. This is for an application in Software Defined Radio to use the Arduino to both drive a DDS for tuning the radio and to generate the quadrature signals to drive the Tayloe detector.
Can anyone help with programming the timers to output two squarewave signals on two pins with 90deg phase shift.
Hmm, you are using DDS and STILL need to create phase shifted signals? Check Ad9851 spec - it does exactly what you asking for @ 1MHz.
What am I missing ?
For only 1MHz, might be better to just use a cheaper DDS like the AD9851 and run it at 4 times the frequency through the appropriate chips to generate quadrature outputs.
I have made some progress with generating quadrature signals. I abandoned getting them from the Arduino, as you say it is simply not fast enough. Next I tried an AD9850 module driving a 74hc74 chip. Many people have done this, but using 2 x 74hc74s, the first to generate an equal mark/space ration square wave, the second to generate the quad signals, as I found the AD9850 does not generate equal mark/space square waves...
Most people use 2 chips also because the most commonly available frequency generator is the Si570 - you find it in many, many amateur radio designs. The Si570 has only one phase square wave output, thus the need of the first 74hc74 to generate anti-phase square waves for the second 74hc74.
The problem is that using 2 x 74hc74s means the oscillator frequency has to be x4 the output frequency of the quad signals, which is pretty high on 28MHz band.
The proposal I have is to use a different chip, the Si514, this has bi-phases complementary outputs and cover 100KHz to 250MHz. Now only one 74hc74 is needed to generate the quad signals, feeding each flop-flop from either complementary output of the Si514. I have put a suggested circuit on www.ganymedeT.blogspot.com if you want to see how my thinking is developing. I am waiting for samples of the Si514 to try it out. Of course I still have to develop code to drive it over i2c bus...
Thanks for keeping us up-to-date. I was looking at another Si chip, but there is that problem of 1/4 the frequency. Good call on the Si514, it means your received frequency is 1/2 the clock. And it isn't that expensive.