Hm55b
HI all.
I'm experimenting with the HM55B Compass Module,
on the HM55ModDocs.pdf in the SX section it is indicated the possibility to obtain the real angle from North in Degree.
The suggested operation is: arctan(-y/x)
But there is no such command or operator in the SX/B.
I have done a search in the Forum but with no results.........
How can I obtain the arctan calculation with SX?
Anyone has a suggestion on how to accomplish this?
Thanks in Advance
Stefano
P.S. Excuse my fat ignorance about math's
I'm experimenting with the HM55B Compass Module,
on the HM55ModDocs.pdf in the SX section it is indicated the possibility to obtain the real angle from North in Degree.
The suggested operation is: arctan(-y/x)
But there is no such command or operator in the SX/B.
I have done a search in the Forum but with no results.........
How can I obtain the arctan calculation with SX?
Anyone has a suggestion on how to accomplish this?
Thanks in Advance
Stefano
P.S. Excuse my fat ignorance about math's
Comments
· I'm doing some research for a upcoming project. I think we have some work cutout for us. First, I'm worst than anybody when it come to math, but here it goes.
There is a SIN and COS example in the SX/B online help. Look in the PWM example. It's got a small table driven lookup. I believe that this is the start we need. That was the easy part.
Now, go to Tracy Allen's web page. If you don't know it, bookmark it well. On this page:
http://www.emesystems.com/BS2math3.htm
He talks about using the BS2 which only has SIN and COS, the two tools we now have. We may have to "glean" through it because the BS2 uses Brads (binary radians), but I think the answer lies within.
HTH, Chris
added:
Well, a little post note. I'm reading the SIN and COS routines in the SX/B and it does use Brads, but I'm trying to figure out if it will work. I have a lot to learn.
Post Edited (CCraig) : 12/12/2006 2:48:20 PM GMT
· Here is some code I wrote awhile back that reads the Memsic 2125 and calculates the angle using the CORDIC method.
[noparse][[/noparse]edit] "ATAN word.SXB"· uses word variables for much greater resolution. But it doens't have the code for the HM55B. But you could combine the two if you need the resolution.
Enjoy,
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1
"USA Today has come out with a new survey - apparently, three out of every four people make up 75% of the population." - David Letterman
Post Edited (Bean (Hitt Consulting)) : 12/13/2006 2:42:38 PM GMT
Thanks for replying to mi request...............
Bean
As usual You are always ready with plenty of example and help
I had a torough look at you file HM55 Compass.SXB, and all the comments relates to....... I understand tha this file is a derivation of a MEMSIC application, I did not think of using this approach.
There is always to apprehend by this Forum and their clever participants.
But it's not clear how you connected the HM55B Compass Module
Thanks
CCraig
Eventually your maths skills are more better than mine are......
For Brads to Degrees, it's only a small calculation because Brads : Degrees =255 : 360 so there is a direct relation easy to work out
it should be (Brads * 360) / 255 to obtain the value in Degrees.
It has to be computed correctly in order to avoid exceeding 65535 max value admitted for calculations even the intermediate results.
Anyway thanks to you too.
I'll post the results of my effort to solve this issue.
Warmest Regards
Stefano
Post Edited (ellizard) : 12/13/2006 12:09:36 PM GMT
Oops, That code was for the memsic 2125. I must have changed the name, but never changed the code. Sorry about that.
I will have to see if I have a HM55B.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1
"USA Today has come out with a new survey - apparently, three out of every four people make up 75% of the population." - David Letterman
Note that there's a 8 pin(v2) and a 16 pin version (v3)
http://www.parallax.com/detail.asp?product_id=604-00030
Rodney
Post Edited (Yendor) : 12/13/2006 5:08:35 PM GMT
· Okay Ken was kind enough to send me a HM55B compass. Here is some SX/B code that will read the HM55B and set the variable "angle_MSB" to the direction.
· Use RUN->DEBUG->POLL to see the values change in the debugger.
Bean
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1
"USA Today has come out with a new survey - apparently, three out of every four people make up 75% of the population." - David Letterman
Sorry for being late in the answer but the job took precedence.....
Thanks for the suggestion ........ to wich i too thinked, and discarded the idea after a bit of consideration.
The system I've in mind is composed of the HM55B module, the SX28 and a bunch of switches and LEDs for interface.
embedding in a umFPU would be for this use a bit like catching mosquitos with an aomic bomb.............
Anyway thanks
Stefano
Today after some days I could rejoin the forum, and I found that today.
And I've found another program for the BRads calculation of the X, Y data from the HM55B module,
what to say...... it's too gentle by You not let dropping a request in the forum until properly accomplished........
I'll let you know about the developments.................
For now Thanks
Stefano