28123 Parallax Inc, 28123 Datasheet - Page 163

TEXT WHAT'S A MICROCONTROLLER

28123

Manufacturer Part Number
28123
Description
TEXT WHAT'S A MICROCONTROLLER
Manufacturer
Parallax Inc
Type
Programmingr
Datasheet

Specifications of 28123

Style
Book
Title
What's a Microcontroller?
Contents
Whats a Microcontroller? Text
Product
Microcontroller Accessories
Core Processor
PIC16C57c
Flash
128 Bytes
Operating Supply Voltage
9 V
Board Size
31 mm x 16 mm
Lead Free Status / RoHS Status
Not applicable / Not applicable
So how can these input values be adjusted so that they map to the values of 500 and 1000
that are needed to control the servo with the
multiplication and addition. First, multiply the input values by something to make the
difference between the clockwise (minimum) and counterclockwise (maximum) values
500 instead of almost 700. Then, add a constant value to the result so that its range is
from 500 to 1000 instead of 1 to 500. In electronics, these operations are called scaling
and offset.
Here’s how the math works for the multiplication (scaling):
After the values are scaled, here is the addition (offset) step.
The
fractional values, like 0.724. Here again are the steps for using
1. Place the value or variable you want to multiply by a fractional value before the
2. Take the fractional value that you want to use and multiply it by 256.
3. Round off to get rid of anything to the right of the decimal point.
4. Place that value after the */ operator.
*/
operator that was introduced on page 95 is built into PBASIC for scaling by
*/ operator.
time = time */
time
time
time
time
new
new
(
(
(
(
fractional
fractional
maximum
minimum
maximum
minimum
)
)
)
)
value
value
=
=
=
=
1
. 0
691
500
×
724
500
=
691
=
×
+
185
. 0
+
500
691
500
724
=
500
. 0
=
=
×
724
=
1000
691
256
500
×
=
. 0
185
PULSOUT
724
.
344
=
500
command? The answer is by using
*/
applied to 0.724:

Related parts for 28123