28129 Parallax Inc, 28129 Datasheet - Page 70

TEXT BASIC ANALOG & DIGITAL

28129

Manufacturer Part Number
28129
Description
TEXT BASIC ANALOG & DIGITAL
Manufacturer
Parallax Inc
Type
Programmingr
Datasheet

Specifications of 28129

Style
Book
Title
Basic Analog and Digital
Contents
Basic Analog and Digital Text
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Not applicable / Not applicable
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 28129