📄 x-5045.asm
字号:
;name:wren_com
;function: Set write enable latch
;inport: none
;outport: none
;call: outbyte subprogram
;use:r7,a
wren_com: clr x_clk
nop
clr x_cs
mov a,#06h
lcall outbyte
clr x_clk
setb x_cs
ret
;name:diswren_com
;function: Set disnable write eeprom latch
;inport: none
;outport: none
;call: outbyte subroutine
;use:r7,a
diswren_com: clr x_clk
clr x_cs
mov a,#04h
lcall outbyte
clr x_clk
setb x_cs
ret
;name:rdReg_com
;function: read the statuse Register
;inport: none
;outport: A=read result
;call: outbyte subroutine
;use:r7,a
rdReg_com: clr x_clk
clr x_cs
mov a,#05h
lcall outbyte
lcall inbyte
clr x_clk
setb x_cs
ret
;function: Write statuse regist watchdog=1.4s
;inport: none
;outport: none
;call: outbyte subroutine
;use:r7,a
statuse_com: lcall wren_com
clr x_cs
clr x_clk
mov a,#01h
lcall outbyte
mov a,#00h
lcall outbyte
clr x_clk
setb x_cs
lcall win_check
ret
;name:wrReg_com
;function: write the statuse Register
;inport: none
;outport: none
;call: outbyte
;use:r7,a
;wrReg_com: clr x_clk
; clr x_cs
; mov a,#06h
; lcall outbyte
; clr x_clk
; setb x_cs
; ret
;name:byte_write
;function: write a byte to the eeprom
;inport: (r0)=byte address,(r1)=write data address
;outport: none
;call: outbyte,win_check
;use:r7,a
byte_write: clr ea
lcall wren_com
clr x_clk
clr x_cs
mov a,#02h ;02h=write eeprom instruction
lcall outbyte
mov a,r0 ;(r0)=eeprom address
lcall outbyte
mov a,@r1 ;(r1)=address of to be write data
lcall outbyte
clr x_clk
setb x_cs
lcall win_check
lcall diswren_com
setb ea
ret
;name:byte_read
;function: read a byte from the eeprom
;inport: (r0)= address of eeprom byte address to be read
;outport: (A)=read result
;call: outbyte,win_check
;use:r7,a
byte_read: clr x_clk
clr x_cs
mov a,#03h
lcall outbyte
mov a,r0
lcall outbyte
lcall inbyte
clr x_clk
setb x_cs
ret
;name:win_check
;function: check write a byte if end
;inport:none
;outport:none
;call: rdReg_com
;use:r7,a
win_check: lcall rdReg_com
jb acc.0,win_check
ret
;name:outbyte
;function:output a byte to eeprom
;inport: A=byte to be sent
;outport: none
;use:r7,a
outbyte: mov r7,#8
outbyt1: clr x_clk
rlc a
mov x_si,c
nop
setb x_clk
nop
djnz r7,outbyt1
ret
;name:inbyte
;function:input a byte to Acc from eeprom
;inport: nonet
;outport: A=reciveed byte
;use:r7,a
inbyte: mov r7,#8
inbyt1: setb x_clk
nop
clr x_clk
nop
mov c,x_so
rlc a
djnz r7,inbyt1
ret
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -