I just used the calculator supplied with Windows..
Set it in Programmer mode (in View), then "word" as the data size option.
Entering the value while hex is selected, then switch to decimal.
For a generic calculator, enter the hex (in hex mode), convert to decimal then if the number is larger than 32767, subtract 65536.
That should give the same results.
Hi R.
Ok, the above method works as you say, thanks.
Is it possible to not use the HEX route. The DATA shows two BYTEs of DEC and I want to see the end result in DEC?
EDIT: I think I've worked it out (HIGH BYTE X 256 + LOW BYTE) [If > 32767 then] -65536 =X
I'll play with this and the results I'm getting so I can get the feel of what happens, when the module is moved around, before using the calculations, within this thread.
Hi R.
Ok, the above method works as you say, thanks.
Is it possible to not use the HEX route. The DATA shows two BYTEs of DEC and I want to see the end result in DEC?
EDIT: I think I've worked it out (HIGH BYTE X 256 + LOW BYTE) [If > 32767 then] -65536 =X
I'll play with this and the results I'm getting so I can get the feel of what happens, when the module is moved around, before using the calculations, within this thread.
Hi J,
I have the 8 month old calculation, safely in the program, but 8 months, is a long time, for me to need a refresher course. Using the calculator, with the recent sums, will get me used to twos compliment again, before adding in the calculation to the program, where I'll be able to see what's gong on better.
Cheers, C.
Hi M,
I've just got to this in the DATA sheet: Measuremnet data is stored in two’s complement and Little Endian format. Measurement range of each axis is -8190 ~ +8190 in decimal in 14-bit output, and -32760 ~ 32760 in 16-bit output.
How can I tell one 'endian' from the other?
(Set to 16BIT) C.
Hi M,
I've just got to this in the DATA sheet: Measuremnet data is stored in two’s complement and Little Endian format. Measurement range of each axis is -8190 ~ +8190 in decimal in 14-bit output, and -32760 ~ 32760 in 16-bit output.
How can I tell one 'endian' from the other?
(Set to 16BIT) C.
It needs, negative numbers. Is it possible for me to output negative numbers to suit Magmaster. EDIT: I got the Magmaster and viewer to work. I now need to work out how to output negative numbers.
C.
If it needs negative numbers, you must input negative numbers
You must convert from the low and high bytes ( twos complement )
to x, y, z values, which will be some +- values.
If it needs negative numbers, you must input negative numbers
You must convert from the low and high bytes ( twos complement )
to x, y, z values, which will be some +- values.
Hi,
J and P,
Yes, a bit confusing!
It needs the 6x measurement register READings, in this format. ( I added the - to the HSEROUT, so not real, but it worked)
255, 255, 255
78, 230, 138
255, 255, 255
89, 225, 137
255, 255, 255
84, 230, 146
255, 255, 255
84, 228, 150
255, 255, 255
87, 231, 149
255, 255, 255
81, 231, 143
They are as the image in #52.
Once these are running, they show in the top bar.
Move the compass module around in these 12 orientations, (see image), while pressing the nearby button to enter each READing into Magmaster.
Hi M,
Re-looking at #52, I think Magmaster may need the results under the lines-----------------------.
I tried 3x values and Magviewer looked the same as 6x, so it looks as though 3x twos compliment values are needed.
C
Hi M,
Re-looking at #52, I think Magmaster may need the results under the lines-----------------------.
I tried 3x values and Magviewer looked the same as 6x, so it looks as though 3x twos compliment values are needed.
C
Are you now sending the data through serial interface to Magmaster or inputting it manually?
I think you should send repeatedly N coordinates x1, y1, z1 - xn, yn, zn
Coordinates should be in floating point.
You can then see live 3D data as in video #2 from Magmaster link in #msg 50 and after calibration video #4
Here is the Magmaster DATA again:
Will someone tell me where twos compliment and floating point starts and ends in ABCDEF please?
(I have the calculation for twos compliment)
If I enter A and B I get this (Magviewer)
There are no negatives. so all of the DOTs are in the same quadrant!#
I use the Magviewer LIVE as I send the DATA via serial and radio modules. Once I get DOTs in all 4 quadrants, I'll follow the 12 orientations in the instructions while entering DATA into Magmaster.
Here is the Magmaster DATA again:
Will someone tell me where twos compliment and floating point starts and ends in ABCDEF please?
(I have the calculation for twos compliment)
If I enter A and B I get this (Magviewer)
There are no negatives. so all of the DOTs are in the same quadrant!#
I use the Magviewer LIVE as I send the DATA via serial and radio modules. Once I get sensible results, I'll follow the 12 orientations in the instructions while entering DATA.
C
The coordinates before the calibration is done can be floating point or 16bit signed integers
When the calbration is done you get the correction coefficients M11 - M33, which are in floating point, see pictures 1 and 9.
Because Oshonsoft does not handle signed integers, it is easier to convert the twos complement coordinates to floating point from the beginning and then send them to Magmaster, something like
Hserout #Xf, #Yf, #Zf.... etc
Converting to floating point can be done in the same way as in the pressure sensor program:
- make 16bit integer from Xlowbyte, Xhighbyte-> Xraw
Xfloat = Xraw
if Xfoat > 32767 then // is it negative
Xfloat = xfloat-65536