adc

3
ADC See chapter 13, first article, for the details of ADC0804 IC. Following are the pin configuration of ADC0804: Testing ADC 0804 on Proteus doesn’t need CLK IN and CLK R pin connections but applying that on hardware definitely will need capacitor and resistor at CLK pins as shown above. Test Code for ADC 0804 Below is a simple circuit to test ADC 0804. Analog signal is fed to ADC using potentiometer. The digital output is fed to AT89C51 at Port 1 which sends it to Port 2 where LED’s are connected.

Upload: ahsan-naeem

Post on 30-Sep-2014

127 views

Category:

Documents


8 download

TRANSCRIPT

Page 1: ADC

ADC

See chapter 13, first article, for the details of ADC0804 IC. Following are the pin configuration of ADC0804:

Testing ADC 0804 on Proteus doesn’t need CLK IN and CLK R pin connections but applying that on

hardware definitely will need capacitor and resistor at CLK pins as shown above.

Test Code for ADC 0804

Below is a simple circuit to test ADC 0804. Analog signal is fed to ADC using potentiometer. The digital

output is fed to AT89C51 at Port 1 which sends it to Port 2 where LED’s are connected.

Page 2: ADC

The potentiometer value can be changed using up and down arrows. Zoomed potentiometer is shown

below.

Finally voltmeter is attached to show the present output voltage of the potentiometer. Vref/2 is not

connected which means Vref/2=2.5 Volts or Vref=5 Volts. So the 8 bit digital data has 256 levels with each

level equal to 5/256=0.01953125Volts.

Code:

ORG 0H

R BIT P3.2 ; Read Pin

W BIT P3.3 ; Write Pin

INTR BIT P3.4 ; Interrupt Pin

MOV P1,#0FFH ;make P1 = input

SETB INTR

BACK: CLR W ;Write = 0

SETB W ;Write = 1 L-to-H to start conversion

HERE: JB INTR,HERE ;wait for end of conversion

CLR R ;conversion finished, enable Read

SETB R ;make Read=1 for next round

MOV A,P1 ;digital data stored in reg. A

MOV P2,A ;digital data sent to LED’s

SJMP BACK

END

Page 3: ADC

Sample Check:

Suppose potentiometer output is 3.00 Volts. What should be the digital output?

As each level is of 0.0195 Volts so 3.00 volts would be 3/0.01953125=153.8=153.6 level which will be

quantized to 153rd level. So digital output should be binary conversion of 153.

153 converted to binary is: 10011001

You can verify it from Proteus scheme as shown below that voltmeter is showing 3.00 Volts and LED’s are

showing 10011001.

How to use it in your Project

You already know how to display on LCD. ADC interfacing should be clear with this document. Now what

you have to do is simply that you will connect sensor’s output at VIN+ pin and will select appropriate

Vref/2 according to your sensor’s maximum output voltage. In programming ADC part is given in this

document. You just need to make one method CONVERSION that will convert digital data to respect

level value in decimal and corresponding ASCII characters. And then you need to create DISPLAY method

that will display it at LCD. Every part has been explained to you in much detail, you just need to combine all

this into a single application. But the interesting thing is that you have to do it using C language

BEST OF LUCK