Hi all,
i've some problems writing with I2CWRITE to this EEPROM (24LC512), it's wired to the PIC and pulled up via two 4.7k res.
The pic sometime write, sometime not, this is the code:
'Dichiaro le variabili
W0 VAR WORD 'Memorizzazione I2C
SCL VAR PORTC.3 'Pin per la memoria I2C Clock
SDA VAR PORTC.4 'Pin per la memoria I2C Data
I VAR WORD 'Generica
Control VAR BYTE 'Costante byte di controllo EEPROM
Control = $A0 'Imposto il byte di controllo
OPTION_REG = %11101111
'Imposto la frequenza di oscillazione a 10 Mhz
DEFINE OSC 10
'Imposto le porte della PIC
TRISA = %11111111 'PortA Tutti input
TRISD = %11111111 'PortD Tutti input
TRISB = %00000001 'PortB Tutti output a parte 0
PORTB = %00000000 'PortB Tutti low
TRISC = %00000000 'PortC Tutti output
PORTC = %00000000 'PortC Tutti low
'Inizializzo l'EEPROM
EEPROMInit:
W0 = $0
for I = 0 to $18
I2cwrite SDA,SCL,CONTROL,I,[W0]
pause 10
next
in the initial state where all the addresses is FFFF, after i use this code i can see this state in the EEPROM:
0000: 1100 00FF 0000 0000 | ........
0008: 0000 FF11 0000 FF11 | ........
0010: FFFF FFFF FFFF FFFF | ........
0018: FFFF FFFF FFFF FFFF | ........
0020: FFFF FFFF FFFF FFFF | ........
0028: FFFF FFFF FFFF FFFF | ........
0030: FFFF FFFF FFFF FFFF | ........
Can you help me solving this problem?
Thank you,
Luca
EDIT:
I'm using a PIC16F877A
Bookmarks