As I made clear, the point of this blog is to chronicle my journey towards understanding exactly how a computer works. One specific topic of inquiry that I explore in this post, is where does electricity and code intersect?
About the Build
It's a programmer's tradition to begin every first project-'Hello World'. Staying true to form... Hello World!
This project builds on the concepts explored in my previous Read Only Memory write up and employs several components as follows:
4 solderless breadboards
1 4 bit BCD counter
1 NE555 Pulse Module Square Wave Signal Generator
1 9V battery
1 9V battery enclosure
1 Breadboard Power Supply Stick Dual Voltage 5V and 3.3V
1 16 segment RED (Common Anode) LED
2 ATMEL 28c16 EEPROM ICs
4 8 pin DIP Switches
16 2n222 Transistors
16 350 Ohm resistors
22 10k Ohm resistors
Like all things in life, there are multiple ways to accomplish a singular task. It’s rare to find a scenario where there is only 1 possible solution. This can be equally limiting as it is freeing. A lot depends on your situation and constraints. That being said, I began to define what I was trying to store/display and took a step back to consider what I could do with what I had to work with.
“H”, “E”, “L”, “L”, “O” “ ” “W”, “O”, “R”, “L”, “D” “ ”
5 Letters for Hello
5 Letters for World
Each word requires exactly 5 characters. Knowing that each character occupies exactly 1 byte, I was able to determine that I require a minimum 10 addresses of memory. This wasn’t going to be an issue. However, I did immediately note an issue on the horizon.
It seems that while 10 addresses of memory would not be a problem, I only possessed 8 bit memory. While this wasn’t an issue for storing characters, the problem was that I don’t possess a LED driver that can translate 8 bits into the proper 16 segment addresses required by the Character LED. This means that I couldn’t simply store characters to be read. Instead, I needed to store the state of each segment that would be used by the LED to represent each character.
In order to accomplish this I opened up the Data Sheet for the particular LED that I have, and focused on the connection between each segment, and its corresponding pin.
From there, I painstakingly accounted for which LED Segments were required by each letter, making notes along the way.
With each letter mapped to the proper LED Segment, I began noting the state of the 16 pins for each letter.
This brought me to a new hurdle. Each letter requires the use of 16, yet I only have 8 bit memory. In order to overcome this hurdle, I decided to double up on memory. I split the high order bits of each character to 1 8 bit IC, and the low order bits for each character to another. Together, the two chips comprise 16 bits.
Now it was simply a matter of assigning the pair of states, for each character, to its respective chip and in the respective order. This was easy to accomplish with the help of my TL866 II Universal Programmer. Using the Graphical User Interface (GUI), I was able to program the chips as easy as creating a spreadsheet.
With the two chips programmed, I could now connect the output pins of each IC to that of the 16 Segment Character LED. I provided power to both chips, reference the same address and examine whether or not the LED lit correctly. I continued to address each byte 1 after the other for inspection.
Once I was able to confirm that I had correctly assembled the components responsible for retaining and displaying my message, I was able to begin assembling the components that would be responsible for driving it all. For this component, I used a 4 bit Binary-Counter-Decimal Counter (BCD) and a 555 timer.
The BCD Counter was used to count the HIGH pulses of the timer, which in turn represents the effective address for the 10 registers on both chips. Furthermore, I configured the chip to reset back to 0 count once the counter reaches 11 pulses. By knowing the amount of addresses that I would be using, I was able to determine how many bits my Binary counter needed to properly address each byte.
2 pins= 1*2^1+1*2^0 =integer 3
3 pins = 1*2^2+1*2^1+1*2^0 =integer 7
4 pins = 1*2^3+1*2^2+1*2^1+1*2^0 =integer 15
Using the calculations above, I knew that I required a binary output of 4 bits. While this project didn't require more than a count of 10, if it were required, the ability to count to 15 would have afforded me flexibility to add any space that can be used to pad the 2 words.
The 555 timer is used to generate a continuous square wave signal. This signal, when HIGH, is responsible for incriminating the counter by 1. The signal when LOW would have no impact on the counter or the display. The period of the Timer determines the duration in which a character was displayed. The period, which is a constant, is the total duration in which the Signal is HIGH and LOW. As you may be able to devise, the duration of the character could be made longer by increasing the period of the signal. Conversely, by reducing the period of the signal, you can reduce the time in which a character is shown. Instead of creating a Timer from scratch, I used a pre-built Astable adjustable Timer. Adjusting the period is a convenient matter of adjusting the potentiometer and choosing the proper capacitor. A few quick adjustments and I was able to get the letters to display at the right frequency.
I made a few mistakes on this project, but nothing that warrants the term failure. In fact this project was a complete success. Areas that were miscalculated or overlooked were the following:
I purchased a 16 Segment Display for this project but, at the time, was unaware that they come as common cathode or common anode. Not knowing to look out for this, I purchased the segment display at random and received the common anode. This added needless complexity. I had expected to power the LED by providing current respective pins. However because it already received a common voltage, I instead needed to sink the current from each lead. In the end, It required 16 resistors and 16 2n222 transistors extra. Luckily I had enough to spare.
For some reason, I hadn’t been able to cleanly reset the counter. I can’t say that I fiddled around with it too much, as I was really pleased with the way it came out. That’s not to say it doesn’t bother me.
I happily learned a great deal from this particular project. As simple as the product was, it was far more complex than I expected. It required many components, each of which taught its own lessons. In hindsight, my unfamiliarity cause this project unnecessary complexity.
From this project I feel as though I might have a better understanding of how a program functions in an application. As this was a very small program and I am under no dissolution this is how a Logic Unit works. I know that a computer would handle this in many more stages and with many more components. In the future, I will make it a point to create a project that involves a system bus and a logic unit.