Math coprocessor Help
Brian Carpenter
Posts: 728
to figure the heading from one location to another there is a formula.
cos(D) = sin(latB)·sin(latA) + cos(latB)·cos(latA)·cos(lonB - lonA) sin(latB) - sin(latA)·cos(D) cos(C) =
cos(latA)·sin(D)A - origin B - destination D = angular distance along path C = true bearing from the origin to the destination measured from north. If the value for sin(lonb - lona) is positive; otherwise, the true bearing is 360° - C. If latA is 33.980222 in degreesand LonA is 111.447331and latb is 33.031375and lonb is 111.386647·i made the code for the coprocessor but i can not store these variables in the BS2. to big and floating point. any pointers?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It's Only A Stupid Question If You Have Not Googled It First!!
cos(D) = sin(latB)·sin(latA) + cos(latB)·cos(latA)·cos(lonB - lonA) sin(latB) - sin(latA)·cos(D) cos(C) =
cos(latA)·sin(D)A - origin B - destination D = angular distance along path C = true bearing from the origin to the destination measured from north. If the value for sin(lonb - lona) is positive; otherwise, the true bearing is 360° - C. If latA is 33.980222 in degreesand LonA is 111.447331and latb is 33.031375and lonb is 111.386647·i made the code for the coprocessor but i can not store these variables in the BS2. to big and floating point. any pointers?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It's Only A Stupid Question If You Have Not Googled It First!!
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It's Only A Stupid Question If You Have Not Googled It First!!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It's Only A Stupid Question If You Have Not Googled It First!!
LatB··· DATA··· "33.031375", 0
LonB ·· DATA··· "111.386647", 0
... but then you need a subroutine to iterate through the characters to send them to the FPU.· It's probably best just to embed them into setup statements that go directly to the FPU.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It's Only A Stupid Question If You Have Not Googled It First!!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It's Only A Stupid Question If You Have Not Googled It First!!
Luckily, the FPU generates BS2 code for you to plug into your programs.· See the attached images.
1. Define float registers for your values
2. Assign values to them
3. Click "Compile"
4. Copy text from "Output" tab and paste into your program
The other thing to do is download and study the App Notes on the MicroMega web site -- they are very informative.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It's Only A Stupid Question If You Have Not Googled It First!!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It's Only A Stupid Question If You Have Not Googled It First!!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax