Interfacing of 8051 with DAC

Introduction to DAC


i ref equation

where, Iref=Reference current=2mA
            D7 = MSB bit
            D0=LSB bit

How to convert Iout to voltage in DAC0808?
DAC gives output in the form of cureent, so outside of the DAC current(I) to voltage(V) converter is connected, which is then provided to oscilloscope.

Algorithm And Flowchart

Interfacing Diagram

interfacing 8051 to dac

1DAC interfacing with 8051 microcontroller

Assembly Language Programs

Program: Write an ALP to generate Square wave form on port P1 of 8051 microcontroller using DAC.

square wave generation using dac

Flowchart for Square Wave generation using DAC

Square Wave Generation using DAC

ORG 0000h mov P1,#00H repeat:Acall squarwave sjmp repeat squarwave:mov P1,#FFH Acall delay mov P1,#00H Acall delay ret delay:mov r0,#20 up2:mov r1,#250 up1:mov r2,#250 Here:djnz r2,Here djnz r1,up1 djnz r0,up2 ret END

Program: Write an ALP to generate Triangular wave form on port P1 of 8051 microcontroller using DAC.

triangular wave generation using dac

Flowchart for Tringular Wave Generation using DAC

```
ORG 0000h
mov P1,#00H
repeat:Acall triwave; generate triangular wave
sjmp repeat
triwave:mov A,#00H
INCR:mov P1,A
INC A
CJNE A,#0FFH,INCR                  
DECR:mov P1,A
DEC A
CJNE A,#00H,DECR
ret
END
```

Program: Write an ALP to generate Stair-case wave form (with 5-steps) on port P1 of 8051 microcontroller using DAC.
Solution:- As we need 5-Step staircase waveform.Hence Accumulator can have maximum value of 255 hence to get 5 steps initial value to be added is 51H

```
ORG 0000h
mov P1,#00H
repeat:Acall stair_case_wave; generate staircase wave
sjmp repeat
stair_case_wave:mov A,#00H
mov P1,A
Acall delay
Back:ADD A,#51H
mov P1,A
Acall delay
CJNE A,#0FFH,Back
SJMP stair_case_wave
delay:mov r0,#20
up2:mov r1,#250
up1: mov r2,#250
here:djnz r2,here
djnz r1,up1
djnz r0,up2
ret
END
```

References

  • Interfacing diagram by Jayesh Gopal, WikiNote Volunteer, SKNCOE,Pune
  • Created and developed by Prof. S.M.Wagh, SKNCOE, Pune
  • WikiNote Foundation
  1. ^ Image by Jayesh Gopal, SKNCOE, Pune

Last modified: Wednesday, 18 September 2019, 11:14 AM