View previous topic :: View next topic |
Author |
Message |
Alberto Guest
|
24LC512 |
Posted: Tue Oct 09, 2007 5:59 pm |
|
|
Hello , I´m trying to use the eeprom 24LC512 for the first time , I´m using 24512.c driver . A wrote this code , but he´s only reading zero from the eeprom . Is the code right. Could some confirm me the connections of 24LC512 , pin A1 A2 A3 , Wp ,pullups etc
the code:
#define EEPROM_SDA PIN_B6
#define EEPROM_SCL PIN_B7
main()
{
long int i;
BYTE d;
BYTE data;
set_tris_b(0b11000000);
lcd_init();
init_ext_eeprom();
delay_us(100);
delay_ms(400);
data=1;
//wite eeprom eeprom
for(i=0;i<100;i++)
{
data=data+1;
write_ext_eeprom(i,data);
delay_us(10);
}
for(i=0;i<100;i++)
{
d=read_ext_eeprom(i);
printf(lcd_putc,"%u",d);
delay_ms(1000);
printf(lcd_putc,"\f");
delay_ms(1000);
/////
}
} |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
dustimv
Joined: 18 Sep 2007 Posts: 4
|
|
Posted: Tue Oct 09, 2007 10:04 pm |
|
|
Please note on the schematic listed above, the pins are mirrored, due to the IC being placed on the back of the board. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
|