28128 Parallax Inc, 28128 Datasheet - Page 68

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
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 28128