Interfacing ADC 0808 with 8051
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
- 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
- Select the analog channel. If necessary apply proper signal conditioning as mentioned.
- Provide Low to High transition on ALE to latch in the address
- Provide Low to High transition on SC to let ADC to initiate converting from selected analog channel to equivalent digital bit.
- Now monitor for EOC signal from ADC to high to low. H- to-L EOC indicates that data is ready to collect.
- Now finally make OE L- to-H to read data from internal buffer
If you want code click here
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
ReplyDeleteyou have problem in hardware or proties.
ReplyDeleteIf it in hardware means using ic555 timer to generate the 38Khz clock signal. if it not means ask me, i will help