The problem is solved. I found another version of trig.inc in post 13, and it works well for me. I have to put the word variables x,y into long variables before doing any calculations on them.
The problem is solved. I found another version of trig.inc in post 13, and it works well for me. I have to put the word variables x,y into long variables before doing any calculations on them.
That's a good bare bones cordic version as long as you don't mind manipulating the radians. So you could either use that and do math to your liking, or you could use TrigL , which you can find with my tilt example here: http://www.picbasic.co.uk/forum/cont...-axis-g-sensor . If you use TrigL.inc, you would probably want to add a line to replace goto main with goto overcordic
and at the end of the TrigL.inc add a line overcordic:
Keep us posted, I'd love to see your project.
Walter
Hi Walter, I have been looking at this for some time now and keep coming back to this post. I am actually attempting to do a similar project to the tilt sensor project which you have built only on a single axis. I believe I am almost there now and just need a few pointers! I am looking at your code atn2. the following is the equation i require to solve: tan-1 ((zresult - calval)/SQR ((5017 - calval)^2 - (zresult - calval)^2))
Now from reading your posts would I be right in thinking that if i do the following:
Am I right in thinking that this would convert my equation as I am not interested in the hyp or does the x vaule come into play?Code:x=0 y= ((zresult - calval)/SQR ((5017 - calval)^2 - (zresult - calval)^2)) call atn2
Bookmarks