Hi every one,
i ahce a problem with writing and reading using I2C WRITE...

thansk for any help,
-----------------

here is the connection:

pic16f628: porta.6 and 7 are SDA & SCL

24lc256 (8 bit EEPROM): A0,1,2,3,4 and WP: ground
SDA &SCL connected 10k to 5V...
------------------------
;the program:


CMCON = 1
TRISA = %11000000 ; set port A6,7 to input (SDA & SLC)
TRISB = 0
DPin var PORTA.6 ' I2C data pin
Cpin var PORTA.7 ' I2C clock pin

I var byte
S VAR BYTE
b1 var byte
k var byte

B0 var byte

i = 0
b0 = 0

while b0 != $ff
lookup I, [$3F,$48,$48,$48,$3F,$3F,$00,$ff],B0 ;put a value into
;B0
I2CWRITE DPIN,CPIN,$A0,i,[B0] ' Write B0 to address I

Pause 10 ' Delay 10ms after each write
i = i+1 ' increase the address by 1
wend
loop:
;reading process
b1 = 0 ; clear b1
while b1 !=$ff
I2CREAD DPIN,CPIN,$A1,i,[B1]

FOR K = 0 TO 63 ; scan for 64 times
CALL RESET
PORTB = b1
CALL DELAY

NEXT K
i = i +1
wend
goto loop
end
RESET: PORTA.1 = 1 ;RESET 4017
@NOP
PORTA.1 = 0
RETURN

DELAY: pause 10
portb = 0 ; reset portb
porta.0 = 1 ; clock the 4017
@nop
porta.0 = 0
return