Skip to main content

Subsection 6.2.7 Part 6: Successive Approximation, Live

In the pre-class reading we saw that the converter finds its answer by a binary search, one bit at a time. Let’s run one ourselves.

Activity 6.2.7. Be the Converter.

Think of a whole number between 0 and 15 (four bits’ worth) and keep it to yourself. We will find it by successive approximation, exactly as the hardware does, one bit at a time from the most significant down.

(a)

Answer only yes or no to each question. Starting with SAR = 0b1000 (8), so testing the highest bit, namely bit 3: is your number greater than or equal to 8? If yes, the bit stays; if no, it is cleared. Then test bit 2, then bit 1, then bit 0 the same way.

(b)

How many questions did it take, and how many would it take for a number between 0 and 4095? What does that tell you about how long a 12-bit conversion must take?
Four bits took four questions; twelve bits take twelve comparisons, plus a little overhead for sampling, about 14 ADC clock cycles in total (Figure 6.3.1). That is why a conversion is not instantaneous, and why your code has to wait for EOC rather than reading ADC_DR straight away.