Micro-controllers are useful to the extent that they communicate with other devices, such as sensors, motors, switches, keypads, displays, memory and even other micro-controllers. Many interface methods have been developed over the years to solve the complex problem of balancing
circuit design criteria such as features, cost, size, weight, power consumption, reliability, availability, manufacturability.
Many microcontroller designs typically mix multiple interfacing methods. In a very simplistic form, a microcontroller system can be viewed as a system that reads from (monitors) inputs, performs processing and
writes to ( controls ) outputs.
The ADC0808 or ADC 0809, A/D Converter is 8 bits analog to digital converter and has a microprocessor bus interface and it require only single single +5 power supply for operation . It also has an 8 input analog multiplexer on chip to select the desire analog channal for scanning or conversion to digital bit pattern. The interface of ADC0808 with any microcontroller or microprocessor requires 6 lines in addition to the data bus of 8 lines. These are the 3 mux(multiplexed) input select address lines and 3 control lines. The 3 mux address lines are connected to data bus bits 0 through 2. So that a nibble (0 - 7) written to the A/D will select one of the eight inputs. There is a bus output enable line for reading the A/D and a End of Conversion line which confirms that the conversion is complete. Lastly there are 2 more lines that are tied together and connected as 1 line to the host. This is the Start/ALE line, initially this line is kept at digital logic high or 1. When this line is taken back low, the conversion process starts. The EOC line is driven low. Within a few milliseconds, the conversion is complete and the EOC line is driven high. The OE line is set high and the result is read from the A/D data bus. The OE line is set low, disabling the A/D output data bus. This completes one cycle of the A/D conversion process.
There are 2 other lines that are tied, one each to the Vcc and Gnd pins. These are the +Vref and -Vref pins. The A/D conversion is done based on the ratio of the input to the Vref pins. In other words, if +Vref is +5.00 volts, then each bit is worth 5.00/256 or 19.53 mv (millivolts). The more accurate voltage for +Vref ( in terms of measuring a voltage) would be 5.12 which would yeild a 20 mv / bit resolution. We could then just multiply the value of the conversion by 20 mv and have the actual voltage on the input, accurate to + or - 20 mv. This would result in a 5.1 volt full scale reading if the binary value is FFh or 255d). So full scale is 1 bit less than +Vref. Also +Vref can't be more positive than Vcc and -Vref can't be more negative than ground. So to have a 5.12 volt +Vref, you would have to have a +5.12 volt Vcc.
If you are measuring the position of a potentiometer, with either end tied to Vcc and Gnd and the wiper as an input, then it doesn't matter what the +Vref value actually is, since you are now looking for a ratio, not an actual value. You want to know the POSITION of the wiper, relative to either end, not it's actual resistance or voltage. This is what the ADC0808 was designed to work best with and it's called ratio metric.
Here are the steps in order and what each does. Initially the EOC line is high, the OE line is low and the Start/ALE line is low:
1. A mux selection (00h) is placed on the A/D bus
2. The Start/ALE line is set high.
3. The Start/ALE line is set low
4. The EOC line is monitored until high
5. The OE line is set high
6. The converted results are read from the A/D
7. The OE line is set low.
Tri State Bus
If I have 2 regular switches and I tie their contacts together (parallel) so that I can monitor both switches with two points, if both switches are open, then the output is open. If one of the switches is closed, the output is closed. If the other switch is now closed, no change is seen on the output, since the output was already closed by the first switch. The point here is that when you tie two things together, there can be a conflict between the two things, if they both try to signal at the same time. There are a couple of ways around this problem. One is to put each thing on a separate connection. This solution requires a lot of hardware to work.
The other approach is to use a tri state data bus. In normal logic, you have two possible states, a 0 and a 1. Tri state adds a third level, called off. Off means just that. When the bus is disabled, it is in the high impedance (high resistance) state, or turned off, for all practical purposes, disconnected. While you still have the original limitation, you can't be reading from both at the same time, you can share the bus between the display and the A/D by reading each at a different time, one after the other.
Back to the ADC0808 interface. Here is the program as it will exist in our system software. The bit adec is the EOC (end of convert) pin of the ADC0808. The bit adst is the Start/ALE input pins of the ADC0808. Bit adoe is the A/D output enable pin.
wait2: jnb adec,wait2 ;wait until EOC is a one
setb adoe ;enable A/D output bus
mov a,p0 ;get converted value
clr adoe ;disable A/D output bus
mov a,#h'00 ;set mux select to input 0
mov p0,a ;put mux select on the bus
setb adst ;set Start/ALE to a one (this strobes in the address)
clr adst ;clear Start/ALE to a zero (this starts the conversion)
mov p0,#h'ff ;set p0 to tri state bus
This example is only converting input 0 and never converts the other 7 inputs.
Tuesday, August 4, 2009
ADC0808 A/D Converter Interfacing with Microcontroller At89s52
microcontroller 8051 security alarm based system circuits GSM based Home security system hidden camerasGSM based home security system project using microcontroller 8051. Main aim of this project is to provide sms based tracking of different lo...
MOVING MESSAGE DISPLAY USING ATMEL 89C51 LED moving message diaply using PIC16f628 CD4017 and 74LS595 moving message display using 8051 m...
The use of microcontroller is in every field even we can use it in the design and fabrication of biomedical equipments. A little example is ...
GSM modem interfacing with microcontroller 8051 for SMS control of industrial equipments:- This is a beginner tutorial in which a GSM modem...
This is revised version of heart beat monitor using 8051 heart beat monitor located in this blog ob post. http://microcontroller51.blogspo...
4 The Hardware Description of the Automatic carparking project using microcontroller 8051 4.1 Stepper Motor Control Board This board have ...
The most character LCD module can be interface with micro-controller in any of these two ways of interface: 1. 4-Bit Interface ( a litt...
This is ciruit diagram of interfacing of LCD with microcontroller 8051 family. This project was to measure heart beat and to display on LC...
Three stories Lift or Elevator controller with microcontroller At89c51 In this project, we will learn circuit design for a elevator, how ...
SMS Based Controlling Different Industrial Machines Using GSM Mobile and microcontroller 8051 This project (interfacing mobile phone with m...