28029 Parallax Inc, 28029 Datasheet - Page 154

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 142 · Smart Sensors and Applications
' These EEPROM values were written by CalibrateCompass.bs2.
Compass_Correct_Offsets:
' -----[ Subroutine - Compass_Interpolate ]-----------------------------------
' This subroutine applies linear interpolation to the refine the compass
' measurement.
' Compass_Correct_Offsets subroutine, and it can correct axis skew and other
' factors inherent to the HM55B chip.
'
' The subroutine relies on 16 actual compass measurements that were stored
' in the sixteen EEPROM locations reserved by the CompassCal DATA directive.
' These measurements were stored by CalibrateCompass.bs2, and they
' represent the actual compass measurements for 0, 22.5, 45, 90,..., 337.5
' degrees.
' angle measurement falls between.
' based on where the angle measurement falls between the two known table
' values.
Compass_Interpolate:
READ CompassOffsets, Word axisOffset
x = x - axisOffset
READ CompassOffsets + 2, Word axisOffset
y = y - axisOffset
RETURN
' Start with the lowest value in the CompassCal table.
READ CompassLowVal, index
' Load current and previous table values.
READ CompassCal + index, table(current)
READ (CompassCal + (index - 1 & $F)), table(previous)
' The IF...ELSEIF...ELSE...ENDIF code block finds the two EEPROM CompassCal
' table values that the current angle measurement falls between and
' calculates the difference between the current angle measurement and the
' lower of the two table values.
' that are greater than the highest or less than the lowest table values.
' The ELSE block handles everything in between the highest and lowest table
' values.
IF (angle >= table(previous)) THEN
ELSEIF (angle <= table(current)) THEN
span = (255 - table(previous)) + table(current)
angleOffset = angle - table(previous)
The subroutine finds the two EEPROM measurements that the current
This second level of refinement can be performed after the
It then updates the angle measurement
The IF and ELSEIF blocks deal with values
' Get x-axis offset
' Correct x-axis
' Get y-axis offset
' Correct y-axis

Related parts for 28029