jingdong_log@ho 该用户已被删除
|
求教!!!
紧急求教!!
用ADUC812编写多通道程序,利用P2.0作EXC 触发,多次调试未成功,求助修改!!附程序.
ADCCON1 EQU 0EFH
ADCCON2 EQU 0D8H
ADCDATAL EQU 0D9H
ADCDATAH EQU 0DAH
CHAN EQU 04H
EADC EQU 0AEH
DACCON EQU 0FDH
DAC0H EQU 0FAH
DAC0L EQU 0F9H
ADCI EQU 0DFH
ADCCON3 EQU 0DFH
ADC_FLAG EQU 00H
SCONV EQU 0DCH
;-----------------------------------------------------
;利用P2.0 作为EXC 触发
ORG 00H
JMP START
ORG 0BH
JMP TT0
ORG 0033H
JMP ADCONVER
ORG 100H
START: MOV DACCON,#01FH
MOV SP,#60H
MOV R0,30H
MOV R1,40H
CALL TIMER0
CALL AD_INIT
SETB EA
SETB EADC
TT: ;JB ADC_FLAG,$
MOV DAC0L,@R0
MOV A,@R1
ANL A,#0FH
MOV DAC0H,A
JMP TT
ADCONVER: MOV A,ADCDATAL
MOV @R0,A
MOV A,ADCDATAH
MOV @R1,A
SETB ADC_FLAG
JP: RETI
AD_INIT: MOV ADCCON1,#6Dh ; power up ADC & enable EXC mode
MOV ADCCON2,#CHAN ; select channel to convert
ORL ADCCON2,#10H
RETI
TIMER0: MOV TH0,#0FFH
MOV TL0,#0EEH
MOV TMOD,#01H
SETB EA
SETB ET0
SETB TR0
RETI
TT0: SETB SCONV
MOV TH0,#0FFH
MOV TL0,#0EEH
CLR P2.0
T0_ADC: JB ADC_FLAG,ADC_END
INC R0
INC R1
INC CHAN
MOV A,CHAN
CJNE A,#08H,ADC_END
MOV CHAN,#04
MOV R0,30H
MOV R1,40H
SETB ADC_FLAG
ADC_END: RETI
END
请回复 JINGDONG_LOG@HOTMAIL.COM
万分感激!!! |
|