Monday, January 9, 2017

8x8 LED Matrix

After having a LED matrix kicking around in my electronics bin for a few years I figured I should get it working. Using my experience from my EE classes I realized I could toggle the LED's by adressing the rows and columns. I first wrote code to be able to shift data into each shift register. I used 74hc595 shift registers. I figured I could use one shift register for the column and another one for the rows. The LED matrix is a common anode. To make a led light up it requires a 1 to be written on the row and a 0 to be written on the column. If a 1 is written to a column then the led will not turn on. My function to dump the data into the register first takes an 8x8 int array and then scans the column using a pattern of shifting a 0 over a line of 1's. So the first pattern it shifts in goes like:
1111 1110 0000 0000 
1111 1101 0000 0000 
1111 1011 0000 0000 
1111 0111 0000 0000 
...
The 8 zeros on the right are for the row pattern. Those will get shifted into the last shift register.

The code is essentially just going through each one of those in a for loop. The for loop has a variable called J it counts up. I also have a slice of code to take the row of the array and turn it into an integer and then I OR the array with the integer with the number above to get the data into a full binary pattern. Then I use the code I wrote to latch, load, and clear the shift register. The data is first written into the shift register. The problem with the shift register is that you need to display pattern all at once instead of doing it while the data is shifted down. So first you clock in the 1's and 0's. Then you latch the register to actually output the data in the registers. All in all it sounds simple but it was a little tough to do. It does not even use any interrupts. The next micro-controller class I will take will utilize interrupts and more advance timing techniques.  I was able to control this matrix that was comprised of 28 pins with only 3 pins of a micro-controller. A video can be found here:

Here is a video below of a simple 4x4 multiplexed pattern I did to make sure I knew what I was doing before I went on to design the 8x8 configuration:




Monday, August 8, 2016

2114 Ram Chip

I always had an itch to mess around with some memory both RAM and ROM. I really wanted to just be able to read/write from the memory really fast. Thankfully I had these old, early '80s, ceramic ram chips in my garage electronics cabinet. I quickly grabbed one and pulled up the datasheet.
ADDRESSING:
I read over it and looked at the pinout to see if it was manageable for my ability to work with electronics. I saw it was a parallel addressable I/O with 8 address pins and 4 I/O pins. The I/O pins are 3 state pins. I looked at the block diagram and had a little trouble understanding it. I scrolled down to the bottom of the datasheet and saw a interesting memory diagram. Pictured below. I was very confused. I was thrown off at the A0 A1 A2 A9 being at the bottom of the memory and the rest of the addresses at the top. I scratched my head for a while. Then figured I'd look at the datasheet. Still confused I then noticed the 4 column addresses A9A2A1A0. So
A9A2A1A0 could hold 4 bits. 0-15 in decimal. And 64 high in the column. I don't exactly still know why each column is a separate I/0 because the data is not serialized, only paralleled meaning each I/O can only represent a 1 or 0 at a time. That made me a little weary but I decided to press on.



  

Timing:

Next up was timing, how was I going to read and write into the chip and tell it to respond to my every command? The chip is pretty simple, there's 2 latches. One labeled W and one labeled S. To read,
W had to be logic high and S just had to go low. As long as there was a crossover between them you could read. To write was a bit more complicated with a few added steps. First, S and W need to be high. Then input the logic high/low onto each corresponding address bit. REMEMBER: A8-A3 were column addresses. So that allowed us 64 columns high. A9,A2,A1,A0 allowed us 16 memory locations of 4 bit words. So the chip was capable of 1024 four bit words or 4096 bits!



I figured I'd wire up the chip to a breadboard and put in some dip switches! Here was the result:

It worked to an extent. It was noisy but I could certainly read and write from various memory banks. I then figured I'd write a little code on my STM32 microcontroller and really get this puppy going. I'll save that for the next post!

Intro

Hello reader,

This is my blog on my electronics projects both successful and unsuccessful! I will try to document every aspect of my various projects and post photos.