28029 Parallax Inc, 28029 Datasheet - Page 148

KIT PARTS SMART SENSORS W/TEXT

28029

Manufacturer Part Number
28029
Description
KIT PARTS SMART SENSORS W/TEXT
Manufacturer
Parallax Inc
Datasheet

Specifications of 28029

Accessory Type
Parts Kit
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Contains lead / RoHS non-compliant
For Use With/related Products
BASIC Stamp® or Javelin Modules
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Contains lead / RoHS non-compliant
Other names
28029PAR
Page 136 · Smart Sensors and Applications
' -----[ Subroutine - Compass_Get_Axes ]--------------------------------------
Compass_Get_Axes:
HIGH En: LOW En
SHIFTOUT DinDout,clk,MSBFIRST,[Reset\4]
HIGH En: LOW En
SHIFTOUT DinDout,clk,MSBFIRST,[Measure\4]
status = 0
DO
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, "TestCalibratedCompass.bs2", CR,
DEBUG CR, "Brad Angle
FOR counter = 0 TO 15
NEXT
DEBUG CR
RETURN
HIGH En: LOW En
SHIFTOUT DinDout,clk,MSBFIRST,[Report\4]
brads = counter * 16
DEBUG CRSRX, 1, DEC3 brads
READ CompassCal + counter, angle
DEBUG CRSRX, 10, DEC3 angle
LOOKUP counter, [0,
LOOKUP counter, [ 0,
DEBUG CRSRX, 19, DEC3 integer, ".", DEC fraction
angle = angle */ 361
DEBUG CRSRX, 28, DEC3 angle, CR
PAUSE 50
CR, "Ideal
CR, "------
"uses these values to ", CR,
"correct errors:", CR
180, 202, 225, 247, 270, 292, 315, 337], integer
Actual
------
0,
22,
5,
5,
Degree Angle",
Ideal
------
45,
0,
0,
67,
5,
5,
Actual",
------", CR
90, 112, 135, 157,
0,
0,
' Compass module subroutine
' Send reset command to HM55B
' HM55B start measurement command
' Clear previous status flags
' Status flag checking loop
' Measurement status command
' Debug delay for slower PCs
' Convert brads to degrees
5,
5,
0,
0,
5,
5 ], fraction

Related parts for 28029