Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

problem with writing into a AT28C256 EEPROM

Status
Not open for further replies.

patheticz

New Member
Hi. I am currently doing a project that reqires me to read and write into a 28c256 EEPROM. now, i am able to read from the EEPROM. however, i am encountering some difficulties in wrting into the EEPROM itself. can someone pls tell me how to actually write into the EEPROM? i have tried following closely to the data sheet, but still unable to do so
 
Hi,
there could be n number of reasons, starting from just an insufficient delay to something wrong with the code or may be in hardware!!
it would be more helpful if you put up here the part of code you are using for writing to the EEPROM. And also indicate which microcontroller is used.

--------
www.dharmanitech.com
 
Last edited:
OE=0;
CE=1;
WE=1;

reset_pin=0;
reset_pin=1;
delay(1);
encode(5,0);
encode(5,1);
encode(5,2);
encode(5,3);
delay(2);
CE=0;
delay(1);
WE=0;
OE=1;
delay(2);
serial_in(0xAA);
delay(5);
WE=1;
delay(1);
CE=1;
delay(1);

reset_pin=0;
reset_pin=1;
delay(1);
encode(2,0);
encode(10,1);
encode(10,2);
encode(10,3);
delay(2);
CE=0;
delay(1);
WE=0;
delay(2);
//OE=1;
serial_in(0x55);
delay(5);
WE=1;
delay(1);
CE=1;
delay(1);

reset_pin=0;
reset_pin=1;
delay(1);
encode(5,0);
encode(5,1);
encode(5,2);
encode(5,3);
delay(2);
CE=0;
delay(1);
WE=0;
delay(2);
//OE=1;
serial_in(0xA0);
delay(5);
WE=1;
delay(1);
CE=1;
delay(1);

OE=0;

the above is my 3-byte sequence of data to be loaded before wrting into the EEPROM. i am using a 16f877 PIC with a 20MHz crystal. i am using 4 74191 counters to help in addressing the EEPROM. the "encode" function does the job of setting teh counter to the correct address. as for the data, i am using a 8-bit univeral shift register. "serial_in" is the function to load the data in to teh shift register. every dealy is around 1 ms. i.e. delay(5) is around 5 ms.
i have tested the the outputs from teh counters and shift registers using a multimeter and teh readings is the same as those i expected.
is there something wrong with my code sequence?
 
Hi,
as you said, the counters and shift register are working ok, then following changes in control pins status and delay in your code should help

OE=1;
CE=1;
WE=1;

reset_pin=0;
reset_pin=1;
delay(1);
encode(5,0);
encode(5,1);
encode(5,2);
encode(5,3);

CE=0;
WE=0;
serial_in(0xAA);
delay(5);
WE=1;
CE=1;
delay(?); //provide 10ms delay here

Repeat it for writing the remaining bytes, too.

------------
Design with Microcontrollers
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top