Excellent video but one minor comment on the code. Currently in the write eeprom routine you set all the arduino pins to outputs and then set the address and turn the output enable off. If you had previously read the eeprom then the output enable would be active and for a very short time the eeprom's data lines would be driving the bus and the arduino pins would be as well causing contention on the bus and possible damage. It would be better to turn off the output enable before switching the arduino pins to be outputs to avoid this.
Good catch! You're absolutely right; that's something I overlooked. I just updated the code here to fix that issue: github.com/beneater/eeprom-programmer
Hi Adam, the problem is that if the output enable on the EEPROM is still active when you set the arduino pins to be outputs then both the EEPROM and the arduino will be trying to drive the bus at the same time. If one of them is trying to drive a zero on a particular bit and the other is trying to drive a one then you will effectively have a short from the positive power rail, through the output driver of (say) the EEPROM onto the bus and then down through the output driver of the Arduino to the ground rail. The output impedance of the devices can be quite low and so quite a large current can flow, this can cause the output drivers of both devices to be damaged. In the program this would only happen for a very short time (nanoseconds) and so the devices probably would be ok as there wouldn't be time for heat to build up, but if, for example, you were single stepping through the code, it could be in that state for quite some time and damage could easily occur. Best practise is to ensure there is only one device driving the bus at any one time.
Hi Ben, Hi guys! I connected the LEDs to 74HC595. When I switch power ON or upload a sketch onto the microcontroller, the diodes light up (like running lights) for a short time and go out - is this normal? I added the OE (CE) control pin and set it to HIGH, but anyway led's light up, in this case as was expexted like a flash, not running lights
Im a house builder and for years I have been trying to get my head around basic programing and electronics. I have collecting machine parts and pieces. I have many little projects that require electronic control. Every machine I have built required manual control. I really get it now and all my learning has suddenly come togeather. Thanks so much for putting such a good learning video togeather. Dale
Dude, build me a house and I'll help you with as many Arduinos as you want! Glad it's all clicked though, I think construction workers have to have logical, systematic minds, and that's all that's really needed to understand computers. If you can figure out in your head whether a structure is built properly or not, you likely have the faculties that develop into programming.
I'm currently watching through your playlist on building the breadboard computer and I have to say I really (!) like the style with the continuous commentary over the speed up parts. There are videos of people speeding up parts but they'll first finish the comment and then speed it up without any commentary then. Your style is more compact and fluent! If I had the endurance I would probably try to recreate your breadboard computer, because it actually has taught me a lot on how CPUs internally work. Sure modern CPUs are way more complicated but in their essence they work like yours, but in yours you can see how everything is ticking along!
I love it! I imagine that programming EEPROM can get pretty complex with larger storage spaces, but this implementation really beats dropping 50 + dollars on a read / writer. AND you learn a lot. So thank you, from a beginner,
I've been a Software Engineer for 15 years. Your videos are the first I have found the explains how software works at a hardware level. I've recently decided to learn assembly language and your videos help me understand how code is translated into byte code and how processors operate. Thank you for your videos. They are a great contribution to EE and Software Engineers alike. They have helped me reestablish my curiosity in computing.
Brilliant stuff, Ben, thank you so much - I can't imagine the effort all these videos took. For an older EE/CS engineer (like me!) they totally take me back to my roots. Especially this one: in 1978 I was in my last year as an undergrad at the Univ. of Sussex in the UK. My 3rd year project was - an EEPROM programmer. It took me a whole semester, mostly because I had to build the hardware from scratch (Z80 on wirewrap boards) and write the code in Z80 assembler (assembling it on a 64K Z80 CP/M machine!). Watching you do it in an hour or so really brings home just how far things have progressed. And yet - the principles of processor architecture are not so very different.... Thanks again!!
Honestly speaking, I have never yet seen anyone else to explain these concepts in such minutely detailed way. Thanks a lot for all your hard work and time.
Funny how computing has changed so much, yet this takes me back to my old C=128 days when I used to subscribe to COMMODORE and RUN magazines, each came with programs in machine code that you had to type in using a machine code monitor program (which you had to type in the first time you used it as well). I never really understood how that worked until now, but I spent many a day typing these codes in as my good wife set dutifully beside me reading the code as I poked them into the old machine, then saved them to a 5 1/4 inch floppy. I am loving this whole series, you make a wonderful teacher, I always thrived in college when the instructor showed, hands on how things worked, even studying the law, it was the hands on paperwork that drilled down into my brain to leave the data permanently written to my memory core.
My first computer was in 6th grade, a TRS-80 in the "computer lab" at school. This would have been 1980 or so. When we first got the thing we didn't even have a way to save any programs, so you'd just have to type it in again. My dad brought in a cassette recorder which we got working (most of the time) to save code.
So nice to have these kinds of channels as an engineering student! Not all the science channels have to appeal to the general public, and the educational value on these videos are just immense!
I used to do minecraft redstone when I was like 12, and these videos are much easier to understand because of it. The most complicated stuff I made was a full-adder. Anyway nice videos you make computers seem so easy to understand!
Well done for mentioning not using pins 0 and 1 because they interfere with the serial interface, or rather it interferes with them. I spent HOURS trying to figure out the bizarre, seemingly random behaviour of my circuit (that part was reading a keypad), I dumped every variable and event I could to the PC! And every time I did that, it was setting off the problem, the debugging WAS the problem! So thanks for mentioning that, it isn't mentioned in any of the guides online I read, or the book that came with my Arduino. But it's vital knowledge.
These videos are GREAT for the beginner Electronics learners! We did this kind of stuff back in the late 80's when I was enrolled in college! Only thing then is that we did not have the convenience of using an Arduino since they did not exist back then. But we did breadboard a manual EPROM programming circuit similar to the one in the previous video in this series for educational purposes. For larger data size programming, we actually used an EPROM writer that plugged into one of the slots of an Apple II Plus computer. All you younger folks out there won't even know what I am talking about here! Kind of sad the young ones have no clue about how fast and how far technology has come in such a short amount of time. Thanks for taking me back and bringing back memories of a simpler time in life!
I have never seen anybody putting dry Theorie better to life than you in ur Videos. It Shows me that the Things I get thaught in uni are actually relevant and thats the best Motivation there is. Cant wait for ur next Video! Greetz from Germany
Every time I see people using neat wiring on breadboards remind me of high school where we also were required to trim and bend every jumper to the proper length and make it neat. Now days, people just throw jumpers in and you can never troubleshoot them easily. Thank you!
Hi Ben. Good educational stuff. But just thought I’d point out that the issue you saw with your incorrect read following write, is because you didn’t implement the (not)DATA POLLING, outlined in the 28C16 data sheet. ie. "The AT28C16 provides DATA POLLING to signal the completion of a write cycle.” DATA POLLING uses the inversion of the most significant bit (when a post write read is performed) to indicate the write busy state. Please also note that the other read bits (other than MSB), are indeterminate during the data polling busy state. So when you saw two subsequent reads of 0x81 after writing 0x2A, you’ll note the byte you wrote (0x2A) has a 0 MSB, and the read value (0x81) has a 1 MSB (ie. inverted 0 indicating busy state). The remaining bits of the 0x81 byte being indeterminate. By the third byte read, the busy state was complete, and the 3rd address data byte, and onwards, were then correctly retrieved. Likewise, the same can be seen with your second attempt to write 0x00, where you then read 0xAA bytes. Again, note the MSB is inverted from 0 to 1, to indicate data polling busy state. In summary: Although the Write Cycle Time is spec’d as max 1ms, you really shouldn’t just assume a 1ms delay will do the trick. The correct implementation would be to perform a read loop after a write, to poll for a non inverted MSB of the byte just written, to await busy state completion.
Just wondering, instead of a read after a write, would writing the same address/byte twice back to back satisfy the timing requirement of the 1ms busy threshold? Basically use a second write cycle immediately after the first write as a timing padding instead of waiting for the MSB inversion, which as an added benefit would write every address/byte twice for reliability. Or waiting for the busy MSB inversion explicitly neccessary?
@@BillAnt I'm only guessing but I'd say that all you'd do would be to reset the write cycle and you'd still have to wait just as long after the end of your second write cycle. Also, these EEPROMs automatically implement the correct write cycle timing internally so doing a second write would not make the data any more reliable than a single write. I'm guessing that if you hold the write pulse for much more than the maximum specified time, you will cause a second write cycle. All this would do is wear out the EEPROM a bit faster.
Melkior Wiseman < Got ya... I was just thinking by sending multiple write cycles quickly back to back it would "pad" the timing threshold long enough, but if you're saying that will only reset the cycle, then that's probably not going to work (boo!). On the other hand holding the write pulse just a little longer might yield a a more reliable write (if anyone cares about it at all). I really love these "simple" digital circuits, since modern computers rely on the same basic principles, but of course vastly more complex.
I changed my writeEEPROM function. I added a local copy of the data variable that is used for shifting the data to the pins on the arduino and instead of the last 'delay(10);' I now have 'while (readEEPROM(address)!=data) delay(1);' This speeds up the writing considerably and I have yet to see any sideeffects.
I really love the way that you explain the workings of the digital electronics. The progression from the d-flip-flop to the shift register was awesome. You make me feel like I can do this stuff myself.
Before I found your channel the best thing I could do is program a tiny 45 with my arduinos. Thank you so much for making me understand that I can program so much more!
If you read the datasheet carefully, it says if you read from the chip, and the write cycle is not yet finished, the MSB of the data will be the INVERSE value of the data you are writing. The other data outputs are undefined at this time. After pulsing the /WR line, you should enable the chip output and monitor the value of IO7, waiting until it matches the MSB of the byte you wrote. That way you're not stuck inserting arbitrary delays in your code, and you can never enter in to a race condition with the write cycle, like you are here. This is the reason you get funky data when reading the chip, directly after writing to it.
(just checking myself). The complete cycle time is 1000ns. As long as I stay >1ms I should be fine. To squeeze out the last of the spec speed would require the polling. Am I far off? :)
I'm building up something like this- but for mine, I went with counter chips, 74HC163s with their Qn outputs wired to their Dn+1 inputs - Since count enable is active high and load is active low, I just connect them together as a mode bit, no need for glue logic. Effectively it works as either a counter or a shifter, depending on the mode bit- so I can shift in an address, flip the mode bit, then step through further addresses with just one clock cycle each. I was originally planning on having the data pins do double duty and use a '138 to address which counter to load with 4 bits at a time, but watching this video inspired the shift register configuration, and it just happened to work out really nicely.
To get rid of the delay(10) in the writeEEPROM function, you could take advantage of the inverted data polling feature of those EEPROMs that lets you directly determine when the write cycle has completed. After clocking the write enable pin, switch back to reading that address and wait until the data you wrote appears on the output pins. A few other possible enhancements I thought of while watching that I might try - Speeding it up by cycling the addresses in a De Brujin sequence rather than incrementing the address. That way only a single bit has to be shifted in for each write. - Using the SPI perhiperhal to write to the shift registers much faster than doing it in software. The 74HC595 is rated for up to 25 MHz, significantly faster than even the CPU clock speed for the arduino. Hook the shift register data pin to MOSI, the shift clock to SCK, and then you only need to use a single digital pin for the latch. - Re-wire the data pins to be in the correct order in the GPIO pin registers, so that the byte can be reassembled more quickly: read the two pin registers, mask off the relevant bits, and just or them together.
Hmmm, a neater way to show the sequence is a series of digits showing the number of the bit that is flipped. So the above sequence would be: 0123 0121 0123 0121 Another sequence I found that can be extended for any number of bits: 2-bit: 0101 3-bit: 0102 0102 4-bit: 0102 0103 0102 0103 5-bit: 0102 0103 0102 0104 0102 0103 0102 0104 etc.
By selecting Arduino nano you can use A6 and A7. They defined in board definition file. nano.name=Arduino Nano nano.upload.tool=avrdude nano.upload.protocol=arduino nano.bootloader.tool=avrdude nano.bootloader.unlock_bits=0x3F nano.bootloader.lock_bits=0x0F nano.build.f_cpu=16000000L nano.build.board=AVR_NANO nano.build.core=arduino nano.build.variant=eightanaloginputs
of all the things in this video, what impressed me most was how you read the binary out forwards while moving your left hand left and your right hand right without sliding off point. well done I suppose lol
If Ben is improvising during the video, then he is a super star indeed and if he really plans each step on the way then he is a super super star ....really unbelievable great tutorial ....well done young man.
@7-Minute Crafts it's both.. he's already built all this he's just re-building it in the videos and is stealing the wires (and components?) from the origional build.
Jesus you’re so smart man. Seriously a lifetime of knowledge it seems like. You explain things so well and simply, too. I just graduated college last year and I have so much to learn. I love watching your videos and learning things I’ll probably never do but I still enjoy learning about it. Thank you man and please keep it up. Great work
Was about to say. The only difference is analog pins have analog capability as well. I wish Arduino had done this differently and given all pins a labelled digital io address. Then they could have added an analog number to em as well. Would have saved so much trouble for a lot of beginners.
@@1kreature Multiple names for the same pin seems to me like a more confusing thing for beginners. It can also lead to annoyances such as needing to keep track of which digitals are also analogs, when designing a circuit that requires analogs, so that you don't end up using the dual-use pins when a digital-only pin would do, and then need to swap them around later. I already find myself doing having to be mindful of which pins do PWM out so I don't waste them. As long as beginner knows the analog pins can also do output, they can use analogWrite to get a 'high' value.
@@lucasoliveirasaintrain4298 the reason being that A6 and A7 are unique to that package of the ATMEGA328P, they aren't available on the DIP package, meaning that the Nano is significantly better than the Uno.
I like how even though he could have used the analog pins or maybe grabbed a Mega, but instead shows us a great way to get more bits out of a limited number of pins. Even better
IdealSound & Performance : Mobile Agreed, I’d love an entire video of Ben explaining bitwise operations. I haven’t worked with them too much but I have a tough time understanding them sometimes.
@@NoahWL1 No doubt. As much as you know about EE, cool tricks like this are always good to know. Who thinks of using an eeprom as a 7seg decoder? It may not be the most "practical" in some peoples eyes but damn cool.
You could have used the analogue pins as outputs also. Pns A0 - A5 are on PORT C which can be used as normal IOs 😁 A6-A7 are only connected to the ADC MUX though.
I watched the three videos you posted for manipulating binary to a seven segment display, very well done sir! I am a Electronic Tech, did my schooling in 1986-1988 and it brings back some great memories of learning digital logic and serial in parallel out shift registers! Now tying all of that into an EEPROM being written to and read by an Arduino Nano! I would like to learn more about programming the Arduino's, I have a UNO that I bought awhile ago to rescue my 3d Printer that was bricked from a bad flash, so I haven't really programmed it to do anything yet, but that is about to change! Thanks Again!!!
I built a manual EEPROM programmer for 2816 EEPROMS I’ve used in various projects, not long after I purchased a TOP2005 programmer for about $15 around 10 years ago, it’s useful to test a large number of IC’s I commonly use as well as programming numerous EPROM’s, Flash, & Microcontrollers.
This is a wonderful video with everything clearly explained so even a newbie can understand it. Thanks, Ben. If anyone is wondering, this circuit can be used to program any EEPROM with similar programming characteristics up to 32K by 8 bits (256 bits) without any substantial modification to the circuit (just make a few more connections between the shift registers and the EEPROM address pins) and with only minor changes to the control program. This circuit could be used as the basis for programming even larger EEPROMs by simply adding more shift registers, although there would need to be more extensive changes made to the program to account for sending the extra address bits.
hi, i've made this circuit with a 28c256, a 32k eeprom, but the there are missing bytes, like : 00 5e 00 b4 00 88 00 3d 00 ff 00 79 00 aa 00 99. do you know how i solve this?
@@joaopaulo0903 It sounds like you're counting by twos instead of by ones. One possibility is that address line 0 (zero) is not properly connected which would make that pin "float" high so that it appears to always be set to 1. That would produce the symptoms you're describing since it would cause the programmer to program the same byte twice while also missing programming one byte. Another possibility is that you may have mixed up the address wires between the shift registers and the EEPROM. In particular, address line 1 (the second address line when counting from zero) may be switched with a different address line. Check which pin of the shift register that address line is connected to and my guess is that you'll find it's the wrong pin. Then you just need to find which pin it was switched with and fix it.
This is the most engaging channel I've ran into in a long time. Not only because I'm interested in the content but because everything is explained so concisely and intuitively.
This is extremely calming, and not only is fascinating in its own right, but also makes lovely background noise. I actually listened to this while putting together a website of mine
Instead of using the 'bool outputEnable', you can convert an analog pin to digital pin. Say we wanted to make A0 go high then low, we would do it the same as a normal digital pin: pinMode(14, OUTPUT); digtalWrite(14, HIGH); delay(1000); digitalWrite(14, LOW);
as has been pointed out, all pins on most modern micro controllers can be used as I/O normally with a digital aspect it is referred to as tri state logic meaning it can, sink and source current as well as being high impedance as an input.
This is a great tutoral. I wish that they would have done Lab work like this in Digital Electronics at Ivy Tech State College. It makes things so much easier to understand and you rolled 4 days of lessons into a half hour thats understandable. Keep up the good work.
Well he prints it out in hexdec, so in order to check if it works, he would have to do the conversion at some point. Or just print out in binary, but that's a bit too long to read easily.
Ben - THANK YOU for this video! Thanks to your tutelage, I was able to easily create a modified design of your circuit for a 16KB D27128A EPROM. That EPROM is used for the OS ROM in my old Atari computer. I was able to pull the data off my custom OS EPROM and dump it into a binary file to load into my old system (which now has a way to load ROM files for the OS). Mine doesn't look as nice as yours does though - I don't have customized lengths of wire that fit in nice and neat. You saved me a good bit of money too, since the programmers you can buy on Amazon/eBay are upwards of $100.
The main problem is that he is using the wrong datasheet. The -25 after the device name is the speed grade and this is very slow. I didn't find the good datasheet too be I saw some -20 that had a 10ms write cycle... The cleanest solution would be to implement the data polling test that checks if the write cycle is finished. This way you can adapt the write speed to the actual performance of the eeprom whatever grade or brand you use.
So I've been rewatching some of your old videos while working on my current project which involves an ATmega328P, which I just stuck into a socket on my board instead of using a pre-built Arduino board. I've been learning a lot about the low-level workings of the AVR processor series, and one thing I recently found out is that you can actually use analog pins A0-A5 as digital I/O if you don't need analog input functionality. You can just do pinMode(A0, OUTPUT) and digitalWrite(A0, HIGH) and it will just work. In fact, if you use I2C, the SDA and SCL pins are actually the same as A4 and A5! If you follow the traces on the Uno board, they both go to the same pins, PC4 and PC5. The two extra inputs available on the Nano, A6 and A7, are exclusively analog inputs, though.
As usual, excellent content. Humble, to the point, clear. Ben, your work helps to quickly understand things, which are not so clear when reading datasheet. I wish you all the best!
This is great. I'm new to Arduino so I really I like seeing random chips that I've never seen before like that shift register and how it works. Could you do a series showing more random things like that? There's projects in the past that I would have used a shift register if I had known about it but I didn't at the time!
I enjoyed the video very much, helped me to recap on some of my rusty digital principals.Your command of C is really good. With reference to so many viewer asking why not just use a 7 segment driver chip...that was not the intention of this exercise. It is a great tutorial on the making of an eeprom programmer. It is not only to program a 7 segment display. If you follow the further you will notice how this programmer is used to change code in the MCU.
Maybe you can do a similar circuit from the pushbutton to limit the pulse of the switch with the arduino. I don't tried it yet but if you put the 680 resistor in series with the arduino pin and the capacitor, and the other leg of the capacitor to a 10k resistor and then to ground, when the arduino sends a 1uS pulse the capacitor will charge via the 680 Resistor, and while is charging you should have a logic one in the other part of the capacitor, when you set the pin to low then the capacitor discharges via the same resistor as before, so it shoul work as the pushbutton, if you want to get the low pulse just change the 10K resistor to VCC and the Arduino pin to High, and it should do the job :/ I repeat, I dont tried it yet, but it should work
Great video, very stimulating. If you wanted to save space and reduce chips to program just the AT28C16, you would only need one 8-bit Shift Register (SR). You have 20 I/O dedicated on the Nano but you need 21. Using 3 I/O to pick 5 more bits using a SR leaves you with 17 free I/O with 8 Outputs out of the SR as Address lines which are only inputs on the EEPROM. So, 3 I/O to control the SR, 8 in the SR as Address, 3 I/O as 3 more Address (11 in all), 8 I/O for Data, and 2 I/O for READ/Write Control. That gives you 16 I/O used with 4 I/O to spare. In fact, you really don't need to strobe the SR value into the SR outputs, the SR is being used as an Address extender, and the EEPROM will not respond to "twiddling" bits as you shift in a new Address - as long as it is stable before you strobe the Read/Write pins. So that frees up one more I/O to 5 spare. But, then again, using two SRs to get 11 bits of Address in the SR which does free up 3 more I/O - a total of 8 unused spare I/O. To your readers: Go with the two SR approach, it will get you up to 16 addresses if you need them for larger EEPROMs. And you can always cascade more SRs to get even more Address lines if you ever want to load an EEPROM over 64K Bytes. This is an awesome video. It has inspired me to build one with a Zero Insertion Force (ZIF) socket.
Someone needs to make good quality breadboards with more than 5 rows per column, power rails that line up with the columns (some do some don't depending on the brand) and aren't split by a blank spot every 5 holes PLUS have two extra power rails running down the middle where the channel is on standard ones.
There are stray capacitance issues with normal breadboards, where you have many lengths of contact strips lined up in parallel, like that. I wonder if lengthening the contact strips, like you suggest, wouldn't make those issues worse? It would certainly add to the resistance of each channel. Also, I don't think there is much room for another two rows for power/gnd rails in the middle channel, while still keeping it close enough to support most ICs.
You can use a analog inputs as digital pins as follows. Program the analog pin as an input, then program the pin high. This will make the pin into a digital pin with a pullup. Repeat this for each analog pin.
I bugged out on 22:00 where you convert address 1234 into binary. How do you do it so fast ? Did you cut the video to calculate it? Great and clear video anyway, thank you.
This is how I do it: 1) 1024 is the largest power of 2 that fits in 1234, which corresponds to a 1 with ten trailing 0's (because 1024 = 2^10). 2) 1024 easily subtracts from 1234, leaving 210. 3) 210 is 255 minus 45. 255 is eight 1's in binary (because 256 = 2^8). So we set the last eight bits to 1. 4) To subtract 45, we turn off the 32 bit (leaving 13), the 8 bit (leaving 5), the 4 bit (leaving 1), and the 1 bit (leaving 0), which is the first, third, fourth and sixth bit respectively if counting from right to left. (The idea here is that at this point you're working with smaller numbers which are easier to deal with). 5) Writing it out we get: 1 (from the initially subtracted 1024) 00 (the first two zero bits of the ten trailing 0's. Two because we're about to write the remaining eight 1's of the 255). 11010010 (eight 1's with the first, third, fourth and sixth (from right-to-left) bit changed to 0's to account for subtracting 45). Thus: 10011010010 Final check: 1234 is an even number. Even numbers should have a zero at the end in binary (least significant bit). This is true.
for some reason this made me want to build an electromechanical EEPROM programmer that reads punched cards, or even those scantron cards from school that require a #2 pencil
Another video of Ben I loveto watch. As always very interesting, I'm learning so much. I had no idea how an Eeprom programmer worked and Ben, you make it so simple to understand. And honestly even your code is elegant and it real pleasure to watch you write it.
Seems like it would have been simpler just to have an address register, and a data register, load them directly in separate steps, then pulse the write signal.
yes, as I was watching a video I thought the same thing. Although, form learning perspective, it's nice to see the shift register in action. Also, I believe it's a part needed in the Control Unit, I think for the sequencer
You would not use two registers. You use one that drives the address lines. This was pretty standard practice back in the day. The Arduino's data and address lines are shared, but the address is stored in the register (D flip-flop). First, output the address, clock it into the register, and then output the data. Now set output enable on the register, and do the write. You can still read data directly into the Arduino pins.
I did not follow all (most) of that but as good a tutorial as I have ever seen, well presented. Took me back to my Nascom days when I had much more understanding. This old fella is going to trawl through this vid quite a few times more yet. Many thanks.
Yes, analog pins are usually just digital pins with hardware PWM generators attached. But if there are enough digital pins, it's best to use those first because PWM is a bit expensive to do in software. Basically keeping them open in case you need them later.
I thought so, i just asked if those pins could be used since I'm more into PICs than AVRs. So the answer is: A0 thru A5 can be used as digital I/O, withouth any catch. Those can be used as analog inputs as well. A6 and A7 seems to be only analog. The PWM peripheral can be attached to other pins, so it doesn't has anything to do with analog.
Yes, the analog pins are simply also connected to an ADC or comparator, they can still be used as digital I/O. The PWM capable pins are a different set.
You don't actually need to worry about the WE pulse length being too long here; while the AT28C16 has a maximum listed, the datasheet for the CAT28C16A (the chip you're using) does not give a maximum. It also states that the write cycle can take up to 10 ms after WE goes high, so that explains why you needed to increase that delay.
@@patrickdoyle4581 I did say “usually”. Because C is zero-indexed in most cases, < usually makes more sense; you go from 0 to n-1 inclusive, or while it’s < n. That isn’t always the case.
@@danielrhouck Again, it depends on how you'd explain it to a colleague. I'd pretty much always use < if looping through an array, or with the idiom "for (i=0; i
Hallelujah !!! That was a tough one for me. I had my ups and downs with this one, but never gave up. After finishing the project, I looked though your updated code and added the Erasing EEPROM, which helped, as the first time I ran it, it did not appear to be doing anything, but I guess that is because it takes a little while to fully erase. Anyway, thank you for the video, it was FUN !!! Even though I do have a simple($40) programmer, that I could use. It is always fun learning new ways of doing things. Thank you
By just watching it is not enough, I have to get my own chips, proto boards, cables and so on. Get all ready and try to follow. Great videos. I will make your video lessons one of my projects. Thanks.
*sigh* I already know all this. When are you going to teach me something I don't already know? (lol this was as sarcastic as I could muster. I bow in the presence of a Master) This was brilliant. So clever.
3.5 hours worth of straightforward and fun work programming and setting up breadboards, or 8 hours of dipswitches, address setting and head pounding. Your choice.
This is the best video about shift registers what i see on yt, i learn a lot from this film. I watched more of Your video and i learned a lot from them. You are excellent teacher!
Wouldn't it be faster to just use two latches which would latch the address and data and then assert the write signal? That's just two clock cycles for each byte instead of one clock cycle for each bit :q
Thankyou for posting this! :) This is extremely helpful as I'm about to embark on making my own microcomputer :) One thing though - noticed you used D13 as the write enable - this pulses everytime a new program is uploaded to the arduino, I believe that would cause data to be lost from the EEPROM? Would it not be better to use one of the analog lines as a digital output?
I ended up making my own programmer for my 28C256 chip using the same serial to parallel ICs and nano. I am glad I haven't drifted off the way too much - the only difference is the arduino sketch.
Hi Russ.. would you be able to share your sketch at all? I'm trying to use the same chip with Ben's sketch and circuit diagram but haven't had any success
@@Inquire98: In other words, why are there quotation marks around the first "thank you"? Another possibility to ask about is: Is that a fake " thank you"? No, likely not. Right? So what are they there for?
@@HelloKittyFanMan. My use of the characters may be a mistake 🙄 doesn't mean I am not sincere 😉 So, PLEASE accept my apologies for my use/wrong use of quotations marks 😉
@@Inquire98, you don't have to apologize to me; I was just curious. So do you know how to use the editing tool here to remove them then (without removing the whole post, of course)?
Nice job! I've just noticed for myself that if you don't have 74HC595 you can use 74HC164, but with CLEAR signal instead of STORE. In this case you must modify algorithm a little, but it will be working here too.
Hello Ben, Nice Arduino EEPROM programmer I was hoping you were going to use a cheap simple microcontroller to program EEPROM with the Binary to 7 Segment decoding data.
"getting really old" This used to be the ONLY way to boot some legacy hardware... you had to manually program in the boot sequence with switches just like this.... Those long winter evenings in the server room used to just fly by......
haha I remember doing just that on PDP11s. Toggle in the bootstrap loader and get it going enough to read from the teletype. Same for the GEC 4000 except those were equipped with hard drives which made it all quicker until we got the prom upgrades to do it for us.
My Dad watched over a system that did this in a particleboard plant. It was a Measurex system with a 2-step boot sequence. You had to manually set the instruction data switches and clock them into the processor. This machine was advanced enough to find and load from the 8-inch floppy drive with only two such instructions. They cut him loose around 2004, so I guess they finally upgraded.
Thank you so much for explaining how old EEPROMs work :-) I plan on building a nixie tube clock with 7-segment nixie tubes and really appreciate your efforts to explain
Your videos are very cool. It takes me back to my college years when I used to build circuits like this. I still have one on a breadboard that I made in the mid 80’s. I have to say, your wiring is much cleaner than mine.
This is one of the most amazing channel here on TH-cam! For GEEKs!!! BTW, from where did you got all this knowledge of electronics and computer architecture? Salute to you👍👍
Excellent video but one minor comment on the code. Currently in the write eeprom routine you set all the arduino pins to outputs and then set the address and turn the output enable off. If you had previously read the eeprom then the output enable would be active and for a very short time the eeprom's data lines would be driving the bus and the arduino pins would be as well causing contention on the bus and possible damage. It would be better to turn off the output enable before switching the arduino pins to be outputs to avoid this.
Good catch! You're absolutely right; that's something I overlooked. I just updated the code here to fix that issue: github.com/beneater/eeprom-programmer
What are the negative side effects of doing that?
Hi Adam, the problem is that if the output enable on the EEPROM is still active when you set the arduino pins to be outputs then both the EEPROM and the arduino will be trying to drive the bus at the same time. If one of them is trying to drive a zero on a particular bit and the other is trying to drive a one then you will effectively have a short from the positive power rail, through the output driver of (say) the EEPROM onto the bus and then down through the output driver of the Arduino to the ground rail. The output impedance of the devices can be quite low and so quite a large current can flow, this can cause the output drivers of both devices to be damaged. In the program this would only happen for a very short time (nanoseconds) and so the devices probably would be ok as there wouldn't be time for heat to build up, but if, for example, you were single stepping through the code, it could be in that state for quite some time and damage could easily occur. Best practise is to ensure there is only one device driving the bus at any one time.
Hi Ben, Hi guys! I connected the LEDs to 74HC595. When I switch power ON or upload a sketch onto the microcontroller, the diodes light up (like running lights) for a short time and go out - is this normal? I added the OE (CE) control pin and set it to HIGH, but anyway led's light up, in this case as was expexted like a flash, not running lights
Did you put resistors in series with LEDs? 74HC595 has balanced output and LEDs are basically short circuits for this chip.
Im a house builder and for years I have been trying to get my head around basic programing and electronics. I have collecting machine parts and pieces. I have many little projects that require electronic control. Every machine I have built required manual control. I really get it now and all my learning has suddenly come togeather. Thanks so much for putting such a good learning video togeather. Dale
Dude, build me a house and I'll help you with as many Arduinos as you want! Glad it's all clicked though, I think construction workers have to have logical, systematic minds, and that's all that's really needed to understand computers. If you can figure out in your head whether a structure is built properly or not, you likely have the faculties that develop into programming.
I'm currently watching through your playlist on building the breadboard computer and I have to say I really (!) like the style with the continuous commentary over the speed up parts. There are videos of people speeding up parts but they'll first finish the comment and then speed it up without any commentary then. Your style is more compact and fluent!
If I had the endurance I would probably try to recreate your breadboard computer, because it actually has taught me a lot on how CPUs internally work. Sure modern CPUs are way more complicated but in their essence they work like yours, but in yours you can see how everything is ticking along!
It’s 2:30 in the morning as I watch this video and never have I been more excited for my last year as an EE undergrad to start
The Bob Ross of electronics returns.
Just Browsing definitely
There are no mistakes, just happy accidents. *burns 5 chips*
Haha, I was thinking Bob Ross as well. So calming, and makes it look easy.
"let's just put a transistor... right... there... that looks nice."
That is a high level well fitting compliment.
I love it! I imagine that programming EEPROM can get pretty complex with larger storage spaces, but this implementation really beats dropping 50 + dollars on a read / writer. AND you learn a lot. So thank you, from a beginner,
I've been a Software Engineer for 15 years. Your videos are the first I have found the explains how software works at a hardware level. I've recently decided to learn assembly language and your videos help me understand how code is translated into byte code and how processors operate. Thank you for your videos. They are a great contribution to EE and Software Engineers alike. They have helped me reestablish my curiosity in computing.
Are you interested for book? Tietze/Schenk explains also how microprocessor electronic circuits work, and also starts with basic analogue electronics
Brilliant stuff, Ben, thank you so much - I can't imagine the effort all these videos took. For an older EE/CS engineer (like me!) they totally take me back to my roots. Especially this one: in 1978 I was in my last year as an undergrad at the Univ. of Sussex in the UK. My 3rd year project was - an EEPROM programmer. It took me a whole semester, mostly because I had to build the hardware from scratch (Z80 on wirewrap boards) and write the code in Z80 assembler (assembling it on a 64K Z80 CP/M machine!). Watching you do it in an hour or so really brings home just how far things have progressed. And yet - the principles of processor architecture are not so very different.... Thanks again!!
Honestly speaking, I have never yet seen anyone else to explain these concepts in such minutely detailed way. Thanks a lot for all your hard work and time.
Funny how computing has changed so much, yet this takes me back to my old C=128 days when I used to subscribe to COMMODORE and RUN magazines, each came with programs in machine code that you had to type in using a machine code monitor program (which you had to type in the first time you used it as well). I never really understood how that worked until now, but I spent many a day typing these codes in as my good wife set dutifully beside me reading the code as I poked them into the old machine, then saved them to a 5 1/4 inch floppy. I am loving this whole series, you make a wonderful teacher, I always thrived in college when the instructor showed, hands on how things worked, even studying the law, it was the hands on paperwork that drilled down into my brain to leave the data permanently written to my memory core.
My first computer was in 6th grade, a TRS-80 in the "computer lab" at school. This would have been 1980 or so. When we first got the thing we didn't even have a way to save any programs, so you'd just have to type it in again. My dad brought in a cassette recorder which we got working (most of the time) to save code.
So nice to have these kinds of channels as an engineering student! Not all the science channels have to appeal to the general public, and the educational value on these videos are just immense!
I used to do minecraft redstone when I was like 12, and these videos are much easier to understand because of it. The most complicated stuff I made was a full-adder. Anyway nice videos you make computers seem so easy to understand!
Same here bro 👍
Nice, I built the Scott CPU in Minecraft plus a whole 64 byte RAM but looking back at it I'm pretty sure there is lots of optimization possible
Well done for mentioning not using pins 0 and 1 because they interfere with the serial interface, or rather it interferes with them. I spent HOURS trying to figure out the bizarre, seemingly random behaviour of my circuit (that part was reading a keypad), I dumped every variable and event I could to the PC! And every time I did that, it was setting off the problem, the debugging WAS the problem! So thanks for mentioning that, it isn't mentioned in any of the guides online I read, or the book that came with my Arduino. But it's vital knowledge.
These videos are GREAT for the beginner Electronics learners! We did this kind of stuff back in the late 80's when I was enrolled in college! Only thing then is that we did not have the convenience of using an Arduino since they did not exist back then. But we did breadboard a manual EPROM programming circuit similar to the one in the previous video in this series for educational purposes. For larger data size programming, we actually used an EPROM writer that plugged into one of the slots of an Apple II Plus computer. All you younger folks out there won't even know what I am talking about here! Kind of sad the young ones have no clue about how fast and how far technology has come in such a short amount of time.
Thanks for taking me back and bringing back memories of a simpler time in life!
I have never seen anybody putting dry Theorie better to life than you in ur Videos. It Shows me that the Things I get thaught in uni are actually relevant and thats the best Motivation there is. Cant wait for ur next Video! Greetz from Germany
therealnightwriter I love how that’s all you noticed
You really like random capitals, don't you?
@@HelloKittyFanMan. In German all nouns get capitals
@@uklu: This isn't German, though, is it? So your point is...?
@@HelloKittyFanMan. he said he is from germany
There is something satisfying seeing electronics and computer science being done so smoothly, without any hiccups
It’s ASMR, for computer nerds
He really is great background noise
I sleep to him...
It actually is gibberish if you're not paying attention
I was going to post something along these lines
Asynchronous Master Reset?
Every time I see people using neat wiring on breadboards remind me of high school where we also were required to trim and bend every jumper to the proper length and make it neat. Now days, people just throw jumpers in and you can never troubleshoot them easily. Thank you!
Hi Ben. Good educational stuff. But just thought I’d point out that the issue you saw with your incorrect read following write, is because you didn’t implement the (not)DATA POLLING, outlined in the 28C16 data sheet.
ie. "The AT28C16 provides DATA POLLING to signal the completion of a write cycle.”
DATA POLLING uses the inversion of the most significant bit (when a post write read is performed) to indicate the write busy state. Please also note that the other read bits (other than MSB), are indeterminate during the data polling busy state.
So when you saw two subsequent reads of 0x81 after writing 0x2A, you’ll note the byte you wrote (0x2A) has a 0 MSB, and the read value (0x81) has a 1 MSB (ie. inverted 0 indicating busy state). The remaining bits of the 0x81 byte being indeterminate.
By the third byte read, the busy state was complete, and the 3rd address data byte, and onwards, were then correctly retrieved.
Likewise, the same can be seen with your second attempt to write 0x00, where you then read 0xAA bytes. Again, note the MSB is inverted from 0 to 1, to indicate data polling busy state.
In summary: Although the Write Cycle Time is spec’d as max 1ms, you really shouldn’t just assume a 1ms delay will do the trick. The correct implementation would be to perform a read loop after a write, to poll for a non inverted MSB of the byte just written, to await busy state completion.
Just wondering, instead of a read after a write, would writing the same address/byte twice back to back satisfy the timing requirement of the 1ms busy threshold? Basically use a second write cycle immediately after the first write as a timing padding instead of waiting for the MSB inversion, which as an added benefit would write every address/byte twice for reliability. Or waiting for the busy MSB inversion explicitly neccessary?
@@BillAnt I'm only guessing but I'd say that all you'd do would be to reset the write cycle and you'd still have to wait just as long after the end of your second write cycle.
Also, these EEPROMs automatically implement the correct write cycle timing internally so doing a second write would not make the data any more reliable than a single write. I'm guessing that if you hold the write pulse for much more than the maximum specified time, you will cause a second write cycle. All this would do is wear out the EEPROM a bit faster.
Melkior Wiseman < Got ya... I was just thinking by sending multiple write cycles quickly back to back it would "pad" the timing threshold long enough, but if you're saying that will only reset the cycle, then that's probably not going to work (boo!). On the other hand holding the write pulse just a little longer might yield a a more reliable write (if anyone cares about it at all). I really love these "simple" digital circuits, since modern computers rely on the same basic principles, but of course vastly more complex.
Came here for this comment, was not disappointed. Glad to see someone took the time to figure the spec out as well!
I changed my writeEEPROM function. I added a local copy of the data variable that is used for shifting the data to the pins on the arduino and instead of the last 'delay(10);' I now have 'while (readEEPROM(address)!=data) delay(1);' This speeds up the writing considerably and I have yet to see any sideeffects.
I've used these shift chips many times but not entirely understood how they work. Your excellent explanation has enlightened me, many thanks.
I really love the way that you explain the workings of the digital electronics. The progression from the d-flip-flop to the shift register was awesome. You make me feel like I can do this stuff myself.
Before I found your channel the best thing I could do is program a tiny 45 with my arduinos. Thank you so much for making me understand that I can program so much more!
If you read the datasheet carefully, it says if you read from the chip, and the write cycle is not yet finished, the MSB of the data will be the INVERSE value of the data you are writing. The other data outputs are undefined at this time.
After pulsing the /WR line, you should enable the chip output and monitor the value of IO7, waiting until it matches the MSB of the byte you wrote. That way you're not stuck inserting arbitrary delays in your code, and you can never enter in to a race condition with the write cycle, like you are here.
This is the reason you get funky data when reading the chip, directly after writing to it.
(just checking myself). The complete cycle time is 1000ns. As long as I stay >1ms I should be fine. To squeeze out the last of the spec speed would require the polling. Am I far off? :)
What? A 57min video?.... my lucky day. So much to learn today.
Great video not only for electronics but also programming. Thanks.
I'm building up something like this- but for mine, I went with counter chips, 74HC163s with their Qn outputs wired to their Dn+1 inputs - Since count enable is active high and load is active low, I just connect them together as a mode bit, no need for glue logic. Effectively it works as either a counter or a shifter, depending on the mode bit- so I can shift in an address, flip the mode bit, then step through further addresses with just one clock cycle each. I was originally planning on having the data pins do double duty and use a '138 to address which counter to load with 4 bits at a time, but watching this video inspired the shift register configuration, and it just happened to work out really nicely.
To get rid of the delay(10) in the writeEEPROM function, you could take advantage of the inverted data polling feature of those EEPROMs that lets you directly determine when the write cycle has completed. After clocking the write enable pin, switch back to reading that address and wait until the data you wrote appears on the output pins.
A few other possible enhancements I thought of while watching that I might try
- Speeding it up by cycling the addresses in a De Brujin sequence rather than incrementing the address. That way only a single bit has to be shifted in for each write.
- Using the SPI perhiperhal to write to the shift registers much faster than doing it in software. The 74HC595 is rated for up to 25 MHz, significantly faster than even the CPU clock speed for the arduino. Hook the shift register data pin to MOSI, the shift clock to SCK, and then you only need to use a single digital pin for the latch.
- Re-wire the data pins to be in the correct order in the GPIO pin registers, so that the byte can be reassembled more quickly: read the two pin registers, mask off the relevant bits, and just or them together.
I have never heard of De Brujin sequences before but from your description I tried creating some and this is my favourite one I found:
| 0000 | 0 |
| 0001 | 1 |
| 0011 | 3 |
| 0111 | 7 |
| 1111 | 15 |
| 1110 | 14 |
| 1100 | 12 |
| 1000 | 8 |
| 1010 | 10 |
| 1011 | 11 |
| 1001 | 9 |
| 1101 | 13 |
| 0101 | 5 |
| 0100 | 4 |
| 0110 | 6 |
| 0010 | 2 |
Hmmm, a neater way to show the sequence is a series of digits showing the number of the bit that is flipped. So the above sequence would be: 0123 0121 0123 0121
Another sequence I found that can be extended for any number of bits:
2-bit: 0101
3-bit: 0102 0102
4-bit: 0102 0103 0102 0103
5-bit: 0102 0103 0102 0104 0102 0103 0102 0104
etc.
Wow. First video I've seen using shift registers for a purpose instead of just explaining how they work. Good Job!
Just FYI Arduino Nano's Pins A0 to A5 (not A6 nor A7) can also be used as digital Pins D14-D19
I was just about to point that out
By selecting Arduino nano you can use A6 and A7.
They defined in board definition file.
nano.name=Arduino Nano
nano.upload.tool=avrdude
nano.upload.protocol=arduino
nano.bootloader.tool=avrdude
nano.bootloader.unlock_bits=0x3F
nano.bootloader.lock_bits=0x0F
nano.build.f_cpu=16000000L
nano.build.board=AVR_NANO
nano.build.core=arduino
nano.build.variant=eightanaloginputs
@@nadircatalkaya5011 and that gives exactly the 21 pins needed for the eeprom. Funny how that works!
of all the things in this video, what impressed me most was how you read the binary out forwards while moving your left hand left and your right hand right without sliding off point. well done I suppose lol
If Ben is improvising during the video, then he is a super star indeed and if he really plans each step on the way then he is a super super star ....really unbelievable great tutorial ....well done young man.
@7-Minute Crafts it's both.. he's already built all this he's just re-building it in the videos and is stealing the wires (and components?) from the origional build.
Jesus you’re so smart man. Seriously a lifetime of knowledge it seems like. You explain things so well and simply, too. I just graduated college last year and I have so much to learn. I love watching your videos and learning things I’ll probably never do but I still enjoy learning about it. Thank you man and please keep it up. Great work
Pro tip: You can use the analog pins of the Arduino as Digital GPIO pins :)
Was about to say. The only difference is analog pins have analog capability as well.
I wish Arduino had done this differently and given all pins a labelled digital io address. Then they could have added an analog number to em as well.
Would have saved so much trouble for a lot of beginners.
Yeah, except for pins A6 and A7 in the Arduino Nano: You can use A0 through A5, but not A6 and A7
@@1kreature Multiple names for the same pin seems to me like a more confusing thing for beginners. It can also lead to annoyances such as needing to keep track of which digitals are also analogs, when designing a circuit that requires analogs, so that you don't end up using the dual-use pins when a digital-only pin would do, and then need to swap them around later. I already find myself doing having to be mindful of which pins do PWM out so I don't waste them. As long as beginner knows the analog pins can also do output, they can use analogWrite to get a 'high' value.
@@lucasoliveirasaintrain4298 the reason being that A6 and A7 are unique to that package of the ATMEGA328P, they aren't available on the DIP package, meaning that the Nano is significantly better than the Uno.
That's where the macros PIN_A0 through PIN_A5 come in. They map to 14..19
I like how even though he could have used the analog pins or maybe grabbed a Mega, but instead shows us a great way to get more bits out of a limited number of pins. Even better
This video is awesome & very well done, keep it up. Best shift register explanation ever too, you could chop that up into its own video even!
IdealSound & Performance : Mobile Agreed, I’d love an entire video of Ben explaining bitwise operations. I haven’t worked with them too much but I have a tough time understanding them sometimes.
@@NoahWL1 No doubt. As much as you know about EE, cool tricks like this are always good to know. Who thinks of using an eeprom as a 7seg decoder? It may not be the most "practical" in some peoples eyes but damn cool.
This guy literally taught what I learnt in university for a couple of semesters in just a few hours of video
You could have used the analogue pins as outputs also. Pns A0 - A5 are on PORT C which can be used as normal IOs 😁 A6-A7 are only connected to the ADC MUX though.
I watched the three videos you posted for manipulating binary to a seven segment display, very well done sir! I am a Electronic Tech, did my schooling in 1986-1988 and it brings back some great memories of learning digital logic and serial in parallel out shift registers! Now tying all of that into an EEPROM being written to and read by an Arduino Nano! I would like to learn more about programming the Arduino's, I have a UNO that I bought awhile ago to rescue my 3d Printer that was bricked from a bad flash, so I haven't really programmed it to do anything yet, but that is about to change! Thanks Again!!!
Thank you Ben,we love you!
I built a manual EEPROM programmer for 2816 EEPROMS I’ve used in various projects, not long after I purchased a TOP2005 programmer for about $15 around 10 years ago, it’s useful to test a large number of IC’s I commonly use as well as programming numerous EPROM’s, Flash, & Microcontrollers.
This is a wonderful video with everything clearly explained so even a newbie can understand it. Thanks, Ben.
If anyone is wondering, this circuit can be used to program any EEPROM with similar programming characteristics up to 32K by 8 bits (256 bits) without any substantial modification to the circuit (just make a few more connections between the shift registers and the EEPROM address pins) and with only minor changes to the control program.
This circuit could be used as the basis for programming even larger EEPROMs by simply adding more shift registers, although there would need to be more extensive changes made to the program to account for sending the extra address bits.
hi, i've made this circuit with a 28c256, a 32k eeprom, but the there are missing bytes, like : 00 5e 00 b4 00 88 00 3d 00 ff 00 79 00 aa 00 99. do you know how i solve this?
@@joaopaulo0903 It sounds like you're counting by twos instead of by ones. One possibility is that address line 0 (zero) is not properly connected which would make that pin "float" high so that it appears to always be set to 1. That would produce the symptoms you're describing since it would cause the programmer to program the same byte twice while also missing programming one byte.
Another possibility is that you may have mixed up the address wires between the shift registers and the EEPROM. In particular, address line 1 (the second address line when counting from zero) may be switched with a different address line.
Check which pin of the shift register that address line is connected to and my guess is that you'll find it's the wrong pin. Then you just need to find which pin it was switched with and fix it.
on really i dont connected the 5v jumper on protoboard haha. sorry and thank you
@@joaopaulo0903 No Problem. I've often found that re-checking my work will lead to me discovering a mistake. I'm glad it worked for you.
This is the most engaging channel I've ran into in a long time. Not only because I'm interested in the content but because everything is explained so concisely and intuitively.
Exelent tutorial. Now I know how shift register is working.
This is extremely calming, and not only is fascinating in its own right, but also makes lovely background noise. I actually listened to this while putting together a website of mine
Instead of using the 'bool outputEnable', you can convert an analog pin to digital pin. Say we wanted to make A0 go high then low, we would do it the same as a normal digital pin:
pinMode(14, OUTPUT);
digtalWrite(14, HIGH);
delay(1000);
digitalWrite(14, LOW);
Wait, it's possible to use analog pins as digital outputs? 😨😨
what about current constrains
@@pararera6394 yes, the analog input is an alternate function in the chip anyway. Read the datasheet.
as has been pointed out, all pins on most modern micro controllers can be used as I/O normally with a digital aspect it is referred to as tri state logic meaning it can, sink and source current as well as being high impedance as an input.
You should disable the EEPROM's outputs BEFORE you change the data lines' pinModes to OUTPUT to avoid the potential for microseconds of conflict.
This is a great tutoral. I wish that they would have done Lab work like this in Digital Electronics at Ivy Tech State College. It makes things so much easier to understand and you rolled 4 days of lessons into a half hour thats understandable. Keep up the good work.
44:01 I think you could use the RC circuit you made before with the delay to be more precise when writing on ROM
agreed
Can not believe you putting so much effort for explaining. Thank you
You don't have to convert the truth table binaries to hexadecimal, you can just write them as binary literals in C: '0x4C' is equal to '0b01001100'.
I've always thought that "0x" was the only hex prefix available, then comes "0b" along ... learned something new today :)
@@BillAnt 0x, 0b, 0d, 0h, Oh My! 😵
Well he prints it out in hexdec, so in order to check if it works, he would have to do the conversion at some point.
Or just print out in binary, but that's a bit too long to read easily.
There’s also `0o` for octal values.
@@ExEBoss But is there 0wo?
Ben - THANK YOU for this video! Thanks to your tutelage, I was able to easily create a modified design of your circuit for a 16KB D27128A EPROM. That EPROM is used for the OS ROM in my old Atari computer. I was able to pull the data off my custom OS EPROM and dump it into a binary file to load into my old system (which now has a way to load ROM files for the OS). Mine doesn't look as nice as yours does though - I don't have customized lengths of wire that fit in nice and neat. You saved me a good bit of money too, since the programmers you can buy on Amazon/eBay are upwards of $100.
The main problem is that he is using the wrong datasheet. The -25 after the device name is the speed grade and this is very slow. I didn't find the good datasheet too be I saw some -20 that had a 10ms write cycle...
The cleanest solution would be to implement the data polling test that checks if the write cycle is finished. This way you can adapt the write speed to the actual performance of the eeprom whatever grade or brand you use.
Yes You are Right . the Chip calculate if it has finished the last input data and continues to 2 input.
So I've been rewatching some of your old videos while working on my current project which involves an ATmega328P, which I just stuck into a socket on my board instead of using a pre-built Arduino board. I've been learning a lot about the low-level workings of the AVR processor series, and one thing I recently found out is that you can actually use analog pins A0-A5 as digital I/O if you don't need analog input functionality. You can just do pinMode(A0, OUTPUT) and digitalWrite(A0, HIGH) and it will just work. In fact, if you use I2C, the SDA and SCL pins are actually the same as A4 and A5! If you follow the traces on the Uno board, they both go to the same pins, PC4 and PC5.
The two extra inputs available on the Nano, A6 and A7, are exclusively analog inputs, though.
tanx, for note with (chip datasheet): delay(10);
(45:45 add delay(5); (5ms?))
49:06 "ups?" (reading wrong 51:26)
51:55 (what datasheet say AT28C16 / AT28C16E (write cycle time)) (Typ 0.5ms , Max 1.0ms )
(how Arduino get 0.5ms or 100us or 200us?)
As usual, excellent content. Humble, to the point, clear. Ben, your work helps to quickly understand things, which are not so clear when reading datasheet. I wish you all the best!
This is great. I'm new to Arduino so I really I like seeing random chips that I've never seen before like that shift register and how it works. Could you do a series showing more random things like that? There's projects in the past that I would have used a shift register if I had known about it but I didn't at the time!
I enjoyed the video very much, helped me to recap on some of my rusty digital principals.Your command of C is really good. With reference to so many viewer asking why not just use a 7 segment driver chip...that was not the intention of this exercise. It is a great tutorial on the making of an eeprom programmer. It is not only to program a 7 segment display. If you follow the further you will notice how this programmer is used to change code in the MCU.
Maybe you can do a similar circuit from the pushbutton to limit the pulse of the switch with the arduino. I don't tried it yet but if you put the 680 resistor in series with the arduino pin and the capacitor, and the other leg of the capacitor to a 10k resistor and then to ground, when the arduino sends a 1uS pulse the capacitor will charge via the 680 Resistor, and while is charging you should have a logic one in the other part of the capacitor, when you set the pin to low then the capacitor discharges via the same resistor as before, so it shoul work as the pushbutton, if you want to get the low pulse just change the 10K resistor to VCC and the Arduino pin to High, and it should do the job :/ I repeat, I dont tried it yet, but it should work
Great video, very stimulating. If you wanted to save space and reduce chips to program just the AT28C16, you would only need one 8-bit Shift Register (SR). You have 20 I/O dedicated on the Nano but you need 21. Using 3 I/O to pick 5 more bits using a SR leaves you with 17 free I/O with 8 Outputs out of the SR as Address lines which are only inputs on the EEPROM. So, 3 I/O to control the SR, 8 in the SR as Address, 3 I/O as 3 more Address (11 in all), 8 I/O for Data, and 2 I/O for READ/Write Control. That gives you 16 I/O used with 4 I/O to spare. In fact, you really don't need to strobe the SR value into the SR outputs, the SR is being used as an Address extender, and the EEPROM will not respond to "twiddling" bits as you shift in a new Address - as long as it is stable before you strobe the Read/Write pins. So that frees up one more I/O to 5 spare. But, then again, using two SRs to get 11 bits of Address in the SR which does free up 3 more I/O - a total of 8 unused spare I/O. To your readers: Go with the two SR approach, it will get you up to 16 addresses if you need them for larger EEPROMs. And you can always cascade more SRs to get even more Address lines if you ever want to load an EEPROM over 64K Bytes. This is an awesome video. It has inspired me to build one with a Zero Insertion Force (ZIF) socket.
Ok, I know I'm not crazy, now. There need to be breadboards with rows that have more than 5 pins.
Someone needs to make good quality breadboards with more than 5 rows per column, power rails that line up with the columns (some do some don't depending on the brand) and aren't split by a blank spot every 5 holes PLUS have two extra power rails running down the middle where the channel is on standard ones.
There are stray capacitance issues with normal breadboards, where you have many lengths of contact strips lined up in parallel, like that. I wonder if lengthening the contact strips, like you suggest, wouldn't make those issues worse? It would certainly add to the resistance of each channel. Also, I don't think there is much room for another two rows for power/gnd rails in the middle channel, while still keeping it close enough to support most ICs.
You could use a jumper wire because for me I never need more than 3 apart from the power
You can use a analog inputs as digital pins as follows. Program the analog pin as an input, then program the pin high. This will make the pin into a digital pin with a pullup. Repeat this for each analog pin.
I bugged out on 22:00 where you convert address 1234 into binary. How do you do it so fast ? Did you cut the video to calculate it?
Great and clear video anyway, thank you.
This is how I do it:
1) 1024 is the largest power of 2 that fits in 1234, which corresponds to a 1 with ten trailing 0's (because 1024 = 2^10).
2) 1024 easily subtracts from 1234, leaving 210.
3) 210 is 255 minus 45. 255 is eight 1's in binary (because 256 = 2^8). So we set the last eight bits to 1.
4) To subtract 45, we turn off the 32 bit (leaving 13), the 8 bit (leaving 5), the 4 bit (leaving 1), and the 1 bit (leaving 0), which is the first, third, fourth and sixth bit respectively if counting from right to left. (The idea here is that at this point you're working with smaller numbers which are easier to deal with).
5) Writing it out we get:
1 (from the initially subtracted 1024)
00 (the first two zero bits of the ten trailing 0's. Two because we're about to write the remaining eight 1's of the 255).
11010010 (eight 1's with the first, third, fourth and sixth (from right-to-left) bit changed to 0's to account for subtracting 45).
Thus: 10011010010
Final check: 1234 is an even number. Even numbers should have a zero at the end in binary (least significant bit). This is true.
It's all about recognizing the powers of 2.
Erm... he worked it out in advance. You don't think he starts recording with no preparation do you?
This is one of the greatest learning videos I ever saw on any platform
for some reason this made me want to build an electromechanical EEPROM programmer that reads punched cards, or even those scantron cards from school that require a #2 pencil
Another video of Ben I loveto watch. As always very interesting, I'm learning so much. I had no idea how an Eeprom programmer worked and Ben, you make it so simple to understand. And honestly even your code is elegant and it real pleasure to watch you write it.
Seems like it would have been simpler just to have an address register, and a data register, load them directly in separate steps, then pulse the write signal.
yes, as I was watching a video I thought the same thing. Although, form learning perspective, it's nice to see the shift register in action. Also, I believe it's a part needed in the Control Unit, I think for the sequencer
please do a video about it then.
That would seem to complicate the circuit even more. The issue here are some off timings possibly due to the read/write cycle speed of the chip.
and how would you read them then?
You would not use two registers. You use one that drives the address lines. This was pretty standard practice back in the day. The Arduino's data and address lines are shared, but the address is stored in the register (D flip-flop). First, output the address, clock it into the register, and then output the data. Now set output enable on the register, and do the write. You can still read data directly into the Arduino pins.
I did not follow all (most) of that but as good a tutorial as I have ever seen, well presented. Took me back to my Nascom days when I had much more understanding. This old fella is going to trawl through this vid quite a few times more yet. Many thanks.
Do the "analog" pins can be used as digital i/o? I think you can... On PICs thats completly possible!
Yes, analog pins are usually just digital pins with hardware PWM generators attached. But if there are enough digital pins, it's best to use those first because PWM is a bit expensive to do in software. Basically keeping them open in case you need them later.
Correct, analog pins can be set digital also.
Mike
Aaron King Aren`t A0 to A5 analog inputs? PWM by the way is only available on special digital Pins
I thought so, i just asked if those pins could be used since I'm more into PICs than AVRs. So the answer is: A0 thru A5 can be used as digital I/O, withouth any catch. Those can be used as analog inputs as well. A6 and A7 seems to be only analog.
The PWM peripheral can be attached to other pins, so it doesn't has anything to do with analog.
Yes, the analog pins are simply also connected to an ADC or comparator, they can still be used as digital I/O. The PWM capable pins are a different set.
You don't actually need to worry about the WE pulse length being too long here; while the AT28C16 has a maximum listed, the datasheet for the CAT28C16A (the chip you're using) does not give a maximum. It also states that the write cycle can take up to 10 ms after WE goes high, so that explains why you needed to increase that delay.
Good video but do you know that you can use pin A0 to A7 as digital pin on the ardino
only up to A5 ; A6 and A7 don't work
Brilliant. I was just about to build this from scratch using an ATmega 2560 for 16 digital pins. This saved me loads of time.
On code style, usually you'd make the condition on the for loops use < instead of
Using < is no less prone to off-by-one errors than
@@patrickdoyle4581 I did say “usually”. Because C is zero-indexed in most cases, < usually makes more sense; you go from 0 to n-1 inclusive, or while it’s < n. That isn’t always the case.
@@danielrhouck Again, it depends on how you'd explain it to a colleague. I'd pretty much always use < if looping through an array, or with the idiom "for (i=0; i
Hallelujah !!! That was a tough one for me. I had my ups and downs with this one, but never gave up.
After finishing the project, I looked though your updated code and added the Erasing EEPROM, which helped,
as the first time I ran it, it did not appear to be doing anything, but I guess that is because it takes a little while to fully erase.
Anyway, thank you for the video, it was FUN !!! Even though I do have a simple($40) programmer, that I could use. It is always fun learning new ways of doing things.
Thank you
34:02 I’ve had that problem too where my computer won’t recognise the Arduino unless I restart it
It’s very strange
Updated CH232 drivers should do the trick
By just watching it is not enough, I have to get my own chips, proto boards, cables and so on. Get all ready and try to follow. Great videos. I will make your video lessons one of my projects. Thanks.
*sigh* I already know all this. When are you going to teach me something I don't already know? (lol this was as sarcastic as I could muster. I bow in the presence of a Master) This was brilliant. So clever.
Thanks so much. i was just looking for a propitiation check on EEPROM and you were very clear and concise.
Before writing 42, you should have made sure you knew where your towel was.
yes. and your copy of the guide.
and your fish.
Th joke goesː there may be an [iː] in team, but there is no [m] in Mohawk.
i have never seen such great video to understand how computer works
Did he do all of this just so that he doesn't have to manually load data into the EEPROM with switches?
3.5 hours worth of straightforward and fun work programming and setting up breadboards, or 8 hours of dipswitches, address setting and head pounding. Your choice.
This is the best video about shift registers what i see on yt, i learn a lot from this film. I watched more of Your video and i learned a lot from them. You are excellent teacher!
Wouldn't it be faster to just use two latches which would latch the address and data and then assert the write signal? That's just two clock cycles for each byte instead of one clock cycle for each bit :q
Great explanations, crystal clear (even for non-native-english people).
Thanks a lot for this video of excellent quality.
Thankyou for posting this! :) This is extremely helpful as I'm about to embark on making my own microcomputer :)
One thing though - noticed you used D13 as the write enable - this pulses everytime a new program is uploaded to the arduino, I believe that would cause data to be lost from the EEPROM? Would it not be better to use one of the analog lines as a digital output?
Actually it blinks while booting not uploading, while uploading rx and tx blinks
I ended up making my own programmer for my 28C256 chip using the same serial to parallel ICs and nano. I am glad I haven't drifted off the way too much - the only difference is the arduino sketch.
Hi Russ.. would you be able to share your sketch at all? I'm trying to use the same chip with Ben's sketch and circuit diagram but haven't had any success
"Thank You", thank you very much 😀 This is a REALLY good tutorial 😎
Haha, are you quoting yourself, or...?
@@HelloKittyFanMan. I'm not understanding your response 🙄 PLEASE explain 🤔
@@Inquire98: In other words, why are there quotation marks around the first "thank you"? Another possibility to ask about is: Is that a fake " thank you"? No, likely not. Right? So what are they there for?
@@HelloKittyFanMan. My use of the characters may be a mistake 🙄 doesn't mean I am not sincere 😉 So, PLEASE accept my apologies for my use/wrong use of quotations marks 😉
@@Inquire98, you don't have to apologize to me; I was just curious. So do you know how to use the editing tool here to remove them then (without removing the whole post, of course)?
Nice job! I've just noticed for myself that if you don't have 74HC595 you can use 74HC164, but with CLEAR signal instead of STORE. In this case you must modify algorithm a little, but it will be working here too.
Hello Ben,
Nice Arduino EEPROM programmer I was hoping you were going to use a cheap simple microcontroller to program EEPROM with the Binary to 7 Segment decoding data.
Started for eeprom programming but learned a lot about bit wise operations
What is the wire you use for this? Your cable management is awesome.
47:40 you have 2 identical for loops. you could set output and digital write in same loop
"getting really old"
This used to be the ONLY way to boot some legacy hardware...
you had to manually program in the boot sequence with switches just like this....
Those long winter evenings in the server room used to just fly by......
haha I remember doing just that on PDP11s. Toggle in the bootstrap loader and get it going enough to read from the teletype. Same for the GEC 4000 except those were equipped with hard drives which made it all quicker until we got the prom upgrades to do it for us.
My Dad watched over a system that did this in a particleboard plant. It was a Measurex system with a 2-step boot sequence. You had to manually set the instruction data switches and clock them into the processor. This machine was advanced enough to find and load from the 8-inch floppy drive with only two such instructions. They cut him loose around 2004, so I guess they finally upgraded.
Thank you so much for explaining how old EEPROMs work :-) I plan on building a nixie tube clock with 7-segment nixie tubes and really appreciate your efforts to explain
How do you get your wires the perfect length?! Haha
Your videos are very cool. It takes me back to my college years when I used to build circuits like this. I still have one on a breadboard that I made in the mid 80’s. I have to say, your wiring is much cleaner than mine.
This is one of the most amazing channel here on TH-cam! For GEEKs!!!
BTW, from where did you got all this knowledge of electronics and computer architecture?
Salute to you👍👍
I like to see how the new eeprom help us with the g code enlightening our work and time. Thanks
This is how to really stop worrying and understand electronics!
holy shit, this video taught me the difference between serial and digital. either im dumb or i need to start thanking you