Вы находитесь на странице: 1из 4

Experiment no :- 6

Aim:- Interfacing DAC with 8051

Apparatus:- keiluvision5 software

Theory:-
To generate square wave:
DAC 0809 is an 8 – bit DAC and the output voltage variation is between – 5V and +5V.The
output voltage varies in steps of 10/256 = 0.04 (appx.). The digital data input and the
corresponding output voltages are presented in the Table below
INPUT DATA IN HEX OUTPUT DATA IN VOLTAGE
00 -5.00
01 -4.96
02 -4.92
7F 00
FD 4.92
FE 4.96
FF 5.00

TABLE 1
Referring to Table1, with 00 H as input to DAC, the analog output is – 5V. Similarly, With
FF H as input, the output is +5V. Outputting digital data 00 and FF at regular intervals, to
DAC, results in different wave forms namely square, triangular, etc,

Two methods of creating a DAC: binary weighted and R/2R ladder. The vast majority of
integrated circuit DACs, including the MC1408 (DAC 0809) used in this section use the
R/2R method since it can achieve a much higher degree of precision. The first criterion for
judging a DAC is its resolution, which is a function of the number of binary inputs. The
common ones are 8, 10, and 12 bits. The number of data bit inputs decides the resolution of
the DAC since the number of analog output levels is equal to 2n, where n is the number of
data bit inputs. Therefore, an 8-input DAC.
Such as the DAC 0809 provides 256 discrete voltage (or current) levels of output. Similarly,
the 12-bit DAC provides 4096 discrete voltage levels. There are also 16-bit DACs, but they
are more expensive.

(a) Square Wave Generation


1. Move the port address of DAC to DPTR.
2. Load the initial value (00) to Accumulator and move it to DAC.
3. Call the delay program.
4. Load the final value (FF) to accumulator and move it to DAC.
5. Call the delay program.
6. Repeat the steps 2 to 5.
CODE:-

MOV DPTR, # 2023; Control register of 8255.


MOV A, #80; 8255 in I/O mode operation
MOVX @DPTR, A
MOV DPTR, # 2021 (port B address of DAC start)
START: MOV A, #00H
MOVX @DPTR, A
LCALL DELAY
MOV A, #FFH
MOVX @DPTR, A
LCALL DELAY
SJMP START
DELAY: MOV R1, #05H
LOOP: MOV R2, #FFH
HERE: DJNZ R2, HERE
DJNZ R1, LOOP
RET
END

Expected output:-

Вам также может понравиться