課程設(shè)計:單片機da轉(zhuǎn)換
//這里我們采用單緩沖方式,單片機每隔1s鐘分別向DAC0832送出
//3FH,7FH,F0H,0FFH,00H五個個數(shù)據(jù)的輸出電壓循環(huán)發(fā)生變化。
//此程序必須把電路圖設(shè)置好,此DA各引腳都已設(shè)置在在工作狀態(tài)
ORG0000H
AJMPMAIN
ORG0030H
MAIN:
MOVA,#3FH
MOVP0,A
SETBP3.6;WR1下降沿進行轉(zhuǎn)換
CALLDELAY
CLRP3.6
CALLDELAY
MOVA,#7FH
MOVP0,A
SETBP3.6
CALLDELAY
CLRP3.6
CALLDELAY
MOVA,#0F0H
MOVP0,A
SETBP3.6
CALLDELAY
CLRP3.6
CALLDELAY
MOVA,#0FFH
MOVP0,A
SETBP3.6
CALLDELAY
CLRP3.6
CALLDELAY
MOVA,#00H
MOVP0,A
SETBP3.6
CALLDELAY
CLRP3.6
CALLDELAY
AJMPMAIN
DELAY:;延時函數(shù)
MOVR4,#5
L3:MOVR5,#100
L2:MOVR6,#250
DJNZR6,$
NOP
NOP
DJNZR5,L2
DJNZR4,L3
RET
END
評論