Many a times, it is required to receive signals from different sensors and to monitor the related data on a PC. In such cases, an ADC is required to convert analog signals, from the sensors, to digital pattern. Also, this data transfer can be carried out through the serial port, RS232, of the computer. This circuit demonstrates the principle and operation ADC0808 interfacing using serial port via 8051 microcontroller (AT89C51). The circuit is divided into four parts: clock, ADC, controller and serial port. This circuit can be used as an intermediate module in many important applications.
ADC0808 which is an 8-bit resolution ADC has eight analog input pins to take inputs. The circuit uses a preset for providing the analog input. The clock for driving the ADC0808 is taken from the crystal of the . The controller AT89C51 uses a crystal of frequency 11.0592 MHz. As this frequency is too high for the ADC, it is divided using a D flip-flop and then given to the ADC0808. The circuit uses four D flip-flops by employing 74LS74
. It is a 14 pin IC with two internal D flip-flops. The circuit uses two ICs to divide the frequency by 16. The circuit diagram shows the connection of the D flip-flop ICs.
Project Source Code
###// Program to read ADC 0808. The output pins are connected to LED's. external clock is used for driving the ADC 0808. #include<reg51.h> sbit ale=P1^0; //address latch enable sbit oe=P1^3; //output enable sbit sc=P1^1; //start conversion sbit eoc=P1^2; //end of conversion sbit ADD_A=P1^4; // Address pins for selecting input channels. sbit ADD_B=P1^5; sbit ADD_C=P1^6; sfr input_port=0x80; //p0 port void transmit() //serial port transmission { SBUF=input_port; while(TI==0); TI=0; } void delay(unsigned int count) // Function to provide time delay in msec. { int i,j; for(i=0;i<count;i++) for(j=0;j<1275;j++); } void main() { eoc=1; input_port=0xFF; ale=0; oe=0; sc=0; TMOD=0x20; TH1=0xFD; //timer1 setting for serial communication SCON=0x50; TR1=1; while(1) { ADD_C=0; // Selecting input channel 2 using address lines ADD_B=0; ADD_A=1; delay(2); ale=1; delay(2); sc=1; delay(1); ale=0; delay(1); sc=0; while(eoc==1); while(eoc==0); oe=1; transmit(); delay(2); oe=0; } }###
Circuit Diagrams
Circuit-Diagram-Of-Interfacing-ADC0808-With-Serial-Port-RS232-8051-Microcontroller-Using-Clock-From-D-Flip-Flop |
Project Components
Project Video
Filed Under: 8051 Microcontroller
Filed Under: 8051 Microcontroller
Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.