English
Language : 

HM55B Datasheet, PDF (17/25 Pages) List of Unclassifed Manufacturers – Compass Module
Source Code
' a byte reserved by the CompassLowVal DATA directive. This reduces the
' code overhead in TestCalibratedHm55bCompass.bs2.
Get_And_Store_Low_Value_Address:
index = 8
table(current) = 0: table(previous) = 0
DO
index = index + 1
READ CompassCal + index, table(current)
READ CompassCal + (index - 1 & $F), table(previous)
LOOP UNTIL table(current) < table(previous)
WRITE CompassLowVal, index
RETURN
' -----[ Subroutine - Calibration_Review ]------------------------------------
' Display EEPROM values.
Calibration_Review:
DEBUG CR, "Axis Offsets:", CR
READ CompassOffsets, Word x
DEBUG CR, "x-Offset = ", SDEC x
READ CompassOffsets + 2, Word y
DEBUG CR, "y-Offset = ", SDEC y, CR
DEBUG CR, "Index of low value in CompassCal:", CR
READ CompassLowVal, index
DEBUG CR, "Low value ", ? index
DEBUG CR, "TestCalibratedHm55bCompass.bs2", CR,
"uses the 'actual' values to ", CR,
"correct measurement errors:", CR
DEBUG CR, "Brad Angle
CR, "Ideal Actual
CR, "------ ------
Degree Angle",
Ideal Actual",
------ ------", CR
FOR counter = 0 TO 15
brads = counter * 16
DEBUG CRSRX, 1, DEC3 brads
READ CompassCal + counter, angle
DEBUG CRSRX, 10, DEC3 angle
LOOKUP counter, [0, 22, 45, 67, 90, 112, 135, 157,
180, 202, 225, 247, 270, 292, 315, 337], integer
LOOKUP counter, [ 0, 5, 0, 5, 0, 5, 0, 5,
0, 5, 0, 5, 0, 5, 0, 5 ], fraction
DEBUG CRSRX, 19, DEC3 integer, ".", DEC fraction
angle = angle */ 360
' Convert brads to degrees
DEBUG CRSRX, 28, DEC3 angle, CR
PAUSE 50
' Debug delay for slower PCs
© Parallax, Inc. • Hitachi HM55B Compass Module (#29123) • 05/2005
Page 17 of 25