Saturday 28 December 2013

Interfacing ADC 0808 with 8051 using proteus


Interfacing ADC 0808 with 8051

In most of the digital system micro controller needs to take input from Analog sensor or transducer. Analog signal are most common input signal for embedded system. Sensor or transducer Such as Temperature, Motion, pressure, Humidity are analog. You will need to design a circuit to program AT89c51 or 8051 for converting analog input to equivalent digital data.  

I/O Pin Details   
Analog Channel Selection
ADC 0808 have 8 different channel. For proper channel selection logic as per table is provided to Pin no. 23, 24,25.


Reference Voltage or Step Size
Step Size or Reference voltage can be calculated from equation Step Size = (VREF(+) + VREF(-))/2 If we consider VREF(-) = Gnd and VREF(+) = 5V then step size = 5/256 = 19.53 mV. If you using temperature sensor LM35 then step size is 10 mV. 10 mV step size can be set by VREF(-) = Gnd and VREF(+) = 2.56V.

ALE 
ALE (Address Latch Enable) is L - to H pulse to latch in address.   

START
ADC starts conversation on receiving this signal high to low. Successive approximation register (SAR) is reset on the positive edge of the start conversion (SC) pulse. The conversion is begun on the falling edge of the start conversion pulse.   

EOC (End Of Conversion)
 This is an active low O/P signal from ADC on receiving low EOC micro controller Come to know that the converted data is ready to be picked up.

OE (Output Enable)
ADC converts the analog input to its binary equivalent and holds it in an internal register. L- to-H OE is used to enabling TRI - STATE output, so Converted data can be red from data pin D0 – D7.

Clock signal
Clock signal cannot be faster then 100ms.It can be external or provided from microcontroller crystal using 4 D- F/F as frequency divider. Single D- F/F divides frequency by 2.

Signal conditioning
If sensor signal is very low then apply proper amplification. You need simple opam amplifier. Normally sensor O/P is in range of mV and affected by noise very easily for better accuracy apply 2 - 5 gain. If you using temperature sensor LM35 its O/P is 10mv/C and it is advised to amplification by gain of 2 – 5.

Circuit Diagram

Fig 1: ADC simulation interface with AT89c51.

 Simulation timing diagram

Fig 2: Simulation timing diagram

Algorithm to program the ADC 0808 through AT89C51

  1.       Connect the ADC as shown in diagram. Provide Clock signal from micro controller crystal by step down its frequency with help of D – F/F
  2.      Select the analog channel. If necessary apply proper signal conditioning as mentioned.
  3.       Provide Low to High transition on ALE to latch in the address
  4.       Provide Low to High transition on SC to let ADC to initiate converting from selected analog channel to equivalent digital bit.
  5.      Now monitor for EOC signal from ADC to high to low. H- to-L EOC indicates that data is ready to collect.
  6.     Now finally make OE L- to-H to read data from internal buffer
 Timing Diagram


 If you want code click here

2 comments:

  1. please having being having problem with the clock pin of the adc0808. have not being able to provide the required clock(either from the microcontroller or externally). would appreciate if you can help me. tanks

    ReplyDelete
  2. you have problem in hardware or proties.
    If it in hardware means using ic555 timer to generate the 38Khz clock signal. if it not means ask me, i will help

    ReplyDelete