我将生成的HEX文件下载到单片机内,LED只显示8888
是时序问题?
INITDS1820: SETB TEMPDIN
TEMPDIN为AT89S51与ds18b20的接口
NOP
NOP
CLR TEMPDIN
MOV R6,#0A0H
DJNZ R6,$
MOV R6,#0A0H
DJNZ R6,$
SETB TEMPDIN
MOV R6,#32H
DJNZ R6,$
MOV R6,#3CH
LOOP1820: MOV C,TEMPDIN
JC INITDS1820OUT
DJNZ R6,LOOP1820
MOV R6,#064H
DJNZ R6,$
SJMP INITDS1820
RET
INITDS1820OUT: SETB TEMPDIN
RET
READDS1820: MOV R7,#08H
SETB TEMPDIN
NOP
NOP
READDS1820LOOP: CLR TEMPDIN
NOP
NOP
NOP
SETB TEMPDIN
MOV R6,#07H
DJNZ R6,$
MOV C,TEMPDIN
MOV R6,#3CH
DJNZ R6,$
RRC A
SETB TEMPDIN
DJNZ R7,READDS1820LOOP
MOV R6,#3CH
DJNZ R6,$
RET
WRITEDS1820: MOV R7,#08H
SETB TEMPDIN
NOP
NOP
WRITEDS1820LOP: CLR TEMPDIN
MOV R6,#07H
DJNZ R6,$
RRC A
MOV TEMPDIN,C
MOV R6,#34H
DJNZ R6,$
SETB TEMPDIN
DJNZ R7,WRITEDS1820LOP
RET
READTEMP: LCALL INITDS1820
MOV A,#0CCH
LCALL WRITEDS1820
MOV R6,#34H
DJNZ R6,$
MOV A,#44H
LCALL WRITEDS1820
MOV R6,#34H
DJNZ R6,$
RET
READTEMP1: LCALL INITDS1820
MOV A,#0CCH
LCALL WRITEDS1820
MOV R6,#34H
DJNZ R6,$
MOV A,#0BEH
LCALL WRITEDS1820
MOV R6,#34H
DJNZ R6,$
MOV R5,#09H
MOV R0,#TEMPHEAD
MOV B,#00H
READTEMP2: LCALL READDS1820
MOV @R0,A
INC R0
READTEMP21:
DJNZ R5,READTEMP2
MOV A,B
JNZ READTEMPOUT
MOV A,TEMPHEAD+0
MOV TEMPL,A
MOV A,TEMPHEAD + 1
MOV TEMPH,A
READTEMPOUT: RET |