使用DAC接口生成三角波

我们编写了一个8085汇编语言程序,用于使用数模转换器(DAC)接口生成三角波。在CRO上可以看到波形的显示。

让我们考虑这个领域的问题解决方案。问题指出:为了获得单极性输出,J1在接口上短接到J2。要在CRO上显示波形,请将连接器P1的引脚1连接到CRO信号引脚,并将连接器P1的引脚2连接到CRO接地引脚。

程序

; 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