How to read-write EEPROM from PIC with shared data bus

Thread Starter

rbibler01

Joined Jul 20, 2015
3
Hi,

I'm trying to implement a basic EEPROM programmer that will both read from and write to an AT28C256 eeprom using 74HCxxx shift registers and a PIC18F14k22. Using two 74HC595s for address and data (address low and data share the same register) and a few pins from the PIC, I'm able to write the eeprom. And using a 74HC165 shift-in register I can read the eeprom. But to do so I have to swap the data wires from the 595 to the 165, or I get garbage data. Same goes for writing (if the 165 is on the data bus, things get wonky).

So my question is, how can I wire my circuit such that the 595 and the 165 can share the data bus? I'm sure I'm missing something pretty basic, but I'm fairly new electronics and circuit design and am learning as I go.

I've attached my current design, which adds a probably unnecessary third 74HC595 to separate data from address.

Thanks!
 

Attachments

tshuck

Joined Oct 18, 2012
3,534
74595 pin 13 is your friend. This pin is the output enable line - when active (it's active-low), the outputs of the 74595 are put into high-Z mode and do not drive the output pins, leaving the 28C256 to drive those pins.

In fact, since the output of the 74595 should only be used when writing to the memory, you could connect the write enable line to the 28C256 to the output enable (#OE) of the 74595.

One thing to note is that floating buses are rarely a good thing, you may want to add some pull up/down resistors to the bus.

Also be aware that you don't violate the setup and hold times of the devices.
 

Thread Starter

rbibler01

Joined Jul 20, 2015
3
Ah, that makes a lot of sense. I have #OE tied to ground currently because I ran out of pins on the PIC. But tieing it to write enable on the EEPROM like you suggest will take care of that.

I'll give it a try this afternoon.

Thanks!
 

tshuck

Joined Oct 18, 2012
3,534
Ah, that makes a lot of sense. I have #OE tied to ground currently because I ran out of pins on the PIC. But tieing it to write enable on the EEPROM like you suggest will take care of that.

I'll give it a try this afternoon.

Thanks!
Looking back at this, depending on the speed of your device, you may get into trouble.

Assuming you have the slowest devices, the 28C256 has a maximum drive-to-float time of 70ns, where the 74595 has its drive-to-float time between 34-200 ns, meaning there may be some overlap of your signals driving the buses.

Adding some delay between #WE and #OE can be introduced to ensure that both are never driving the bus (could be as simple as resistor and capacitor).

You could also probably just add some series resistors between the bus drivers to limit the current during the potential, brief times of bus contention.
 

Thread Starter

rbibler01

Joined Jul 20, 2015
3
Looking back at this, depending on the speed of your device, you may get into trouble.

Assuming you have the slowest devices, the 28C256 has a maximum drive-to-float time of 70ns, where the 74595 has its drive-to-float time between 34-200 ns, meaning there may be some overlap of your signals driving the buses.

Adding some delay between #WE and #OE can be introduced to ensure that both are never driving the bus (could be as simple as resistor and capacitor).

You could also probably just add some series resistors between the bus drivers to limit the current during the potential, brief times of bus contention.
I tested your suggestion and it worked! There don't seem to be any timing issues, and I didn't have enough resistors to add pull ups, but it worked nonetheless. I can now write and verify without swapping wires around. Thanks!
 
Hi!

Im trying to do something similar with the at28c256 but im using binary counters to get the addresses. Also im using the pic18f4550. But i have troubles with the eeprom's writing, seems it doesnt work!

Im just trying to write for the moment but when i read i just get FF in every address.

Did you have that problem?
 

dl324

Joined Mar 30, 2015
16,788
Im trying to do something similar with the at28c256 but im using binary counters to get the addresses. Also im using the pic18f4550. But i have troubles with the eeprom's writing, seems it doesnt work!

Im just trying to write for the moment but when i read i just get FF in every address.
Show your write waveforms.

Has the device been write protected?
 
Top