28029 Parallax Inc, 28029 Datasheet - Page 89

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
Figure 3-10 shows how to apply these steps with a single PBASIC command that
performs both scaling and offset. Keep in mind that PBASIC calculations work from left
to right unless they are overridden with parentheses. So the first thing this calculation
does is subtract 1875 from the input value. The new range is now 0 to 1200 instead of
1875 to 3215. Next,
scaled, 127 is subtracted from it resulting in −127 to 127.
Choosing the Right ** Constant for Scaling
The value 13369 used with the
determined by substituting the number of elements in the input and output scales into this
equation. The number of output scale elements is 255, including 0, and the number of
input scale elements is 1251, also including 0. Use this equation whenever you need to
fit a larger scale into a smaller one with the
value = value - 1875 ** 13369 - 127
ScaleCons
ScaleCons
ScaleCons
ScaleCons
tan
tan
tan
tan
** 13369
(1875 to 3125)→(0 to 1200)
t
t
t
t
|
|
|
|
|
=
=
=
=
Figure 3-10: Scaling the Value Variable
13369
Int
Int
Int
[
13
65536
65536
scales value down to 0 to 254. After the range has been
,
**
369
(0 to 1200)→(0 to 254)
|
|
|
constant to scale (0 to 1250) to (0 to 254) was
.
344
1251
input
output
Chapter 3: Tilt with the Memsic Accelerometer · Page 77
255
**
]
(0 to 254)→(-127 to 127)
operator.
scale
|
1
scale
elements
elements
1

Related parts for 28029