Sunteți pe pagina 1din 20

Analog-to-Digital Converter

BY:-

Brief Introduction
In this presentation, we investigate the working of an analog-to-digital converter which works on the successive approximation principle. A microcontroller is used to accept the output of the analog-todigital converter as input to one of its ports, and an LCD display is used to output the value of the converted analog input.

About the 8051 microcontroller


In our application of the microcontroller, we have used the AT89S52, which is a microcontroller based on the 8051 architecture manufactured by ATMEL. Its pin diagram is as below P1.0 - P1.7 = 8-bit I/O Port 1 RST = Reset Pin P3.0 - P3.7 = 8-bit I/O Port 3 XTAL2 & XTAL1 = The crystal oscillator is connected between these pins. GND = Circuit Ground P2.0 - P2.7 = 8-bit I/O Port 2 PSEN = Program Store Enable ALE = Address Latch Enable EA = External Access Enable P0.1 - P0.7 = 8-bit I/O Port 4 VCC = +5 V

Analog to Digital conversion Principles


Typically, an ADC is an electronic device that converts an input analog voltage or current to a digital number proportional to the magnitude of the voltage or current. The digital output may use different coding schemes. Typically, the digital output will be a two's complement binary number that is proportional to the input, but there are other possibilities There are three commonly used methods for analog-to-digital conversion, which are: Digital Ramp ADC Successive Approximation ADC Flash ADC

Our presentation is based upon the successive approximation principle

Successive Approximation ADC

Successive Approximation ADC


SAR is a successive approximation 8bit register, which consists of 8 flip flops. The microcontroller interfaces with the latch of the ADC, using bits D0 to D7 as one of the input ports. It also is connected with the SOD, SOC, ALE and EOC terminals. The microcontroller gives high to SOC (start of conversion), which enables the shift accumulator register. . According to the flowchart, all bits from D0 to D7, which are the input to the DAC are set 0. Then, the output of the DAC (Vad) is compared with the input analog signal (Va).

Successive Approximation ADC


Three cases are encountered: 1.Vad < Va : The bit is left as 1, and the next bit is set 1. 2.Vad > V-a: The bit is set 0, and the next bit is set 1. 3.Vad = Va: The conversion is now complete, so EOC goes HIGH and so does ALE (they are internally shorted). Once the conversion is complete, the high output of ALE enables the latch and the output is stored momentarily. This output is received by the port of the microcontroller

Using the ADC 0804


The ADC0804 is an 8-bit microprocessorcompatible A/D converter. Its salient features are: 8-bit resolution Differential analog voltage inputs Logic inputs and outputs meet both MOS and TTL voltage level specifications Works with 2.5V (LM336) voltage reference On-chip clock generator 0V to 5V analog input voltage range with single 5V supply No zero adjust required It comes in a standard 0.3 20-pin DIP (dual in-line package), the pin diagram of which is shown in Fig. 4.

Sample Truth Table of ADC


Analog Input
D2 0 1 0 0

Digital Output
D1 0 0 D0 0 1

2
3 4 5 6

0
0 1 1 1

1
1 0 0 1

0
1 0 1 0

THE LCD AND ITS INTERFACING


A 16x2 LCD display 16 characters per line and there are 2 such lines. In this LCD each character is displayed in 5x7 pixel matrix. This LCD has two registers, namely, Command and Data. The command register stores the command instructions given to the LCD. A command is an instruction given to LCD to do a predefined task like initializing it, clearing its screen, setting the cursor position, controlling display etc. The data register stores the data to be displayed on the LCD. The data is the ASCII value of the character to be displayed on the LCD

Pins of a 16x2 LCD Display


Pin No Function 1 Ground (0V) 2 Supply voltage; 5V (4.7V 5.3V) 3 Contrast adjustment; through a variable resistor 4 Selects command register when low; and data register when high Pin Name GND Vcc VEE Register Select

5
6 7 8 9 10 11 12 13 14 15 16

Low to write to the register; High to read from the register


