×

Interfacing DAC with the 8051 Microcontroller

A wide range of applications calls for microcontrollers, including measuring and controlling physical quantities like temperature, pressure, speed, and distance.

In these systems, the microcontroller creates digital output, but the controlling system only accepts analogue signals, necessitating the usage of DACs, which can translate digital data into a corresponding analogue voltage.

A typical device for converting pulses to analogue signals is the digital to analogue converter (DAC). Analogue signals can be created from digital signals using two different techniques, which are the binary-weighted approach and the R/2R ladder method.

The MC1408 (DAC0808) Digital to Analog Converter will be used in this article. This chip employs the R/2R ladder technique. This approach is capable of far greater precision. By its resolution, DACs are evaluated.

The quantity of binary inputs affects resolution. The most frequent numbers of inputs are 8, 10, 12, etc. The number of information determines the DAC's resolution. As a result, there are 2n analogue levels for every n digital input pins. Two hundred fifty-six(256) distinct voltage levels are available in an 8-input DAC.

The MC1408 DAC (or DAC0808)

The digital inputs are transformed into the current in this chip. By attaching a resistor to the output to change the current into voltage, Iout, the output current is identified. The reference current Iref and the binary integers at DAC0808's input pins D0 through D7, where D0 is the LSB and D7 is the MSB, essentially determine the total current given by the Iout pin. The role of  Iout is demonstrated in the following formula.

Iout =   Iref  (D7/2 +D6/4 +D5/8 +D4/16 +D3/32+D2/64+D1/128+D0/256)

The input current is Iref. Pin 14 must be attached to this. Iref is often used as 2.0 mA.

We attach the Iout pin to the resistor to convert the current to voltage. However, as the input resistance of the load would also influence the output voltage in practice, it can lead to inaccuracies. As a result, the Iref current input is essentially isolated by coupling it to an Op-Amp with a 5K=Rf feedback resistor. You can adjust the feedback resistor's value to suit your needs.

Sine Wave generation with DAC and an 8051 microcontroller

We first need a look-up database to describe the magnitude of the sinusoidal value of an angle between 0° and 360° to generate sine waves. From -1 to +1, the sine function is variable. Only integer values are usable for DAC input in the table. In this example, we'll determine the values from degree to DAC input in steps of 30 degrees. For the DAC output, a full-scale voltage of 10V is assumed. The voltage ranges can be calculated using this formula.

Vout = 5V + (5 ×sinθ)
Angle (in θ )sinθVout (Voltage Magnitude)Values sent to DAC
005128
300.57.5192
600.8669.33238
901.010255
1200.8669.33238
1500.57.5192
18005128
210-0.52.564
240-0.8660.66917
270-1.000
300-0.8660.66917
330-0.52.564
36005128
Interfacing DAC with the 8051 Microcontroller

SOURCE CODE

#include<reg51.h>
sfr DAC = 0x80; //Port P0 address
void main(){
   int sin_value[12] = {128,192,238,255,238,192,128,64,17,0,17,64};
   int i;
   while(1){
      //infinite loop for LED blinking
      for(i = 0; i<12; i++){
         DAC = sin_value[i];
      }
   }
}
Interfacing DAC with the 8051 Microcontroller

Related Topics

Addressing Modes

Introduction: Addressing Modes An instruction consists of two parts opcode and operands. Opcode tells the operation going to perform, and operand information is the address of the operand. The CPU interprets...

8 minutes read.

Bipartite Graph

A graph is said to be bipartite if and only if we can divide all the vertices of a graph into two sets such that these sets are mutually exclusive...

4 minutes read.

Instruction Cycle: Computer Organization and Architecture

What is an effective Address? “Effective address is the address of operand in a computation-type instruction.” Computation type instructions are like ADD, SUB, MOV, OR, AND, etc., which require operand to...

4 minutes read.

Advantages and Disadvantages of Flash Memory

What is Flash Memory? Electrically Erasable Programmable Read-Only Memory (EEPROM) and Erasable Programmable Read-Only Memory (EPROM) are used for flash memory (EEPROM). Although technically the word flash is used in the industry...

3 minutes read.

BCD to 7 Segment Decoder

What is BCD? BCD is called Binary Coded Decimal. As you know there are a lot of forms in which we can represent the number like Binary, decimal, hexadecimal, and octal...

3 minutes read.

8085 instructions set

Introduction: In the computer, the user sends the data. The computer can use data and it also process the data. After the processing, send the result to the user. The specific...

10 minutes read.

Computer Organization and Architecture Data Formats

Data Formats In the digital world, everything is based on digits. In every method, the calculation is processed on the digits, and most importantly, the computer only understands the binary language...

6 minutes read.

Control Signals in 8155 Microprocessor

Intel designed the chip 8155 used to interface with I/O devices. Basically, the 8085 microprocessor is directly unable to deal with its peripheral input output devices for reading data or...

3 minutes read.

Local Broadcast Address and loopback address

In computer networking, if you send the data from one source to another source or group of sources in the form of packets, then this is called casting. We can categorize...

3 minutes read.

Biconnectivity in a Graph

What is a Graph? A graph is a structure where values are stored at the vertex, and the relation between vertices is denoted by edges. In a graph, if there is only...

4 minutes read.

8085 Arithmetic Instructions

Arithmetic instructions are a type of instruction in a computer's instruction set that perform arithmetic operations on data. These operations can include addition, subtraction, multiplication, and division. Arithmetic instructions can...

4 minutes read.

Data Transfer and Manipulation

What is Data Transfer? In computer architecture, data transfer refers to the movement of data between different components within a computer system. These components can include the central processing unit (CPU),...

6 minutes read.

Control Unit Organization

Control Unit Organization The Control Unit is the unit in the CPU, which controls the various components like input  & output devices, logic unit and memory. The Control Unit is the...

7 minutes read.

Basic Terminologies Related to COA

Some Basic Terminologies Related to COA Computer organization and architecture is the detailed study of the internal components of the computer with their functionality. It describes how components arranged together and...

7 minutes read.

8085 Pin Configuration

Introduction: Intel 8085 is consist 40 pin IC. The pin name of 8085 is A8 – A15; AD0 – AD7; ALE; IO/M; S0, S1; RD; WR; READY; HOLD; HLDA; INTR; INTA;...

6 minutes read.

8086 Microprocessor Pin Configurations

8086 microprocessor is invented and developed by Intel in 1976. The 8086 Microprocessor is an enhanced version of the 8085 Microprocessor. There are 20 address lines and 16 data lines...

6 minutes read.

Types of Microprocessors

Introduction:Microprocessor is known as the computer processor. The IC or integrated Circuit makes the microprocessor. That is the brain of the computer machine.  The microprocessor is the Processor or CPU (Central...

3 minutes read.

CPU Registers

CPU Registers Within the CPU, we have small- small storage units called registers. If we are executing a certain program within the CPU, there's a need to store that program content,...

11 minutes read.

Computer Organization and Architecture Tutorial

Introduction to Computer Organization and Architecture In this modern era, or we can say computer era, Technology from all around surrounds us. Human is conserved, connected and absorbed by Technology. From...

4 minutes read.

Digital Number System

Digital Number System: The computer understands digital language only. Many number systems are used in digital technology. The most common are Decimal, Binary, Octal and Hexadecimal number systems. Types of the...

7 minutes read.