Wednesday, April 15, 2009

4094 chips II

Following on from the previous post, here is where ill talk about what each of the 4 input pins on the 4094 chips do. These pins are Output enable(OE), strobe, clock and data.

Easiest one first: the OE pin is pretty much a global 'all outputs on/all outputs off' switch. I cheat here, because i dont really care if the lights are in a weird state before i start my program (if i cared, id keep OE low until i was ready to start doing stuff with my lights), ill just jump this pin directly to +5v. This probably isnt the best thing to do, but hey, it works and also saves me a pin. Additionally, i had trouble with this pin when supplying it from a parallel port (no such trouble using the basic stamp though). Keep this pin in mind when you are testing, as i kept forgetting about it and wondering for hours why nothing was working.

So now in order to set some states to my lights you do it in REVERSE ORDER. This is because the chip (or chain of chips) are shift registers. meaning the first bit you output gets put in slot 0. The second bit you output gets put into slot 0, and at the same time, whatever WAS in slot 0, gets shifted down the line to slot 1. So you start sending data like so: Send a state, then PULSE the clock pin. Pulsing means go 0->1->0 (or low,high,low) - this also assumes that clock is always set to low - which it should be. So repeat this process till all of your lights have been output. After the last clock pulse, all you should have to do now is pulse the strobe pin from low to high and back to low. This actually puts all the states that you just input into an 'active' mode and sets the 4094's outputs accordingly (there would have been no visible change to the output states until the strobe was completed).

No comments: