Microprocessors and Microcontrollers: Unit IV: (f) A/D and D/A Converter Interfacing with 8085

Interfacing DAC 1408/0808 with Microprocessor using 8255

A/D and D/A Converter Interfacing with 8085

Fig. 13.3.1 shows the interfacing of DAC 0808 with microprocessor 8085. Here, programmable peripheral interface, 8255 is used as parallel port to send the digital data to DAC.

Interfacing DAC 1408/0808 with Microprocessor using 8255

AU : Dec.-07, 11, May-10,11

Fig. 13.3.1 shows the interfacing of DAC 0808 with microprocessor 8085. Here, programmable peripheral interface, 8255 is used as parallel port to send the digital data to DAC.


I/O Map for 8255


Program :

MVI A, 80H ; Initialization control word for 8255 to

OUT 03 ; Configure all ports as output ports

MVI A, data ; Load 8-bit data to be sent at the input of 0808 DAC

OUT 00 ; Send data on port A.

We now see how different waveforms can be generated using this circuit.

 

Example 13.3.1 Generate square wave using DAC 0808.

Solution : To generate square wave first we have to output FF and then 00 an Port A of 8255. The output of 8255 (Port A) connected to DAC 0808. According to frequency requirement delay is provided in between the two outputs.

Program

LXI SP, 27FFH ; Initialize Stack Pointer

MVI A, 80H ; Initialize 8255 to configure all

OUT 03; ports as output ports

LOOP : MVI A, 00 ; Load A with digital data corresponds to - 2.5 V output

OUT 00 ; Send digital data to the input of DAC 0808

CALL DELAY ; Wait for specified time.

MVI A, FF ; Load A with digital data corresponds to + 2.5 V output

OUT 00 ; Send digital data to the input of DAC 0808.

CALL DELAY ; Wait for specified time

JMP LOOP ; Repeat

Delay Program

DELAY : MVI B,08 ; Load delay in register

BACK : DCR B ; Decrement count

JNZ BACK ; Check if count = 0 otherwise repeat

RET

 

Example 13.3.2 Generate triangular wave using DAC0808.

Solution : To generate triangular wave we have to output data from 00 initially, and it should be incremented upto FF. When it reaches FF it should be decremented upto 00.

LXI SP, 27FFH ; Initialize Stack Pointer

MVI A, 80H ; Initialize 8255 to configure all ports as output ports

OUT 03     

MVI A, 00 ; Load accumulator with digital data corresponds to - 2.5 V

; output

OUT 00 ; Send digital to the input of DAC 0808.

LOOP_1: INR A ; Increment digital data in the accumulator

OUT 00 ; Send digital data to the input of DAC 0808.

CPI FF ; Check digital data for Peak output

JNZ LOOP_1 ; If no repeat,

LOOP 2: DCR A ; Decrement digital data in the accumulator

OUT 00 ; Send digital data to the input of DAC 0808.

JNZ LOOP 2

JMP LOOP 1       

 

Example 13.3.3 Generate sine wave using DAC 0808.

Solution : To generate sine wave we have to output digital equivalent values which will represent sine wave as shown in the Fig. 14.3.2. Digital data OOH represents - 2.5 V. 7FH represents 0 V and FFH represents + 2.5 V.


The digital equivalent for sine wave can be calculated as follows.

We know that sin 0° = 0 and sin 90° = 1. The range sin 0° to sin 90° is distributed over digital range of 7FH to FFH i.e. (FFH - 7FH) 128 decimal steps. Therefore, taking 128 as a offset we can write,

Digital equivalent value (DEV) for sin 0 = (128 + 128 × sin θ)

where θ is a angle in degrees and digital value is in decimal.

Lookup table shows the digital equivalent values for sine wave.


Program :

LXI SP, 27FFH ; Initialize Stack Pointer

MVI A, 80H ; Initialize 8255 to configure all

OUT 03H ; Ports as output ports

START : MVI C, 25H ; Initialize counter

LXI H, Lookup table ; Initialize HL pointer to point to lookup table

BACK : MOV A, M ; Get the digital equivalent data from lookup table

OUT 00 ; Send digital data to DAC

INX H ; Increment lookup table pointer

DCR C ; Decrement counter

JNZ BACK ; If not zero, go to BACK

JMP START ; Repeat

Review Questions

1. Explain the interfacing of D/A converter with microprocessor.

2. Interface an 8-bit DAC with 8085 microprocessor using 8255 and write assembly language programs to generate square wave of 1 kHz and triangular wave of 100 Hz. The crystal frequency connected to 8085 is 6 MHz. AU : Dec.-07, Marks 16

3. With neat sketches, Explain the interfacing of D/A converter with 8085 Microprocessor.

AU : May-10,11, Dec.-11, Marks 8

Microprocessors and Microcontrollers: Unit IV: (f) A/D and D/A Converter Interfacing with 8085 : Tag: : A/D and D/A Converter Interfacing with 8085 - Interfacing DAC 1408/0808 with Microprocessor using 8255