18.11.2014 Views

The Microcontroller Idea Book - Jan Axelson's Lakeview Research

The Microcontroller Idea Book - Jan Axelson's Lakeview Research

The Microcontroller Idea Book - Jan Axelson's Lakeview Research

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 9<br />

Figure 9-3. <strong>The</strong> comparator ’s output switches at the light level determined<br />

You can use the same basic circuit with other sensors that vary in resistance. Replace the<br />

photocell with your sensor, and adjust R2 for the switching level you want. Connect VOUT<br />

to any input port pins.<br />

Measuring Analog Signals<br />

Sometimes you need something more sophisticated than a simple level detector. An<br />

analog-to-digital converter (ADC) enables you to measure the precise value of an analog<br />

voltage.<br />

Some versions of the 8052 microcontroller, including Philips’ 80C562, include an on-chip<br />

ADC, but the 8052-BASIC doesn’t have this feature, so you have to add it externally. <strong>The</strong>re<br />

are dozens of converters available, with varying resolution, accuracy, speed, method of<br />

conversion, number of analog inputs, and so on. Another option is to use an integrated sensor<br />

that contains its own ADC and has a digital output.<br />

National Semiconductor’s ADC0848 is an easy-to-use, low-cost, general-purpose, eightchannel<br />

ADC. In many ways, the ADC0848 is similar to National’s long-popular<br />

ADC0808/9 A/D converters, but with some advantages. <strong>The</strong> ADC0848 does not require an<br />

external clock; its control signals interface directly to many microcontrollers; and it is faster,<br />

with a typical conversion time of 30 microseconds.<br />

National’s data sheet for the ADC0848 has complete specifications, applications information,<br />

and example circuits. You’ll want a copy of the data sheet if you plan to use the chip.<br />

158 <strong>The</strong> <strong>Microcontroller</strong> <strong>Idea</strong> <strong>Book</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!