Ciao.
I try to write an read an 24LC512 with a PIC 18F252. The program works well till the address 32728, after that I am not sure what is happent.
I looks like overwrite the memory by the address zero, or in the same time write the address 32728 and the address 0 with the same data.
I wont to write all memory not only half.
This is part of my program:
'I2C Variables
ctl CON $A0
'I2C Eeprom Pins
sda_B VAR PORTB.5 ' I2C SDA for ext eeprom B
scl VAR PORTB.6 ' I2C SCL for ext all eeprom
sda_A VAR PORTB.7 ' I2C SDA for ext eeprom A
sda_C VAR PORTC.5 ' I2C SDA for ext eeprom C
in_adr VAR WORD
out_adr VAR WORD
mem_adr VAR WORD
data VAR BYTE[17]
.
.
.
in_adr=0
out_adr=65535
For mem_adr = in_adr TO out_adr STEP 16
For m=1 TO 16
I2CWrite sda_A,scl,ctl,mem_adr+(m-1),[data[m]]
Pause 10
Next m
Next mem_adr
.
.
.
'Read procedure
For m=1 TO 16
I2CRead sda_A,scl,ctl,mem_adr+(m-1),[gps_data[m]]
Next m
HSerout [DEC2 data[1],DEC2 data[2],DEC2 data[3],DEC2 data[4],DEC2 data[5],DEC2 data[6],DEC2 data[7],DEC2 data[8],DEC2 data[9],DEC2 data[10],DEC2 data[11],DEC3 data[12],DEC2 data[13],DEC2 data[14],DEC2 data[15],DEC1 data[16] ,10,13]
mem_adr=mem_adr+16
EndIF
End
I need your help. Thanks.
Bookmarks