×

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

Assembly Language Register

Assembly Language Register Assembly language was introduced during the late 1940s in the second generation. It is a low-level language that helps in communication between the user and the computer. It...

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.

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.

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.

CarryLook Ahead Adder

What is Adder? Adder is the combinational circuit that is used to add the bits in digital electronics. As we know, in the digital system, every number is represented in the...

4 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.

Data Path, ALU and Control Unit

Data Path, ALU(Arithmetic Logic Unit) and Control Unit What is the Data path? Suppose any data processing operation should be performed in the CPU like transferring the content of register from one...

5 minutes read.

Flag Register of 8086 Microprocessor

In this article, we are going to study about the one of the registers named flag registers of 8086 microprocessor. We are also going to know where and how to...

3 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.

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.

Instruction Pipelining and Pipeline Hazards

Instruction Pipelining and Pipeline Hazards To apply pipeline, the prerequisite is to perform the same processing over multiple inputs, then pipelining is important. So instruction execution is the best example for...

10 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.

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.

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.

Microprocessor classification

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 known as the...

6 minutes read.

Machine Instructions

What is a Digital Computer? A computer that takes input in a binary form and produces output in binary form. The question arises of what kind of input the computer takes...

4 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.

Pipelining: Computer Organization and Architecture

Introduction to Pipelining Before learning pipeline, we have to understand about the Parallel processing. Parallel processing is the processing of data simultaneously. There are three techniques of parallel processing. Types of Processing: Vector ProcessingArray...

7 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.

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...

2 minutes read.