122-28029 Parallax Inc, 122-28029 Datasheet - Page 155

GUIDE STUDENT SMART SENSORS

122-28029

Manufacturer Part Number
122-28029
Description
GUIDE STUDENT SMART SENSORS
Manufacturer
Parallax Inc
Datasheet

Specifications of 122-28029

Accessory Type
Manual
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Contains lead / RoHS non-compliant
For Use With/related Products
Smart Sensors
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Contains lead / RoHS non-compliant
Your Turn - Displaying "Degrees" as °
Displaying the degree ° symbol in the Debug Terminal was first introduced in Chapter
#3, Activity #5.
ACTIVITY #4: IMPROVE COMPASS MEASUREMENTS BY AVERAGING
You may have noticed that the x and y measurements in the Debug Terminal tended to
alternate between two or even three different values. This is the result of several different
types of interference that are collectively called noise. Some common culprits are nearby
AC devices and power lines, digital activity in the BASIC Stamp, and even digital
activity inside the HM55B chip.
ELSE
ENDIF
' After the offset between the current angle measurement and the next lower
' table measurement has been determined, this code block uses it along with
' the span between the table entries above and below the angle measurement
' to solve for: angle(corrected) = angle(offset) * 16 / span.
' This code block also rounds up or down by comparing the remainder of
' the angleOffset / span division to the value of (span / 2).
angleOffset = angleOffset * 16
angle = (angleOffset / span) + ((angleOffset // span) / (span / 2))
angle = ((index - 1 & $F) * 16) + angle
angle = angle & $ff
RETURN
span = table(current) + (255 - table(previous))
angleOffset = angle + (255 - table(previous))
index = index - 1
READ CompassCal + index, table(current)
DO
LOOP
table(previous) = table(current)
index = index + 1
READ CompassCal + index, table(current)
IF (angle <= table(current)) AND (angle > table(previous)) THEN
ENDIF
Modify the program to display degrees with ASCII character 176, the ° symbol.
span = table(current) - table(previous)
angleOffset = angle - table(previous)
EXIT
Chapter 4: Hitachi HM55B Compass Module · Page 143

Related parts for 122-28029