Wednesday, September 28, 2011

Delay in postings

I am still working on this logic contest but my camera's broken.  I'm in the hardware testing phase so no post would be right w/o the pictures.  I will post more as soon as I get a new camera.

Friday, September 23, 2011

Test Test and Retest

In my last post I gloated about my DFF always starting in the LOW state... Turns out that is wrong.  I was testing to see if the 7400 can be used as a tri-state buffer and noticed that once in a while the DFF would start high.  This does not happen often, maybe 1 in 10 times, which it turns out is infrequent enough for me not to see it when I was first testing it.  I should have tested the circuit more thoroughly but I was too excited to fully evaluate it.  This mistake wouldn't have killed the entire design as there is only one part that absolutely needs to start low, but It could have added a nuance to the game where the car wouldn't show up sometimes and you have to toggle the power switch.

I added a simple fix that seems to work, I need to do further testing to ensure it does but I can't until the rest of the parts come in next week.  I added a capacitor and a resistor that makes the clock start high and go low when the capacitor drains.  This makes the initial state of D the start condition for the output.

The standard DFF using a single 7400 Quad NAND

The advanced implementation of the DFF

Tuesday, September 20, 2011

A Little Bit of Bread-Boarding

I finished the simulation a while back but have been busy so no new posts recently.  I am still trying to find the best way to upload the logisim schematic, any suggestions in that area would be appreciated. Here is the Logisim source file!

Screen Shot of Working Simulation

I noticed when I was working with logisim the D-flip-flops (DFF) I created using NAND gates always started out in an error state.  It took a full clock cycle for them to correct this then they functioned properly until the next reset.  I have a trigger using a DFF that must start low so I needed to build it to make sure it starts low.  Most of my NAND chips are on order but I did find one left over from a project I did a few years back.

Initial Power On DFF from NAND

As you can see from the picture the /Q line is active on power on.  The white wire is the D input and the brown wire is the Clock.  After clocking in a HIGH:

DFF from NAND HIGH state

It works!  I always get excited when I see LEDs light up when they are supposed to light up.  This proved that the DFF does start in the LOW state and does work.

I have started working on the LED matrix, specifically on how to defuse the LEDs and make them into nice looking squares... but more on that in the next post.

Tuesday, September 6, 2011

Game Criteria

I should have posted about this earlier but I wanted to get a feel for what I could actually accomplish before I came up with some grandiose planes.

With any project you need to have a plan of what you want to accomplish.  Even if you don't list out this plan or write it down you still have some kind of plan in your head.  I feel it is best to list out what is needed and then list how to accomplish it.  By doing this I can see holes in my design better then if I just keep everything in my head.

What the game needs:
1.A matrix of LEDs that displayed the level
2.The ability for the level to scroll
3.The top row of the level changes to make the road move
4.LEDs to represent the car
5.The ability for the car to move left and right
6.Collision detection between the car and the grass that would end the game
7.The game needs to get harder the longer it is played

How to accomplish these things:
1. A matrix of LEDs (duh) and memory in the form of D-flip flops to hold them.
2. Arrange the D-flip flops in the form of an 8 bit wide shift register.  This allows the screen to cascade down.
3. Put a new byte in the shift register every cycle.  Either random or from non volatile memory.
4. LEDs and D-flip flops again.
5. This is harder.  A shift register that allows for left and right shifting as well as a loop back on either end so the car would not vanish off the screen but would simply stop.
6. A lot of or statements that could cancel out the oscillatory thus ending the game.
7. At specific times the game will speed up by reducing the amount the oscillator is divided.

This list will change as the project goes on and the list of how to accomplish goals will become better defined.
I will re-post this list as the project progresses and things change.

Preview of bi-directional shift register:

Monday, September 5, 2011

Bubble Pushing Shift Register

This will be just and quick post, and IT HAS PICTURES!!!  I am working on a bi-directional shift register for tracking and moving the car and I thought I would share a simple technique for reducing gate counts or in my case keeping everything NAND.  It is called bubble pushing.  Check out this PDF from Oklahoma State University on the subject, pages 14-18.

This is a key component of the bi-directional shift register. It can be simplified by bubble pushing.

Both the top and bottom block function as an OR gate.

Replace the OR gate with the three NAND gates.

The Double NOR (NAND) gates cancel giving the final result.  This also converts it to an all NAND gate configuration as well as reducing the gate count by 2 per output.

