help!! eeprom
Wed Nov 28 2007, 11:29 am
im trying to interface at28c64b to 89c51
but its not working, please help
i must finish this within this week!
connection:
/ce->0
/oe(74hc737n)->0
P0->(d0-d7)(74hc737n)(q0-q7)->(a0-a7)(at28c64b)
P2->(a8-a12)(LE)(/we)(at28c64b /oe)
ill give the schamtic very soon.
this is the code
but its not working, please help
i must finish this within this week!
connection:
/ce->0
/oe(74hc737n)->0
P0->(d0-d7)(74hc737n)(q0-q7)->(a0-a7)(at28c64b)
P2->(a8-a12)(LE)(/we)(at28c64b /oe)
ill give the schamtic very soon.
this is the code
#include <REG52.H> //13-bit address,8-bit input #define MDATA P0 #define ADDR1 P0 #define ADDR2 P2 sbit LE = ADDR2^5; // LE sbit WE = ADDR2^6; // /WE sbit OE = ADDR2^7; // /OE sbit IO7 = MDATA^7; // /data polling sbit IO6 = MDATA^6; // toggling bit #define MASK_W 0xE0 //11100000B #define MASK_R 0x60 //01100000B //can write only 5ms after power on void write_eep(unsigned short int addr,unsigned char dat){ bit last_bit=dat^7; OE=1; //in WE=1; //r ADDR1=addr&0xff; ADDR2=(addr> > 8)|MASK_W; LE=1; //latch-in on LE=0; //latch-in off WE=0; MDATA=dat; WE=1; WE=0; //wait for the write cycle to end while(IO7==last_bit); } unsigned char read_eep(unsigned short int addr){ WE=1; //read OE=0; //in ADDR1=addr&0xff; ADDR2=(addr> > 8)|MASK_R; LE=1; //latch-in on LE=0; //latch-in off OE=0; //out MDATA=0xff; //reset return MDATA; } //hundreds thx
[ Edited Wed Nov 28 2007, 01:25 pm ]
Wed Nov 28 2007, 01:27 pm
check what is the voltage required to write to that EEPROM. and i want to see the circuit too..
Wed Nov 28 2007, 03:34 pm
thx
here is the circuit
5v is needed to write.
let me know if anyone want anything about it.
here is the circuit
5v is needed to write.
let me know if anyone want anything about it.
[ Edited Wed Nov 28 2007, 03:43 pm ]
Wed Nov 28 2007, 04:23 pm
I checked the datasheet, and i feel there is a problem with the write operation, at the end where you are doing DATA POLLING.
I have made corrections according to whatever mentioned in the datasheet. Please check it and let me know.
void write_eep(unsigned short int addr,unsigned char dat){ bit last_bit=dat^7; OE=1; //in WE=1; //r ADDR1=addr&0xff; ADDR2=(addr> > 8)|MASK_W; LE=1; //latch-in on LE=0; //latch-in off WE=0; MDATA=dat; WE=1; // WE=0; // No need to make WE 0 as you are reading so OE has to be low OE = 0; // See datasheet at "data polling waveform" //wait for the write cycle to end while(IO7==(~last_bit)); // As per the datasheet IO7 will have complement of last written data // and so you wait till the IO7 is showing complement of last bit // when the write cycle is complete the correct data will be shown. OE = 1; }
I have made corrections according to whatever mentioned in the datasheet. Please check it and let me know.
Thu Nov 29 2007, 05:33 pm
it doesn't seem to work and i'm trying to use a serial eeprom, at24c64a instead, but its still not working.
could anyone give me some sample code for at24c64a /24c64? i've been searching for long, but found none working. plz help
could anyone give me some sample code for at24c64a /24c64? i've been searching for long, but found none working. plz help
Thu Nov 29 2007, 05:47 pm
why don't you try giving some delay of about 100 to 150ms instead of data polling, i think the main problem in your code is of that only.
Fri Nov 30 2007, 12:42 pm
you're right , i put some delay after the write function and it works, thx alot!
i was trying to make the code faster , so forgot delays
i was trying to make the code faster , so forgot delays
[ Edited Fri Nov 30 2007, 12:44 pm ]
Fri Nov 30 2007, 06:45 pm
great... to know it worked.. remember.. hardware (the real thing) needs delay.. and software is always fast..
Sat Dec 01 2007, 02:21 am
o, the serial eeprom is not working again.....
i don't change any of its wires nor code, everything are in the same old place , and the code is the same old code, but the rom just doesn't work. i can't write anything into it. any idea?
i don't change any of its wires nor code, everything are in the same old place , and the code is the same old code, but the rom just doesn't work. i can't write anything into it. any idea?
[ Edited Sat Dec 01 2007, 02:22 am ]
Sat Dec 01 2007, 02:25 am
i thought you are using parallel ROM?
check the WP (write protect) signal.. or loose connection :-s
check the WP (write protect) signal.. or loose connection :-s
Powered by e107 Forum System