PORT6==6
RF==0XF
IOC60==0X6
ADDATA==0XA
ADCON==0X9
ADCMPCON==0XA
GCON==0X9
ADRUN==0X4
ADPD==0X3
ADIF==0X3
STATUS==0X03
C==0
ORG 0
MOV A,@0X11
IOW 0XE
MOV A,@0B000000000
IOW 0X6
MOV A,@88
MOV 0X10,A
LOOP:
MOV A,@0B00001000
MOV 6,A
CALL DELAY2
MOV A,@0B00000000
MOV 6,A
CALL DELAY2
DJZ 0X10
JMP LOOP
MOV A,@0B10001000
MOV 6,A
CALL DELAY2
START:
MOV A,@0B00000001
IOW 0X6
MOV A,@0B00000010
IOW ADCMPCON
MOV A,@0B00000000
IOW ADCON
MOV A,@0B01000000
IOW GCON
CLR ADDATA
MAIN:
NOP
NOP
NOP
CLR 6 (我这个程序编写得有错吗?为什么程序执行
BC RF,ADIF CLR 6这一步就停止了!
BS ADCON,ADPD
BS ADCON,ADRUN
CALL DELAY2
CALL DELAY2
LOOP1:
JBS RF,ADIF
JMP LOOP1
LOOP2:
JBC ADCON, ADRUN
JMP LOOP2
MOV A,@0B01001100
MOV 0X11,A
MOV A,@0B00110011
MOV 0X12,A
MOV A,@0B00011111
MOV 0X13,A
MOV A,0X11
SUB A,ADDATA
JBC STATUS,C
JMP LOOP3
MOV A,0X12
SUB A,ADDATA
JBC STATUS,C
JMP LOOP4
MOV A,0X13
SUB A,ADDATA
JBC STATUS,C
JMP LOOP5
JMP LOOP6
LOOP3:
MOV A,@0B00001000
MOV 6,A
CALL DELAY2
JMP MAIN
LOOP4:
MOV A,@0B10001100
MOV 6,A
CALL DELAY2
CALL DELAY2
CALL DELAY2
MOV A,@0B00001100
MOV 6,A
CALL DELAY2
CALL DELAY2
CALL DELAY2
JMP MAIN
LOOP5:
MOV A,@0B10001100
MOV 6,A
CALL DELAY2
CALL DELAY2
MOV A,@0B00001100
MOV 6,A
CALL DELAY2
CALL DELAY2
JMP MAIN
LOOP6:
MOV A,@0B10001100
MOV 6,A
CALL DELAY2
MOV A,@0B00001100
MOV 6,A
CALL DELAY2
JMP MAIN
DELAY2:
MOV A,@64
MOV 0X14,A
LOOP7:
MOV A,@48
MOV 0X15,A
LOOP8:
MOV A,@100
MOV 0X16,A
LOOP9:
DJZ 0X16
JMP LOOP9
DJZ 0X15
JMP LOOP8
DJZ 0X14
JMP LOOP7
RET