Description: The ADC (Analog to Digital Converter) is a crucial component in numerous embedded projects. This article focuses on interfacing an ADC with the 8051 embedded controller. The ADC0804 model is utilized, and before detailing the interfacing procedure, it is essential to understand the operational principles of the ADC0804. The ADC0804 is an 8-bit successive approximation analog-to-digital converter produced by National Semiconductor. Key features of the ADC0804 include differential analog voltage inputs, a 0-5V input voltage range, no zero adjustment, an integrated clock generator, and externally adjustable reference voltage to convert smaller analog voltage spans to 8-bit resolution. The pinout diagram of the ADC0804 is provided. The voltage at Vref/2 (pin 9) can be adjusted externally to convert smaller input voltage spans to full 8-bit resolution. Leaving Vref/2 (pin 9) open results in an input voltage span of 0-5V with a step size of 5/255 = 19.6 mV. The accompanying table illustrates various Vref/2 voltages and their corresponding analog input voltage spans. The schematic for interfacing the ADC0804 with the 8051 microcontroller is also depicted. The circuit initializes the ADC to convert a given analog input and subsequently accepts the corresponding digital data, displaying it on an LED array connected to port P0. For instance, if the analog input voltage Vin is 5V, all LEDs will illuminate, indicating a binary output of 11111111, equivalent to 255 in decimal. The AT89S51 microcontroller is employed in this setup. The data output pins (D0 to D7) of the ADC0804 are connected to the port pins P1.0 to P1.7, respectively, while LEDs D1 to D8 are linked to port pins P0.0 to P0.7. Current limiting resistors R1 to R8 are incorporated. In this configuration, P1 of the microcontroller serves as the input port and P0 as the output port. Control signals for the ADC (INTR, WR, RD, and CS) are routed through port pins P3.4 to P3.7. Resistor R9 and capacitor C1 are associated with the internal clock circuitry of the ADC, while a preset resistor R10 forms a voltage divider for applying a specific input analog voltage to the ADC. The push button S1, resistor R11, and capacitor C4 create a debouncing reset mechanism. The crystal X1 and capacitors C2 and C3 are part of the clock circuitry for the microcontroller. The assembly language code initializes port P1 as the input port and controls the ADC operations and data output.
The ADC0804, designed for 8-bit resolution, functions through a successive approximation method, allowing it to convert analog signals into digital data effectively. The device's differential analog voltage inputs enhance its versatility in various applications. The integrated clock generator simplifies the setup by eliminating the need for external clock sources, while the adjustable reference voltage enables fine-tuning of the input range, accommodating different sensor outputs.
In the interfacing schematic, the microcontroller AT89S51 communicates with the ADC0804 through specific pins designated for data input and control signals. The LEDs connected to port P0 provide a visual representation of the digital output, where each LED corresponds to a bit in the 8-bit output. The use of current-limiting resistors ensures that the LEDs operate within safe current levels, preventing damage.
The control signals are vital for managing the ADC's operation. The INTR signal indicates when the conversion is complete, while the WR and RD signals control the writing and reading of data, respectively. The implementation of a reset mechanism using a push button and a debouncing circuit ensures reliable operation by preventing false triggering.
The assembly code snippet provided illustrates the initialization and operation sequence for the ADC0804. It configures the microcontroller's ports, initiates the ADC conversion, and reads the resulting digital data to display it on the LED array. The use of the CPL instruction complements the data to provide a straightforward display output, enhancing user readability.
Overall, the ADC0804's integration with the 8051 microcontroller exemplifies a typical embedded system application, demonstrating the conversion of analog signals to digital data and the subsequent display of this data in a user-friendly format.ADC (Analogto digital converter) forms a very essential part in many embedded projects and this article is about interfacing an ADC to 8051 embedded controller. ADC 0804 is the ADC used here and before going through the interfacing procedure, we must neatly understand how the ADC 0804 works.
ADC0804 is an 8 bit successive approximation analogue to digital converter from National semiconductors. The features of ADC0804 are differential analogue voltage inputs, 0-5V input voltage range, no zero adjustment, built in clock generator, reference voltage can be externally adjusted to convert smaller analogue voltage span to 8 bit resolution etc. The pin out diagram of ADC0804 is shown in the figure below. The voltage at Vref/2 (pin9) of ADC0804 can be externally adjusted to convert smaller input voltage spans to full 8 bit resolution.
Vref/2 (pin9) left open means input voltage span is 0-5V and step size is 5/255=19. 6V. Have a look at the table below for different Vref/2 voltages and corresponding analogue input voltage spans. The figure above shows the schematic for interfacing ADC0804 to 8051. The circuit initiates the ADC to convert a given analogue input, then accepts the corresponding digital data and displays it on the LED array connected at P0.
For example, if the analogue input voltage Vin is 5V then all LEDs will glow indicating 11111111 in binary which is the equivalent of 255 in decimal. AT89s51 is the microcontroller used here. Data out pins (D0 to D7) of the ADC0804 are connected to the port pins P1. 0 to P1. 7 respectively. LEDs D1 to D8 are connected to the port pins P0. 0 to P0. 7 respectively. Resistors R1 to R8 are current limiting resistors. In simple words P1 of the microcontroller is the input port and P0 is the output port. Control signals for the ADC (INTR, WR, RD and CS) are available at port pins P3. 4 to P3. 7 respectively. Resistor R9 and capacitor C1 are associated with the internal clock circuitry of the ADC. Preset resistor R10 forms a voltage divider which can be used to apply a particular input analogue voltage to the ADC.
Push button S1, resistor R11 and capacitor C4 forms a debouncing reset mechanism. Crystal X1 and capacitors C2, C3 are associated with the clock circuitry of the microcontroller. ORG 00H MOV P1, #11111111B // initiates P1 as the input port MAIN: CLR P3. 7 // makes CS=0 SETB P3. 6 // makes RD high CLR P3. 5 // makes WR low SETB P3. 5 // low to high pulse to WR for starting conversion WAIT: JB P3. 4, WAIT // polls until INTR=0 CLR P3. 7 // ensures CS=0 CLR P3. 6 // high to low pulse to RD for reading the data from ADC MOV A, P1 // moves the digital data to accumulator CPL A // complements the digital data (*see the notes) MOV P0, A // outputs the data to P0 for the LEDs SJMP MAIN // jumps back to the MAIN program END ADC 0804 has active low outputs and the instruction CPL A complements it t0 have a straight forward display. For example, if input is 5V then the output will be 11111111 and if CPL A was not used it would have been 00000000 which is rather awkward to see.
A Microchip PIC12C508 8-pin CMOS microcontroller controls a night light, turning it on and off at preset times every day. It is designed to save energy, produce no electromagnetic interference (EMI), and operate without batteries, featuring a built-in lamp fixture...
The driving circuit depicted in Figure 18-12 consists of a connection between the driving portion, the microcontroller, and the air conditioning operation components of the bridge. The microcontroller's digital signal levels from ports P4.0 to P4.3 (approximately 12 feet) and...
This interface session involves connecting the MCP3202 ADC with the 8051 microcontroller. The MCP3202 is a 12-bit SPI protocol ADC interfaced with the P89V51RD2 microcontroller, which supports SPI protocol, eliminating concerns about SDI, SDO, and SCK connections. The MCP3202 is...
A small transmitter board interfaces with a microcontroller and conductivity probe to measure liquid conductance and conductivity. Precise equations and measurements are provided for this microcontroller-controlled conductivity meter.
The described circuit consists of a compact transmitter board that serves as an...
The difference between these two ICs. A microcontroller is a specialized type of microprocessor designed to be self-sufficient and cost-effective, while a microprocessor is typically intended for general-purpose use, such as in personal computers (PCs). The microcontroller integrates several useful...
This hardware-software combination removes clocks from the slave until both integrated circuits synchronize. The firmware loop causes each circuit to generate a write (WR) signal once per loop. The circuit employs an exclusive-OR operation on the two WR signals to...
This project was designed to introduce a friend to microcontrollers and circuits using various functionalities and spare parts. A PS2 numpad was utilized as the key entry mechanism, which was found at a thrift store and included the necessary connector....
Upon entering the password, the application, in this case "LED," will illuminate. In this digital locking system project, the interfacing of a keypad and a 16x2 LCD with a microcontroller will be explored, along with the accompanying code. This project...
A water level controller based on the 8051 microcontroller is presented in this article. While numerous water level controller projects have been published on this website, this is the first one utilizing a microcontroller. The water level controller monitors the...
We use cookies to enhance your experience, analyze traffic, and (if you allow) serve personalized ads.
By clicking Accept All, you agree to our use of cookies.
Learn more