利用 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

更新於: 30-7-2019

584 個瀏覽

開啟你的 職業

完成課程以獲得認證

開始
廣告