利用 DAC 接口生成方波
我们编写一个使用数字模拟转换器 (DAC) 接口生成矩形波干扰的程序
让我们考虑该领域的某个问题解决方案。该问题说明:为了获得单极性输出,在接口上讲 J1 短路到 J2。为了在 CRO 上显示波形,将连接器 P1 的引脚 1 连接到 CRO 信号引脚,将连接器 P1 的引脚 2 连接到 CRO 接地引脚。
程序如下所示。
; FILE NAME DAC_TO_RECT.ASM ORG C100H X DW 00FFH ; ‘OFF’ time is proportional to this value Y DW 00C0H ; ‘ON’ time is proportional to this value ORG C000H PA EQU D8H PB EQU D9H PC EQU DAH CTRL EQU DBH MVI A, 88H OUT CTRL ; Configure 8255 ports LOOP: LHLD Y XCHG LHLD X ; Now DE contains 00C0H and HL contains 00FFH MVI A, 00H OUT PA ; Sending 00H to DAC through the Port A CALL DELAY ; Generation of delay proportional to the contents of HL. XCHG ; Now HL contains 00C0H MVI A, FFH OUT PA ; Sending the FFH to Digital to Analog Converter through Port A CALL DELAY ; Generation of delay proportional to the contents of HL JMP LOOP ; Subroutine to generate a delay proportional to contents of HL DELAY: DCX H MOV A, H ORA L JNZ DELAY RET
广告