28128 Parallax Inc, 28128 Datasheet - Page 71

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 process could be repeated over and over again to get the digit in the ten-thousandth’s
place, the hundred-thousandth’s place, and so on.
Once the digit in the thousandth’s place is known, the rules for rounding apply as
follows:
Since the value
add 1 to the hundredth’s place. It turns out to be a decision on whether or not to add 1 to
v2
Since the value in the ones place is stored in a different value, we need to check and see if
adding one to the hundredth’s place increments that value. Without this code, 3.996
would round to 3.00 instead of 4.00.
Save this code, and if possible, leave the circuit as it is because we can use this DVM to
take measurements on the circuit we build in Chapter #4.
Resolution
The BASIC Stamp is now programmed to accurately calculate the voltage associated
with the ADC0831's binary output, and the calculation is accurate to the hundredth’s
decimal place. Although sources of calculation error have been eliminated, there is
another source of error that caused by the resolution limitation of the A/D converter.
The A/D converter chip we are using is capable of 256 binary values. This means that
each measured voltage gets rounded to one of 256 discrete values. The step size is the
as shown below.
If the digit in the thousandth’s decimal place is less than 5, don’t add 1 to the
hundredth’s decimal place.
If the digit in the thousandth’s decimal place is equal or more than 5, add 1 to the
hundredth’s decimal place.
In either case, truncate everything after the hundredth’s place.
IF (v3 >= 5) THEN v2 = v2 + 1
IF (v2 >= 100) THEN
ENDIF
v = v + 1
v2 = 0
v2
is already truncated, we just need code for deciding whether or not to

Related parts for 28128