View Single Post
Old 09-02-2014, 09:00 PM   #1080 (permalink)
MPaulHolmes
PaulH
 
MPaulHolmes's Avatar
 
Join Date: Feb 2008
Location: Maricopa, AZ (sort of. Actually outside of town)
Posts: 3,832

Michael's Electric Beetle - '71 Volkswagen Superbeetle 500000
Thanks: 1,368
Thanked 1,202 Times in 765 Posts
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.
__________________
kits and boards

Last edited by MPaulHolmes; 09-02-2014 at 09:20 PM..
  Reply With Quote
The Following User Says Thank You to MPaulHolmes For This Useful Post:
e*clipse (09-02-2014)