I have another excel example that I will post (when I get to my other computer).This one can't look at it either. But basically, it works like this:
Enter X and Y co-ordinates like x = 12631 and y = 11881, then perform atan.
<img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=2136&d=1195349246">
The accuracy shows that when either x or y is really low, that errors in the way it simplifies the equation are a bit large. But with higher numbers, the accuracy is within one degree or so.
Result pops out as Z. Z is the angle to the co-ordinates. (if I remember right the answer was 134?), but it is in the same weird format. Z * 90 / 256 gets you back to a readable degree format, which if I remember right give you about 47 degrees. You will have to know what quadrant you are in to figure out if you add 90 degrees to result by figuring out if x or y or both are positive or negative.
I made the 20 mhz PIC do 10,000 of these calculations, and it took less than 5 seconds. Over 2000 per second! Pretty cool!
I wish I got this excited about trig 22 years ago, when I was taking the class ......
Bookmarks