本帖最后由 我就是木木 于 2014-7-30 13:06 编辑
编写的汇编代码发送不了数据。老是在应答非,谁帮我看看。注释乱码了,附件内有源代码和
电路。
SDA EQU P1.7
SCL EQU P1.2
ORG 00H
AJMP MAIN
MAIN:
ACALL STAR
tiIC
MOV A,#0A0H ;Æ÷¼þдµØÖ·
ACALL WRITEIIC
MOV A,#00H ;×ÖµØÖ·
ACALL WRITEIIC
MOV A,#0FH ;Êý¾Ý
ACALL WRITEIIC
ACALL STOPIIC
ACALL STARTIIC
MOV A,#0A0H ;Æ÷¼þдµØÖ·
ACALL WRITEIIC
MOV A,#00H ;×ÖµØÖ·
ACALL WRITEIIC
ACALL STARTIIC
MOV A,#0A1H ;Æ÷¼þ¶ÁµØÖ·
ACALL WRITEIIC
ACALL READIIC
ACALL STOPIIC
MOV P1,A
SJMP $
STARTIIC:
SETB SDA
SETB SCL
ACALL DELAY5
CLR SDA
ACALL DELAY5
CLR SCL
ACALL DELAY5
RET
STOPIIC:
CLR SDA
SETB SCL
ACALL DELAY5
SETB SDA
ACALL DELAY5
RET
WRITEIIC: ;±ØÐëÊÂÏȱ£»¤R7µÄÓÐÓÃÄÚÈÝ
MOV R7,#8 ;±ØÐëÊÂÏȽ«ÒªÐ´µÄÊý¾Ý±£´æµ½AÖÐ
WCJ1: RLC A ;±ØÐëÊÂÏȱ£»¤CÖеÄÓÐÓÃÄÚÈÝ
MOV SDA,C
SETB SCL
ACALL DELAY5
CLR SCL
DJNZ R7,WCJ1
SETB SDA ;Òª¶ÁÈ¡Êý¾Ý£¬µ¥Æ¬»úIO¿ÚҪд1
SETB SCL
ACALL DELAY5
SS: MOV C,SDA JC SS
CLR SCL
RET
READIIC: ;±ØÐëÊÂÏȱ£»¤R7µÄÓÐÓÃÄÚÈÝ
MOV R7,#8 ;±ØÐëÊÂÏȽ«ÒªÐ´µÄÊý¾Ý±£´æµ½AÖÐ SETB SDA
RCJ1: SETB SCL
ACALL DELAY5
MOV C,SDA
CLR SCL
RLC A
ACALL DELAY5
DJNZ R7,RCJ1
SETB SCL
CLR SDA
ACALL DELAY5
CLR SCL
RET
DELAY5:
NOP
NOP
NOP
NOP
NOP
RET
END
-
-
AT24C02.............1.zip
下载积分: 积分 -1 分
118.77 KB, 下载次数: 5, 下载积分: 积分 -1 分
源代码和电路图
一周热门 更多>