89C51單片機與1片ADC0809組成的數(shù)據(jù)采集系統(tǒng)編程實例
在1個由89C51單片機與1片ADC0809組成的數(shù)據(jù)采集系統(tǒng)中,ADC0809的8個輸入通道的地址為7FF8H~7FFFH,試畫出有關接口電路圖,并編寫出每隔1分鐘輪流采集1次8個通道數(shù)據(jù)的程序,共采樣50次,其采樣值存入內(nèi)RAM20H單元開始的存儲區(qū)中。
圖片1
0~7通道地址:fef8h~feffh
ORG000H
LJMPMAIN
ORG0003H
LJMPI_INT0
ORG000BH
LJMPI_T0
ORG050H
MAIN:MOVSP,#60H
SETBIT1
SETBET0
SETBEX1
SETBEA
MOVTMOD,#00000010B
MOVTH0,#06H
MOVTL0,#06H
MOVR4,#240
MOVR5,#250
MOVR7,#8
MOVR6,#50
MOVR0,#20H
SETBTR0
SJMP$
I_T0:DJNZR4,GORET
MOVR4,#240
DJNZR5,GORET
MOVR5,#250
MOVDPTR,#0FEF8H
MOVX@DPTR,A
DECR7
GORET:RETI
I_INT0:MOVXA,@DPTR
MOV@R0,A
INCDPTR
INCR0
MOVX@DPTR,A
DJNZR7,GORETI
MOVR7,#8
DJNZR6,GORETI
CLRTR0
CLREX1
GORETI:RETI