There are many kinds of ROM chips, or "Read Only Memories"
and ROM could refer to a chip that has some data in it
that you can only read - there is no way to write it or change it
so that the chip is manufactured in a way that it has that
data in it but there are other types of
ROMs that are programmable and
those are called PROMs or "Programmable
Read-Only Memory and those usually
give you some way of programming it
once, so you get the chip and it's blank
and you can program it once and
once you've programmed it then you can't
change what's programmed in it but you
can read it as much as you want and of
course that can be inconvenient so they
also make any EPROMs which are
erasable programmable read only memories
and usually can be erased by exposing
them to ultraviolet light so this here
is an EPROM and you see
there's a little window on the top of
the chip and you can see the the die and
so what you can program this and then
it's a read-only memory at that point
but you can also erase it by exposing
the the die here to ultraviolet light so
you need some kind of ultraviolet eraser
thing to to erase these otherwise you
know you can also you leave them out in
the Sun for a few hours sometimes that
works which is which is why they also
have these little stickers that go over
top so they don't accidentally erase
themselves so that's a erasable
programmable read-only memory but the
most convenient kind of the electrically
erasable programmable read-only memory
which is what these guys are which
allows you to program them and then of
course they acted normal read-only
memory at that point but then you can
also erase them and reprogram them
electronically without needing to expose
ultraviolet light or do anything special.
So the 28C16 that's what I've got here
I've got two different 28C16s. This is
made by Catalyst, this one's made by Exel.
I also have the data sheet over here for
the Atmel AT28C16, they're all
basically the same. So this is sixteen thousand bits,
which is organized as two thousand 8-bit words or
"bytes" essentially, two thousand
bytes. Parallel EEPROMs so if we take a
look on the data sheet at the pin-out
here this is our pin out comes in a
couple different packages. We have the
plastic dual inline package
that's this guy here. It's fairly
straightforward - there's basically
eight I/O pins, so 0, 1, 2, 3, 4, 5, 6, 7 so eight I/O pins that's for
our data. They're input for
programming and normally they'd be
output for reading from it and then there are
11 address lines so zero through seven
here and eight nine and ten over here
and those address lines are used for
telling it which byte we want to read, or
write if we're writing to it for programming it.
And other than that pretty
straightforward. There's ground and power for
powering the thing and then there's a
"Write Enable", "Output Enable" and "Chip Enable",
which we will take a look at in a
moment. I'll start by hooking up power
and ground. The next pin I'll hook up is
pin 18 which is the "Chip Enable", and I'll hook
that to ground, and so chip enable is
active low so when this is low the chip
is enabled and we always want the chip to be
enabled so we'll just tie that directly
to ground. Next to note is there's are 8 I/O lines, so
I/O 0, 1, 2, 3, 4, 5, 6 and 7 so I'm going to hook those up to
some LEDs so we can see what's in the
chip so when we we look at a particular
address will be able to see what data is
stored in the chip. So I'm gonna add some LEDs
here that we'll use for looking at what
data is in here.
Alright, so there's 8 LEDs that we'll use for
looking at the data. Now I'll connect the data
pins here so I/0 0 (pin 9). I'll connect
that. I'll start connecting those to the
LEDs. So that's I/O 0 (pin 9) going to
the first LED, pin 10 to the next LED
here, and pin 11, and I/O 3 I'll connect over
here to the other side of these LEDs.
I/O 4
So I've connected all these I/O lines to the LEDs so we'll be
able to see the output of the chip, but we
need to connect the other side of the
LEDs over to ground. So I'm connecting
these LEDs to ground through these 330
ohm resistors, and that's important because
this chip doesn't have any current
limiting on its outputs so if we don't
have these current limiting resistors
here, then it's going to drive as much
current can through the chip through the
LED, potentially damaging both the chip
and the LED in the process so we don't
want that we need to do some kind of
current limiting. So I've got these 330 ohm
resistors that are that are going from
ground through the LED and then into the
chip into the output of the chip will
who will go through the LED into ground
and these are a little bit asymmetrical
because the the ones on this side are
going to the LEDs this way into ground
the ones on the this side are going through
the LEDs that way and then the ground and
so these first 5 LEDs are the other way
around
so this should allow us to see what's
coming out of these I/O lines, but in
order to do that we've got to first tell
it what address we want to look
at. So if we want to read from address 0 for
example have to set all these address
lines to 0. We want to be able to select
which address we're reading from so what
I want to do is hook these address lines
up to some switches so we can select
whichever address we want.
So I'll put some DIP-switches here that we'll use for setting the address,
and I'll hook all the address lines up to the switches
So that's the first eight address lines here
and from zero through address seven are hooked
up to these switches when the
switches are off we want the address
lines to be low so i'm gonna tie them
low with a, this is a 10k resistor I think, brown black
and I think that's orange, so it's a 10k resistor so
I'm going to tie these these all low
with these 10k resistors. So when the switches
are off these will all be tied low through
these resistors when we turn the switch
on then we want to connect these to
five volts. So if we hook the other side of the
switch to five volts then when the switch is
on the pin will be high and when the switch is
off then it's pulled up by that
resistor or pulled down i guess by
that resistor to ground so we want
this side of the switches to all be tied to five volts
So that should take care of the
first 8 address lines over here now we've still
got address 8, 9 and 10 over on this side
so i'm going to add another set of
switches here and we're going to use the
the, i guess the bottom three of these
for address 8, 9 and 10 and I'm gonna
hook them up pretty much the same way.
and so that's address 8, 9 and 10 here;
8, 9 and 10 hooked up to this side
of the switch and so again when these
switches are off we want to pull them
low, so I'll do that with the 10k resistors
and then when the switches are on we
want to be pulled high
so now we can use these first 11 switches
everything but the top one here to set our address
and of course 11 bits of address gives us the
2048 (two thousand fourty eight) or approximately 2,000
different memory locations
So the only pins we haven't hooked up yet
are the right enable and output enable
the output enable is... let's keep pin 20
and if we set that too low its active
low so if we set that to low by tying
that to ground then that will enable the
output which means that whatever address
we set here we'll see the contents down
here on the I/O lines
so we try that we can hook this up to
power now so I'm gonna hook this up to 5 volts
and what we see is all ones and so that's
address location 0 and if we change this
to address 1 we see all ones if we go
to address 2 we still see all ones, address 3
all ones and you might be noticing a pattern
here that's because when these chips are
brand-new or they're erased, they are
erased with one's at every location so
all one's named the chip is erased and
there's there's nothing stored there and
that makes sense because we haven't
programmed anything here yet.
So to program stuff that's where the right enable pin
comes into play and understand how that
works we're gonna have to take a closer
look at the data sheet if we go to page
three there's the section about byte
write and it says a few things. it says
you can use a low pulse on the right
enable or chip enable input with the
output enable high and either chip
enable write enable low respectively and
that initiates a byte write. So what does
that mean? Well you can read that a few
times and there's some more details in
there
it also helps to look over on page six
theres some timing diagrams usually the
best way to to understand these data
sheets have to read them through you
know at least a couple times and you
know when you're reading it through it
may not make sense entirely what's going
on but as you see other parts of the
data sheet you'll start to kind of get a
picture of what's going on and so here
it is helpful to look at the timing
diagram which tells you how to write and
then it turns out there's there's two
ways you can write you can either write
to the chip using the write enable
controlled option or the chip enable
controlled option
we're going to go with write enable
controlled and basically what that means
is that means that its the write enable
pin going low and then high that controls the
write, that the tell that went to write
data and the way you read these timing
diagrams is you imagine time going from
left to right and there's all these
different transitions and things that
are going on here and really what
they're trying to do is we're trying to
show you the the parameters for the
timing and all of these parameters are
given in the table above and so for
example you know there's this tWP which
is the time of the write pulse so that's
the time from here to here which is the
time that the write enable goes low and
then comes back up how long is that
pulse, well time of write pulse, the
write pulse width, it says the minimum is a
hundred nanoseconds and the maximum
is a thousand nanoseconds so that's good
to know we have to somehow make sure
that we keep that within a hundred to a
thousand nanoseconds so that will be
important to keep keep an eye on some of
these other things are basically telling
you when this write enable goes low
that's what it's going to look at the
address and when the writing enable goes
high that's what it's going to look at
the data and that's sort of corroborated
over here in this description here so it
says "the address location is latched
on a falling edge of write enable the
new data is latched on the rising edge"
So the address is latched on the falling
edge and the data is latched on the rising edge
and so what this timing diagram is trying to tell us is, its saying when this
falling edge happens here the address
has to be set up prior to that
happening and then after that happens
the address has to be held for some
period of time so there is a setup time and a hold time for the address
same thing for the data when the write
enable goes high again the data has to
be set up for some time prior to that
and has to be held for some time after that
So these are all important numbers
to be aware of but you'll notice that like
the address set up and address hold
the data set of data hold over here is the
address set up address hold, there's a
minimum 10 nanosecond 50 nanoseconds but
there is no maximum which is great
because we're going to be going pretty
slow with this so as long as our address
is is toggled into our our dip switches
here 10 nanoseconds before we try to
write what we're gonna be fine and of
course that won't be a problem and as
long as we hold it you know we don't
change the DIP switches within
50 nanoseconds after trying to write then we'll
be fine so no worries there
same thing with the data you know when
we set the data that we want to write we
have to make sure that the data set up
50 nanoseconds before our write enable
goes high no worries that's plenty of
time
ok what will be much longer than 50
nanoseconds and we have to hold it for
10 nanoseconds after this goes high so
no worries there these minimums not
gonna be a problem
the one thing that might be a little bit
challenging is this write pulse
have to this pulse has to be somewhere
between a hundred nanoseconds and a
thousand nanoseconds and that's not a huge
window especially for what we're doing
here, because you might imagine well this the
write enable pin which i think is in
here you can just look that up to a
push-button you want to write you push
the button. The problem is when you push that
button you're probably going to be
pushing it for more than a thousand
nanoseconds that's not very...
1 microsecond that's not very long and the
reality is probably ok if it's longer
than this you know but one thing we can
do just to just to try to to make it in
this window is use a RC circuit
so a resistor and capacitor to to get this
timing right so for example if we use a
1 nano farad capacitor and I guess I've
got a 680 ohm resistor,
680 ohms x 1 nano farad is 680 nanoseconds which
falls nicely between here we've got a
1 nanofarad capacitor and I've got a
680 ohm resistor so how do we build an
RC circuit that will generate this pulse
that is hopefully 680 nanoseconds well
let's get a button here that gonna
trigger our pulse and i'm going to hook my
resistor and capacitor here in series
with the switch and hook the other side
of my switch to ground. And so like this
over here right at this point here i'm
going to have five volts because I've
got a resistor connected across there
and it's not going to drop any current
because there's no current flowing
because the switch is closed nothing's going on
if I close the switch then current will flow
and now this side of the capacitor will
be essentially connected to ground
through the capacitor, if the capacitor is not
charged yet and this will go down to
zero immediately but very quickly the
capacitor will charge up to 5 volts and
the time that it takes to charge up is
dependent on the RC constant here which
is it was a 1 nanofarad capacitor this
is a 680 ohm resistor so should be
680 nanoseconds which works very
nicely when I let go of the switch this
will stay high and the capacitor will
stay charged because it's not connected to
anything else, so I'm going to need another
resistor here to discharge the capacitor
when I let up the switch so I'm just
going to put in a this is like a 10k
resistor and that'll that'll just allow
the capacitor discharge when I'm not
pushing the switch so normally right now
the capacitor is connected both sides of
the capacitor connected to these
resistors to my plus five volts here so
essentially my capacitor just has this
series resistor across it which is
discharging. So the capacitor is going to be
discharged this side over here is going to be 5
volts because there's no current flowing
through this resistor so its going to be 5 volts
on either side when I push this then
ground is going to be connected here
current is going to flow through the
resistor to charge the capacitor so this
side of the resistor will be 0 but then
very quickly rising as the capacitor charges so
this should give me a negative going
spike when I push the switch and that
negative going spike should be
680 nanoseconds which is what we want and so
that will be my write pulse that's going
to write enable, and write enable is
down here
I believe its that pin there, so we'll connect that
over to write enable and so now when i
push this button it should give a
negative going 680 nanosecond pulse into
that write enable pin we can test that
if i hook up power and hook up an
oscilloscope probe here and we'll look
at you look at this point here
which is going to write enable when I push the
button it goes low and recovers here
as the capacitor charges and each of
these divisions is 500 nanoseconds so
you can see at this point here this is
500 nanoseconds this is a thousand
nanoseconds here and so we're already up
let's see, so 0 volts, 1, 2, 3, 4 so we're up over 4 volts
here by the time we get to that thousand
nanoseconds so the period of time that this
is low is definitely between 100
nanoseconds which would be right here and
had a thousand nanoseconds which is over
here so this is perfect
ok so we have that write pulse there so
how do we actually program this thing so
the first thing we want to do is set our
output enable to high which means we're
not enabling our output anymore which
means that are our outputs over here are now
inputs and so now we we can set these
inputs to whatever value we want to
program so i'm going to use these little
jumpers to set a value here that we want
to program into a particular address
location and so let's say this is the
pattern i want a program and i want to
put in address location 0 so i set my
address to zero, when I hit the button here it should
now have that programmed into address 0
if I want to program something different
in to address one I go to address one
and i can change these around so I can
change to program something different so
I just swapped all the bits and we'll put
that in address 1 by hitting our write
enable and that gives us our nice 680 ish
nanosecond pulse to write that into
address one
and we could go ahead and program
address two, three, four, whatever
but for now we'll just do those and so now
I want to go back to reading and
disconnect all of these because these
are no longer going to be inputs
these are going to be outputs so I make sure
those are disconnected and then I go
back and set my output enable
from high back to active low so we're now
output enable. And so now you see in
address one we have this pattern and if
i go to address 0 we have the other
pattern that i programmed and if we go
to address two or or three we still see
the all ones because i haven't programmed
any of any of those locations so maybe
you're thinking this is pretty cool but
how can we use it to do something a
little more practical
well you might recall this circuit that
we put together in the previous video
which basically just takes four bits of
input over here and lights up the display
to show us the number so it's two or
three or four or this is C which is
hexadecimal for 12 which is this is
binary 12 so we have all this logic just
to get this display to work
well turns out you can replace any
combinational logic circuit with a ROM
and so rather than having to design this
complicated circuit with all of these
gates and everything going on here we
could replace all of this with a ROM
that's because remember where this came
from we started with this basic
truth table which just describes how the data
bits coming in relate to whether the
segments are turned ON or OFF
well we can actually program this truth
table into a ROM and the data bits become
the address and then the data output of
the ROM becomes these these a outputs
over here. So at address 0 we could
program in 000 0001 and address one in the
ROM we can program in 100 1111
one and so forth and then we could put
the ROM in the circuit instead of this
and instead of these switches feeding
the input of this fairly
complicated logic circuit, these switches could
feed the address of our ROM and then
the outputs instead of coming out of the
this collection of OR gates and so forth
up here those outputs would just come
directly out of the realm
let's give it a try let's set our output
enable to high so it's OFF and let's go to
address 0 and just start programming so
first off we're going to have all zeros
but with a one at the end. set that to
one and then tie the rest of these to ground and so
there we go
and I'll program that. Now go to address one
so that's address one - program that
and we'll go to address two
ok so if I didn't make any mistakes
which I almost certainly did that should
be everything programed now I'll
disconnect all of my connections here so
we're no longer programming and put it
back into output enable mode and we see
three ones and three zeros which is what
we expect to see for 111 as our input which
it is so that's a good verification and
if I switch to other things I get other outputs
now the real test will be let's
try hooking the output of this thing up
to a 7 segment display.
So we'll hook the anode here through this a hundred ohm
resistor to our positive supply over
here and then these bits should go
over here and it doesn't look like a zero
let's see what I do wrong
oh I got these hooked-up backwards
the one on the right here is G and I
hooked up to A, so that makes sense
so these are all backwards
there we go so 0 - we got zero and now
let's try try it out, so there's one
no that's not two but keep going
that's 3, 4, 5, 6, 7, 8, 9, A. There's B, C, D, E and F.
So that looks like most everything is
right but it was two
yeah two is wrong so two
let's see what did i do so two should be
0010010, so 0010010 so I got that bit off by one
let me try to fix that
it looks like a two and real quick we
can just check all the other numbers to
make sure they're 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E
and F
there we go so not super fun to program it
using a jumper wires like this but
certainly a lot more fun than designing
this whole thing and trying to build
this thing and certainly a lot more
flexible too and you probably start to
imagine how we could use a couple of
these for each digit to do a you know
decimal display or or actually display
something more than just a single
hexadecimal digit for 4 bits but we'll get
to that in future videos
the thing I want to cover the next video
is actually a much faster way to program
these without having to set all these
jumpers as you can imagine it gets pretty
tedious once you get is a 256 or more
values into here what I want to do in
the next video is build a nice
programmer for these EEPROM chips and
its gonna be especially useful because
we're going to be using a number of
these chips both in the output display
as well as in the control logic of our
computer