Having 2 waves, centered about 2.5v, 90 degrees out of phase would solve the problem completely for me. If you want to focus on that, it would be all I need. They don't even need to be perfect sine and cos waves. Just garbage such that they are the same waves every time, and (sin(theta1),cos(theta1)) == (sin(theta2),cos(theta2)) if and only if theta1 == theta2. Then we could do up a "asin" lookup table which would reduce the angle to 2 possibilities, and then look at cos(), and go with the angle that's closest to the cos() value. badabing badaboom. There's plenty of memory on the dspic, so a big lookup table for lots of resolution wouldn't be a problem. It would be one array access, and then an if..then, and we'd know the angle. That would be fast at 30MIPS.
Last edited by MPaulHolmes; 09022014 at 09:20 PM..