Sunday, September 4, 2011

Custom Display

Let me first start out by announcing the game.  It is the scrolling race car game, the car is at the bottom of the screen and the track comes down at you and shifts left and right, you know the one.  My fist thought was to make something that could play Doom, but I don't feel 6 weeks is enough time and it would then be out of my budget to stick with only 7400 chips so race car game it is!

Today I simulated the memory using High triggered D-flip-flops.  All the memory is just video memory, 8 bits for the car's location and 64 bits for the current view of the map.  Some things I had not though about is how to control the memory.  Addressing, input, output... all these things I have taken for granted in MCUs I am now having to design.  I am gaining a much deeper appreciation for real computer engineers.

The first challenge is making the screen scroll.  To accomplish this I made the memory resemble an 8 bit wide shift register with separate clock inputs for every row. Then I made a ring counter using rising edge flip flops and a very clever one shot device to load the initial high into it.  Each piece of the counter is tied to a row's clock pin.  The ring counter cascades the memory one row at a time starting from the bottom and moving up then repeating after reaching the top.  I need to add some sort of variable delay at this point.  The variable delay will allow the current screen to show for a moment before shifting the whole screen down again.  The delay can be decreased every so often to make the game more challenging the longer you play.  I'll come back to this.

Next is how to get the new top row of the screen into the video memory.  This is easy, the top row already has an 8 bit wide input so the signal just needs to be there when the clock is toggled.  Now I just need something to load in there... I have some Ideas for this but more on that next post.

Lastly how do I get 64 bits of data that does not have any sort of addressing system into a LED matrix that uses a row/column input?  Well, I would need 8x 8bit wide multiplexers and additional logic to drive it... NOPE, too much.  Ok, I would need to add an enable pin to every custom bit of SRAM so it could float when not in use.  This seems a little more feasible.  As I thought about how to implement this I began to notice how small the LED matrix I have is. I also began to notice how many LEDs I have laying around... a little over a hundred greens and 80 or 90 reds.   That is more then enough to build a custom matrix.  That would make it much easier to design so I think I will go with that.

Saturday, September 3, 2011


I got started with the contest by downloading Logisim.  It is incredible!  I cannot believe how powerful this software is. I skimmed over the first tutorial (I know, reading the manual... Lame!) and was able to start creating immediately.  I highly recommend this software to anyone involved in logic design.

After the initial learning curve of this software I began to work on the game.  I quickly realized just how rusty bad I am with this stuff.  I've been using MCUs for the last few years and they have made me wasteful and lazy.  For most things I do the MCU I'm using has way more RAM and FLASH storage then I need.  When you have to build the RAM with hundreds of chips and the FLASH storage is a combination of DIP Switches and resistors you tend to look at where you can trim the fat.

Open 7400 Logic Competition

I was reading HACK A DAY yesterday and stumbled across this design contest using only 7400 logic series chips.  Reading through the rules made me feel nostalgic of my intro to computer engineering class.  So I started coming up with projects to do, clock, calculator with a full custom keyboard, game of life... all the standard boring stuff that's been done a hundred times.  I need something different, something that I would not only enjoy building and showing off to my friends and parents but something I can revisit and get enjoyment out of again and again.  Something people would want to see b/c it can give them entertainment and not just a "wow, you built that... that's neat".  If you haven't been following I'm talking about a game.

But what game?  Well, I have already come up with it but I don't want to tell you what it is, not yet.  All I will say is it will have 2 buttons, a switch and a lot of LEDs for display.  I have a LED matrix laying around from a project I did years ago that I may be able to use.  How to drive it w/o an MCU will take some thought...

I will only use 7400 ICs, not the 7400 series only the 7400 chip.  I could build the game using some of the more complex 7400 series chips with relative ease, but I am looking for a challenge.  I don't want to simply throw in a memory chip, I want to design a custom memory board or boards using the nand gates to construct flip flops for each bit I need.  I reason I need 10 bytes of memory for this game, using 7400 chips I can build a simple D-flip flop with as few as 5 nand gates or 1.25 chips.  This works out to 10 chips per byte so 100 chips just for the memory!  And that's just for the memory, not including the inputs, display driver, oscillator... this will be a challenge!

I will also do it as open as possible.  That means all open software for designing it and publishing all the files as well as lots and lots of pictures.