[an error occurred while processing this directive]
[an error occurred while processing this directive]
|
;using in C:
;extern bit EEWrite (uchar Data); //returns ACK/NACK
;extern uchar EERead (uchar _Ack); //returns byte
_SCLK EQU 0B4H
_SDAT EQU 0B5H
PUBLIC _EEWrite,_EEReadEE_ROUTINES SEGMENT CODE
RSEG EE_ROUTINES
;Input: ack/nack in R7
_EERead:
mov A,R7
mov R5,A
mov R7,#0FFh
clr C
mov A,R5
JZ SendAck
_EEWrite:
;Input: data in R7
SETB C
SendAck:
MOV R5,#9
MOV A,R7
EELoop:
RLC A
MOV _SDAT,C
CLKLoop:
SETB _SCLK
JNB _SCLK,CLKLoop
MOV C,_SDAT
CLR _SCLK
DJNZ R5,EELoop
MOV R7,A
RETEND
E-mail: info@telesys.ru