LCALL rd_rand
MOV a,r6
ANL a,#00111111b
RL a
RL a
MOV b,a
MOV a,r7
RL a
RL a
MOV r7,a
MOV a,b
ORL a,r7
MOV r6,a
MOV a,b
ANL a,#00000011b
MOV r7,a
;r7放置AD7416温度值高2位,r6放置低8位
CLR C
RET
wr_byte:NOP;AT24Cxx Byte Write function.
;Called with programmable address in A, byte address in
; register pair ADDR_HI:ADDR_LO, data in register XDATA.
; Does not wait for write cycle to complete.
; Returns CY set to indicate that the bus is not available
; or that the addressed device failed to acknowledge.
; Destroys A.
LCALL start
JC x49
RL a
ORL a, FADDR
CLR acc.0
LCALL shout
JC x48
MOV a, addr_hi
LCALL shout
JC x48
MOV a, address
LCALL shout
JC x48
MOV a, zdata
LCALL shout
JC x48
CLR c
x48: LCALL stout
x49: ret
rd_curr:NOP; AT24Cxx Current Address Read function.
; Called with programmable address in A. Returns data in A.
; Returns CY set to indicate that the bus is not available
; or that the addressed device failed to acknowledge.
LCALL start
JC x45
RL a
ORL&n