# Generation of triangular wave using DAC interface

MicroprocessorMicrocontroller8085

We write an 8085 assembly language program for the generation of triangular waveform using the Digital to Analog Converter (DAC) interface. The display of the waveform is seen on the CRO.

Let us consider a problem solution in this domain. The problem states that: To get unipolar output, J1 is shorted to J2 on the interface. To display the waveform on a CRO, connect pin 1 of connector P1 to CRO signal pin, and pin 2 of connector P1 to CRO ground pin.

## Program

; FILE NAME DAC_TO_TRIANG.ASM
ORG C100H
X DW 00FFH ; the fall of rise and time I proportional directly to the value.

ORG C000H
PA EQU D8H
PB EQU D9H
PC EQU DAH
CTRL EQU DBH

MVI A, 88H
OUT CTRL ; Purpose to configure 8255 ports
; The next 7 instructions will generate rising portion of the triangular waveform.
; And it is done by sending to DAC through Port A values from 00H to FFH,
; in steps of 01. Also the increment will be done after a small time delay here.

LOOP: MVI A, 00H
ASCEND: OUT PA
PUSH PSW
CALL DELAY

POP PSW
INR A
JNZ ASCEND

DCR A ; Now A contents will be FFH

DESCEND: OUT PA
PUSH PSW

CALL DELAY

POP PSW
DCR A
CPI FFH
JNZ DESCEND

JMP LOOP
; These Subroutines are used only for the generation of delay
; which is proportional to all the contents of word located at X.

DELAY: LHLD X
AGAIN: DCX H
MOV A, H
ORA L
JNZ AGAIN
RET


Updated on 30-Jul-2019 22:30:25