https://github.com/gmostofabd/8051-analog
๐ This repository guides you through reading an analog value from a potentiometer using the 8051 Microcontroller. As our controller does not have internal ADC, we need to convert the analog voltage to its binary equivalent externally. Next, we will connect the binary port to our 8051 microcontroller digital input pins.
https://github.com/gmostofabd/8051-analog
8051 ad0804 analog analogtodigital assembly bbargrapg binary circuit converter led microcontroller potentiometer programming proteus simulation
Last synced: 21 days ago
JSON representation
๐ This repository guides you through reading an analog value from a potentiometer using the 8051 Microcontroller. As our controller does not have internal ADC, we need to convert the analog voltage to its binary equivalent externally. Next, we will connect the binary port to our 8051 microcontroller digital input pins.
- Host: GitHub
- URL: https://github.com/gmostofabd/8051-analog
- Owner: gmostofabd
- Created: 2021-05-24T12:59:33.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-10-01T15:33:20.000Z (over 1 year ago)
- Last Synced: 2025-12-26T07:48:05.219Z (6 months ago)
- Topics: 8051, ad0804, analog, analogtodigital, assembly, bbargrapg, binary, circuit, converter, led, microcontroller, potentiometer, programming, proteus, simulation
- Language: HTML
- Homepage: https://gmostofabd.github.io/8051-Analog/
- Size: 958 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐ **Analog Input with the 8051 Microcontroller**
The **8051 microcontroller** lacks built-in **ADC (Analog-to-Digital Converter)** functionality, which limits its ability to handle analog signals directly. However, by integrating an external ADC like the **[ADC0804](https://www.ti.com/product/ADC0804)**, we can enable the 8051 to read analog signals from various sources, such as sensors or potentiometers, and convert them into digital values for processing.
## ๐ **Repository Overview**
This repository demonstrates how to read an analog value from a **potentiometer** using the **8051 Microcontroller**. The process involves converting the analog voltage to its binary equivalent and displaying it on an **8-bit LED bar graph**. Additionally, the analog readings will be shown on an **LCD** for enhanced visualization.
---
## ๐ **Keywords**
**[AD0804](https://www.analog.com/en/products/ad0804.html)** |
**[8051 Microcontroller](https://www.atmel.com/products/microcontrollers/8051.aspx)** |
**[Analog-to-Digital Converter](https://en.wikipedia.org/wiki/Analog-to-digital_converter)** |
**[Assembly Language](https://en.wikipedia.org/wiki/Assembly_language)** |
**[Microcontroller Programming](https://en.wikipedia.org/wiki/Microcontroller)**
---
## ๐ **Features of this Repository**
| Feature | Description |
|-----------------------------------|---------------------------------------------------------------------------------|
| ๐๏ธ **Analog Input** | Reads voltage from a potentiometer and converts it to a digital value |
| ๐ก **LED Bar Graph Display** | Displays the binary equivalent on an 8-bit LED bar graph |
| ๐ฅ๏ธ **LCD Display** | Shows the analog reading in real-time on an LCD |
| ๐ง **Microcontroller Programming** | Written in **Assembly language** for the AT89C51 |
| ๐ **Hardware Integration** | Designed for seamless integration with physical components |
---
## ๐ฆ **Contents**
| File | Description |
|-------------------------------|-----------------------------------------------------------------------------|
| `AD0804_Analog_Reading.asm` | Assembly source code for reading analog values using AD0804 |
| `AD0804_Analog_Reading.hex` | Precompiled HEX file for direct microcontroller upload |
| `Proteus_Simulation.pdsprj` | Proteus Design Suite simulation file |
| **Screenshots** | Demonstrations from the Proteus simulation |
---
# ๐ **AD0804 Analog-to-Digital Converter**
The AD0804 ADC is a reliable and efficient choice for converting analog signals to digital form. Its simplicity and low power requirements make it ideal for a wide range of applications, from data acquisition systems to embedded solutions.
### Basic Circuit Diagram:
## ๐ ๏ธ **AD0804 Key Features:**
| Feature | Description |
|-----------------------------|-------------------------------------------------------------------------|
| ๐ข **8-Bit Resolution** | Converts analog signals to 256 discrete digital levels. |
| โก **Single-Supply Operation** | Works on a simple +5V supply for ease of use. |
| โฑ๏ธ **Fast Sampling Rate** | Supports up to 10 kHz for moderate-speed applications. |
| ๐ **Wide Input Voltage Range** | Typically 0V to V_REF for versatile applications. |
| ๐ **Internal Reference Voltage** | Reduces external components for simpler designs. |
| ๐ป **Easy Digital Interface** | Parallel output makes it simple to connect with microcontrollers. |
| ๐ก **Low Power Consumption** | Ideal for portable and battery-operated devices. |
---
## ๐ **AD0804 Pin Description**
| Pin Number | Pin Name | Description |
|------------|------------|---------------------------------------------|
| 1 | V_ref | Reference voltage input |
| 2 | GND | Ground connection |
| 3 | Vin | Analog input voltage from potentiometer |
| 4 | D0-D7 | Data output lines (8-bit) |
| 5 | CS | Chip select |
| 6 | RD | Read control |
| 7 | WR | Write control |
| 8 | ALE | Address latch enable |
| 9 | INTR | Interrupt output for conversion completion |
---
### **Understanding ADC0804**
**ADC0804** is an **8-bit ADC** capable of measuring up to **8 analog inputs** simultaneously, translating analog values into digital outputs ranging from 0 to 255. Utilizing a successive approximation converter based on a differential potentiometric ladder, the ADC0804 effectively translates continuous analog signals into discrete digital values.
**Why Use an ADC?**
Analog signals represent real-world phenomena but need conversion into a format that microcontrollers can process. Electronic devices operate primarily in the **frequency domain**, making ADCs crucial for translating these continuous signals into a digital format that can be interpreted by microprocessors.
### **Key Features of ADC0804**:
- **Low Voltage Operation**: Works with 0-5 Volts.
- **Conversion Speed**: Maximum speed of **110 ยตs**, regardless of internal or external clock use.
- **Single Analog Input**: Converts a single analog signal into an 8-bit digital output.
### **Internal Circuit of ADC0804**
The internal circuitry of **ADC0804** is sophisticated, utilizing components like gates, flip-flops, shift registers, and a SAR latch. The **SAR (Successive Approximation Register)** latch converts continuous analog signals into discrete digital signals by performing binary searches across quantization levels. The integrated tri-state register holds data until a low-to-high pulse is applied, while an **8-bit shift register** sequentially outputs data in 8-bit formats.
---
### **Example Circuit in Proteus**
To visualize the ADC0804 in action, follow these steps to build the example circuit in **Proteus**:
1. Connect a variable voltage source to the **analog input** pins.
2. Use logic states for controlling and visualizing the output.
3. Attach a logic state changer to the **INT** and **WR** pins.
4. Connect logic viewers to the output pins of the ADC0804.
5. Ensure the ground for analog and digital components is shared.
6. Input voltage must not exceed **6.5 Volts** (real-life constraints).
The complete circuit will resemble the provided example, allowing you to convert voltage into a digital value efficiently.
## ๐ ๏ธ **Hardware & Circuit Information**
| Hardware Component | Description |
|---------------------------------|-----------------------------------------------------------------------------|
| **AD0804 ADC** | Converts the analog signal from the potentiometer into a digital signal |
| **8051 Microcontroller** | Core of the project, controlling the analog reading and output |
| **Potentiometer** | Adjustable resistor to provide varying voltage input |
| **LED Bar Graph** | Displays the digital output from the ADC in a visual format |
| **LCD** | Provides a digital readout of the analog value |
| **Power Supply** | A 5V DC power supply for the microcontroller and peripherals |
### **Circuit Explanation**:
The **AD0804** ADC reads the voltage from the potentiometer and converts it into an 8-bit digital signal. This signal is then displayed on the LED bar graph, giving a visual representation of the voltage level. The same value is sent to the LCD for a numerical readout.
---
## ๐ **Additional Information**
### **Potentiometer Functionality**:
The potentiometer's position determines the voltage supplied to the ADC, affecting the readings displayed on both the LED bar graph and the LCD.
---
## ๐ค **Contributing**
We welcome contributions! Feel free to submit pull requests or open issues for any bug fixes, feature enhancements, or optimizations to the assembly code.
---
## ๐ง **Contact**
For any inquiries or assistance, reach out at [mostofa.melab@gmail.com](mailto:mostofa.melab@gmail.com).
---
If you found this project helpful, give it a โญ on GitHub!