Forum Discussion
Altera_Forum
Honored Contributor
17 years agoActually the Cordic Atan function isn't that complicated. It's just add/subtract and a few precalculated constants. After just 8 iterations, you're within 1° but even more important, you don't need to divide Q/I or normalize the amplitude. Feed the raw I and Q samples into the algorithm and get phase out the other side.
Then just do the dO/dt to convert to FM. Given I and Q, to calculate phase in degrees, first we need to account for the quadrant the signal is in. I[0] = (I<0) ? ( (Q<0) ? -Q : Q) : I; Q[0] = (I<0) ? ( (Q<0) ? I : -I) : Q; Phase[0] = (I<0) ? ( (Q<0) ? -90 : 90) : 0 Now iterate the following three lines till you're happy with the resolution for (n=1; n<sufficient_iterations; n++) { I[n] = I[n-1] + Sign(Q[n-1]) * Q[n-1]/(2^(n-2) ); // Sign(n) = ±1, Div by 2^n is a shift right. Q[n] = Q[n-1] - Sign(Q[n-1]) * I[n-1]/(2^(n-2) ); Phase[n] = Phase[n-1] + Sign(Q[n-1]) * Atan(1/(2^(n-2)))*180/pi; // The Atan is usually a constant in a look up table. } Note, I translated this from a mathCad routine I have, so the C code might be off a bit. This will get you back to my original post which, by the way, is the basis for the radio I designed in 1990 that Nasa has been using since then to retrieve the instrumentation data from the space shuttles.