Sends data to data pins when a high to low pulse is given

Read/write
Enable DB0 DB1 DB2 DB3 DB4 DB5 DB6 DB7 Led+ Led-

8-bit data pins

Backlight VCC (5V) Backlight Ground (0V)

L.C.D. COMMANDS
Instruction
Function Set (8-bit Interface 2-lines 5*7 Pixels) Function Set (8-bit Interface 1-lines 5*7 Pixels) Function Set (4-bit Interface 2-lines 5*7 Pixels) Decimal 56 48 40 HEX 38 30 28

Function Set (4-bit Interface 1-lines 5*7 Pixels)


Scroll Display one character right (all lines) Scroll Display one character left (all lines) Home (move cursor to top/left character position) Move Cursor one character left Move Cursor one character right Turn on Visible Underline Cursor Turn On Visible Blinking-Block Cursor

32
28 24 2 16 20 14 15

20
1E 18 2 10 14 0E 0F

Make Cursor Invisible


Blank the Display (Without Clearing) Restore the Display (with Cursor Hidden) Clear Screen Set Cursor Position (DDRAM address) Set Pointer in CGRAM address

12
8 12 1 128+addr 64+addr

0C
08 0C 01 80+addr 40+addr

IMPLEMENTATION OF THE CIRCUIT


The circuit is designed to implement analog to digital conversion using the ADC0804LCN 8-bit A/D converter. The microcontroller AT89S52 is programmed so that when an analog signal is given as input, the equivalent digital voltage is displayed on an LCD display. Thus, in effect, the circuit behaves like a simple voltmeter. The principle of operation of the ADC0804 has been explained in Section II (b). After the requisite number of clock pulses to complete the conversion, the INTR pin will make a high-to-low transition. This signals the availability of a new conversion. A RD operation (with CS low) clears the INTR line high again. Since this is an 8-bit A/D converter, a voltage from 0-5V. 0 will be represented as 00000000 (0 in decimal) and 5V is represented as 11111111 (256 in decimal).

The components required to effect ADC using the 8051 microcontroller and the ADC0804LCN IC are: ADC0804LCN Resistor 10K, 1K Capacitor 150 pF LCD Display 16x2 Crystal - 12 MHz Power Supply 5V 8051 MCU Development Board

Circuit Schematic

Music Recording
ADCs are integral to current music reproduction technology. Since much music production is done on computers, when an analog recording is used, an ADC is needed to create the PCM data stream that goes onto a compact disc or digital music file. The current crop of AD converters utilized in music can sample at rates up to 192 kilohertz. High bandwidth headroom allows the use of cheaper or faster anti-aliasing filters of less severe filtering slopes. The proponents of oversampling assert that such shallower anti-aliasing filters produce less deleterious effects on sound quality, exactly because of their gentler slopes. Others prefer entirely filter-less AD conversion arguing that aliasing is less detrimental to sound perception than preconversion brickwall filtering. Considerable literature exists on these matters, but commercial considerations often play a significant role. Most[citation needed] high-profile recording studios record in 24-bit/192176.4 kHz PCM or in DSD formats, and then downsample or decimate the signal for Red-Book CD production (44.1 kHz) or to 48 kHz for commonly used for radio/TV broadcast applications.

Digital Signal Processing


AD converters are used virtually everywhere where an analog signal has to be processed, stored, or transported in digital form. Fast video ADCs are used, for example, in TV tuner cards. Slow on-chip 8, 10, 12, or 16 bit ADCs are common in microcontrollers. Very fast ADCs are needed in Digital storage oscilloscopes, and are crucial for new applications like software defined radio. Most ADC applications today can be classified into four broad market segments: (a) data acquisition, (b) precision industrial measurement, (c) voice-band and audio, and (d) high speed (implying sampling rates greater than about 5 MSPS). A very large percentage of these applications can be filled by successive-approximation (SAR), sigma-delta (-), and pipelined ADCs.

Digital Multimeter

Digital Storage Oscilloscope

S-ar putea să vă placă și