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.

writing into EEPROM

Status
Not open for further replies.

patheticz

New Member
i am having difficulty understanding the waveform on the datasheet provided by amtel on how to write data into the EEPROM 28c256. can someone enlighten me on that?
thankz
 
You setup the address lines, make /oe high, take /ce and /we low, setup the data lines and take /ce and /we high again. To check if it's finished writing, take /oe and /cs low and read D7, when it is the same as the byte just written the write is complete.

Mike.
 
are delays in between switching of the function pins required? since in the data sheet, it was mentioned e.g. the write pulse width is needed to be at least 100ns?
if so, will it matter if i actually have a much long delay, say 200ns?
 
and one mroe thing, is there any difference in the way we write data into the EEPROM and the way we disable the write protection of the chip?
 
Unless you have a processor that executes faster than 10MHz then no delay is required. A longer delay will not cause any problems as no maximum time is listed.

SDP is turned off by default and so, unless you have specifically turned it on, the chip will not be write protected.

Mike.
 
If your pic is using a 20MHz crystal then it is running internally at 5MHz. This means that each instruction takes 200nS - twice as long as the minimum width for the write pulse.

If you don't want to poll D7 to work out when the write has completed, you can wait 10mS instead. This will however mean you can only write 100 bytes per second. This means that it will take about 10 minutes to program the whole chip. If you use block write then it should complete in about 20 seconds.

Mike.
 
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?
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top