write24:mov r0, #40h;RAM首地址 call wrdat ret
read24: mov r0, #40h call rddat ret
;*********************************************************************************************************** wrdat: lcall st24 mov a, #0a0h;命令 lcall wbyte mov a, #08h;24c02首地址 lcall wbyte mov r6, #025;**********25个参数
wr1: lcall st24 mov a, @r0 lcall wbyte inc r0 djnz r6, wr1 lcall stop24 ;djnz r6, wr1 ret
rddat: lcall st24 mov a, #0a0h lcall wbyte ; mov a, zc1 mov a, #08h lcall wbyte lcall st24 mov a, #0a1h lcall wbyte mov r6, #025 rd1: lcall rbyte mov @r0, a inc r0 djnz r6, rd1 lcall stop24 ret
wbyte: nop mov r3, #08h wby0: nop lcall delll clr scl lcall delll rlc a mov sda, c setb scl djnz r3, wby0 clr scl lcall delll setb scl lcall delll jb sda, $ clr scl nop nop ret
rbyte: nop mov r3, #08h rby0: clr scl lcall delll setb scl lcall delll mov c, sda rlc a djnz r3, rby0 clr scl lcall delll setb sda lcall delll setb scl nop nop ret
st24: clr scl; start call delll setb sda call delll setb scl call delll clr sda call delll clr scl nop ret
stop24: clr scl;stop call delll clr sda call delll setb scl call delll setb sda call delll clr scl nop ret
delll: nop nop nop nop nop nop nop ret |