Just received the new low cost 3-axis magnetometer board from Sparkfun (http://www.sparkfun.com/products/10530) and it seems to work with the following 28X2 code...
hi2csetup i2cmaster, $3C, i2cslow_16, i2cbyte 'Setup I2C
hi2cout $00, ($70) 'Set requister A, for 8-average, 15Hz, normal measurement
hi2cout $01, ($A0) 'Set requister B, for gain = 5
start:
hi2cout $02, ($01) 'Request single measurement
pause 1000
hi2cin $03, (b0,b1,b2,b3,b4,b5) 'Read the six output requisters (but documantation said use $06?)
sertxd (#w0,",",#w1,",",#w2,cr) 'Combine into three data words and send to PC
goto start 'Next three measurements
However, please can anyone help with additional code to convert the 16-bit 2's compliment outputs to decimal?
hi2csetup i2cmaster, $3C, i2cslow_16, i2cbyte 'Setup I2C
hi2cout $00, ($70) 'Set requister A, for 8-average, 15Hz, normal measurement
hi2cout $01, ($A0) 'Set requister B, for gain = 5
start:
hi2cout $02, ($01) 'Request single measurement
pause 1000
hi2cin $03, (b0,b1,b2,b3,b4,b5) 'Read the six output requisters (but documantation said use $06?)
sertxd (#w0,",",#w1,",",#w2,cr) 'Combine into three data words and send to PC
goto start 'Next three measurements
However, please can anyone help with additional code to convert the 16-bit 2's compliment outputs to decimal?