wakaka
Joined: 11 Sep 2006 Posts: 27
|
external eeprom program(24128) |
Posted: Fri Feb 09, 2007 7:20 pm |
|
|
Hi all, I'm trying to write some value in eeprom and read back, but it doesn;t work. Below is my code, is here anything wrong? thanks.
Code: | #include <16F876A.h>
#use delay(clock=20000000)
#fuses hs,noprotect,nowdt,nolvp
#byte PORTB=6
#byte PORTC=7
#define EEPROM_SDA PIN_C4
#define EEPROM_SCL PIN_C3
#include <24128>
int i,d;
main()
{
d=0;
set_tris_b(0);
portb=0x01;
delay_ms(1000);
portb=0x00;
delay_ms(1000);
init_ext_eeprom();
delay_ms(1);
write_ext_eeprom(0x00,0x02);
d = read_ext_eeprom(0);
portb=d;
delay_ms(1000);
} |
or can anyone just show me a simple but working read write program to eeprom which is similar to mine? thanks. |
|