set sda_c
set scl
call DELAY_8us
FDEV1:
sz sda ;等待应答信号
jmp fdev1
clr scl
clr sda_c
read_data:
set sda
call DELAY_8us
set scl
call DELAY_8us
clr sda ;起始信号
clr scl
set sda ;1
call DELAY_8us
set scl
call DELAY_8us
clr scl
clr sda ;0
set scl
call DELAY_8us
clr scl
set sda ;1
call DELAY_8us
set scl
call DELAY_8us
clr scl
clr sda ;0
set scl
call DELAY_8us
clr scl
clr sda ;a2=0
set scl
call DELAY_8us
clr scl
clr sda
set scl
call DELAY_8us
clr scl
clr sda
set scl
call DELAY_8us
clr scl
set sda ;读模式
call DELAY_8us
set scl
call DELAY_8us
clr scl
set sda_c
set SCL
call DELAY_8us
w_ack:
sz sda ;等待应答信号
jmp w_ack
clr scl
set sda_c
mov a,08h
mov data_8,a
random_out:
set scl
clr read_out.7
sz sda
set read_out.7
clr scl
rl read_out
sdz data_8
jmp random_out
clr sda_c
set sda
set scl
clr scl
clr sda ;停止信号
set scl
set sda
ret
ROM_READ ENDP
;**********************************
;***************延时8us秒**********
DELAY_8us:
mov a, 1
mov D_TEMP,a
D8US:
sdz D_TEMP
jmp D8US
ret
;**********************************