28129 Parallax Inc, 28129 Datasheet - Page 68

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
This gives us our three PBASIC commands for calculating the values to the left and right
of the decimal point. To reconstruct the fractional value on the display, we’ll print a
period "." in-between the two values.
The first of the three commands is already in our
other two instructions to complete the algorithm.
The
period in between them. Make sure to update the line in the
as shown below.
Now run the program again, and see what happens. Figure 3-8 shows an output sample,
which is now almost ready to display to the nearest hundredth of a volt. All that needs to
be corrected is a rounding error in the hundredths decimal place.
Display
Calc_Volts:
RETURN
Display:
RETURN
v = 5 * adcBits / 255
r = 5 * adcBits // 255
v2 = 100 * R / 255
DEBUG HOME
DEBUG "8-bit binary value:
DEBUG CR, CR, "Decimal value:
DEBUG CR, CR, "DVM Reading:
DEBUG DEC1 v, ".", DEC2 v2, " Volts"
subroutine also needs to be updated to print the two variable values with a
", BIN8 adcBits
"
", DEC3 adcBits
Calc_Volts
'
'
Display
new line
new line
subroutine. Just add the
'
'
subroutine exactly
new line
new line

Related parts for 28129