使用 DAC 接口生成三角波


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

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

程序

; 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

更新于:2019-07-30

6K+ 浏览量

开启你的职业生涯

完成课程以获得认证

开始学习
广告