9. To interface DAC with 8085 to demonstrate the generation of square, saw tooth and triangular wave.

 ORG 0000h  ; Starting address of the program


; Initialize the DAC

MOV A, 11000000b  ; Load control word for DAC into A (enable DAC output, output buffer normal, VREF = VCC)

OUT 80h          ; Send control word to DAC


; Generate square wave

MOV A, 00000000b  ; Load low byte of square wave amplitude into A

OUT 81h          ; Send A to DAC

MOV A, 11111111b  ; Load high byte of square wave amplitude into A

OUT 81h          ; Send A to DAC

MOV A, 00000000b  ; Load low byte of square wave amplitude into A

OUT 81h          ; Send A to DAC

MOV A, 11111111b  ; Load high byte of square wave amplitude into A

OUT 81h          ; Send A to DAC

; Repeat the above four OUT instructions to generate more square waves


; Generate sawtooth wave

MOV A, 00000000b  ; Load low byte of sawtooth wave amplitude into A

OUT 81h          ; Send A to DAC

MOV A, 00000001b  ; Increment A to generate sawtooth wave

OUT 81h          ; Send A to DAC

; Repeat the above two OUT instructions to generate more sawtooth waves


; Generate triangular wave

MOV A, 00000000b  ; Load low byte of triangular wave amplitude into A

OUT 81h          ; Send A to DAC

MOV A, 00000001b  ; Load increment value into A for generating triangular wave

MOV B, 00111110b  ; Load the number of steps to generate the triangular wave

LOOP:

    OUT 81h      ; Send A to DAC

    ADD A, B     ; Increment A by B

    DJNZ LOOP    ; Decrement B and loop until it becomes zero

; End of program