28029 Parallax Inc, 28029 Datasheet - Page 149

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
' -----[ Subroutine - Compass_Correct_Offsets ]-------------------------------
' This subroutine corrects cumulative magnetic field interference that can
' come from sources such as the PCB, jumper wires, a nearby battery, or a
' nearby current source.
' the EEPROM space that was reserved by the CompassOffsets DATA directive.
' These EEPROM values are written by this program during calibration.
Compass_Correct_Offsets:
Your Turn - Reviewing the Calibration Settings
In the main activity, you typed the letter C to store calibration values in the BASIC
Stamp's EEPROM. You can also review these calibration values by running the program
and typing R instead of C. This will show a comparison of the actual vs. ideal angle
measurements in binary radians. These errors are caused in part by the printed circuit
board that the sensor is mounted on. Some of the materials in the printed circuit board
are magnetic, and are not necessarily aligned with the Earth's magnetic field. Other
magnetic field sources that can cause measurement errors come from nearby electrical
currents, such as electrons flowing through the Vdd and Vss lines to power your board's
power LED.
LOOP UNTIL status = Ready
SHIFTIN
HIGH En
IF (y.BIT10 = 1) THEN y = y | NegMask
IF (x.BIT10 = 1) THEN x = x | NegMask
RETURN
READ CompassOffsets, Word axisOffset
x = x - axisOffset
READ CompassOffsets + 2, Word axisOffset
y = y - axisOffset
RETURN
SHIFTIN
Run CalibrateCompass.bs2 again.
Click the Debug Terminal's Transmit windowpane and press Enter.
Type R to review the calibration settings.
Examine the errors reported, which the example program in the next activity will
use to make corrections.
DinDout,clk,MSBPOST,[x\11,y\11]
DinDout,clk,MSBPOST,[Status\4]
This subroutine relies on values stored in
Chapter 4: Hitachi HM55B Compass Module · Page 137
' Get Status
' Exit loop when status is ready
' Get x & y axis values
' Disable module
' Store 11-bits as signed word
' Repeat for other axis
' Get x-axis offset
' Correct x-axis
' Get y-axis offset
' Correct y-axis

Related parts for 28029