28128 Parallax Inc, 28128 Datasheet - Page 70

no-image

28128

Manufacturer Part Number
28128
Description
KIT BASIC ANALOG/DIGI PARTS ONLY
Manufacturer
Parallax Inc
Datasheet

Specifications of 28128

Accessory Type
ADC, DAC
Product
Microcontroller Accessories
For Use With/related Products
BASIC Stamp® 2 and Board of Education
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
The Output
The output sample from Figure 3-9 indicates that the DVM is now calculating to the
hundredth’s decimal place correctly.
About the Code
To round off to the nearest hundredth, we need to know the digit in the thousandth’s
place. Using the rules of long division, we can simply set a new variable, v3 equal to the
remainder from the calculation for
Instead of using another variable,
v3
the left of the equals sign is the redefined value, which is ten times the old
255.
to the right of the equals sign is the one calculated in the first line. The value of
v3= 100 * R // 255
v3 = 10 * v3 / 255
As soon as you're sure your program works right, save it as P3_1R4.bs2. We will add to
both the code and circuit in the next experiment.
v3
v2
, and divide by 255 again.
is simply redefined in the second line. The value of
Figure 3-9
Debug Terminal
Output for Program
Listing 3.1, Revision
4.
v3
, divided by
v3
to

Related parts for 28128