ACALL REV ; 调用读取单个字节子程序
;ACALL ACK ; NO ACK ,指定地址读取单个字节模式不需要ACK
ACALL STOP ; 结束信号
ACALL DELAY
MOV 50H,A ; 将读取到数据存入单片机50H地址中
ACALL START ; 发送开始信号,进入连续读取数据模式
MOV A,#0A1H ; 输入24C02地址及读取信号
ACALL SEND ; 发送到24C02
ACALL ACK ; 等待24C02应答
MOV R2,#07 ; 紧接上面的地址后连续读取7个字节
MOV R1,#51H ; 放入单片机的51H~57H地址单元
READ: ACALL REV
ACALL ACK0
MOV @R1,A
INC R1
DJNZ R2,READ
ACALL STOP
ACALL DELAY
LIGHT: MOV R1,#50H ; 从单片机的50H~57H单元中提取刚才存入的数据,显示在数码管上
MOV R2,#08H
MOV A,#0FEH
LOOP: MOV P1,A
MOV P0,@R1
INC R1
RL A
ACALL DEL
MOV P1,#0FFH
DJNZ R2,LOOP
AJMP LIGHT
DEL :MOV R4,#20 ;数码管显示的延时
D3: MOV R5,#20
D4: DJNZ R5,D4
DJNZ R4,D3
RET
TABLE: DB 0C0H,0F9H,0A4H,0B0H,099H,092H,082H,0F8H
END
;uchar code tab[]={0xc0,0xf9,0xa4,0xb0,0x99,;0,1,2,3,4,
;0x92,0x82,0xf8,0x80,0x90,;5,6,7,8,9,
;0x88,0x83,0xc6,0xa1,0x86,;A,B,C,D,E,
;0x8e,0x8c,0xc1,0xce,0x91,
;0x00,0xff}; //0-f,p,u,t,y,8.,灭共阳极数码管显示段码