27220 Parallax Inc, 27220 Datasheet - Page 219

BOOK STAMPWORKS

27220

Manufacturer Part Number
27220
Description
BOOK STAMPWORKS
Manufacturer
Parallax Inc
Datasheet

Specifications of 27220

Accessory Type
Booklet
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
StampWorks
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Not applicable / Not applicable
called a binary search. In simple terms a binary search is able to eliminate half the
available possibilities in a single test.
possibilities can be checked with very few tests.
In the Get_ADC subroutine the variable called bias is used to split the available
possibilities, hence it starts at 128 before entering the loop. In the working part of
the test loop bias is added to adcVal – this voltage is output via PWM to one side
of the comparator.
If the unknown voltage is lower than the current test voltage (in adcVal), the
current value of bias is removed before bias is divided for the next test. The new
value of bias is added to adcVal and the comparator is checked again. This process
is repeated until bias is divided down to zero – this takes eight iterations of the test
loop to “find” the unknown voltage, no matter what that voltage is. This is far
quicker than the slow method presented above.
The table below illustrates the test loop with a voltage input of 3.3 volts (168
counts):
Note that the input is actually determined by Step 5, but the nature of the algorithm
requires it to run all the way through until bias is divided down to zero.
Step
End
1
2
3
4
5
6
7
8
bias
128
64
32
16
8
4
2
1
0
adcVal
168
128
192
160
176
168
172
170
169
(counts)
With this method a large number of
adcVal
2.50
3.76
3.14
3.45
3.29
3.37
3.33
3.31
3.29
(volts)
Remove
Yes
Yes
Yes
Yes
Yes
No
No
No
bias
?

Related parts for 27220