1
\$\begingroup\$

I am working on a state machine that will drive a state bus for a personal project. The state machine will have an output pattern like the following:

100000000
010000000
001000000
000100000
000010000
000001000
000000100
000000010
000000001
100000000

As you can see, the active bit shifts and wraps back around. I've put together the circuitry to do this; however, the results are really hit and miss. I accomplished the above with two octal flip flops, two line drivers, and a clock to change the active bit. The flip flops have the output of the line drivers going back into their input, shifted by one bit. The last bit goes back around and feeds the first bit.

My circuit only works about 1/4 of the time... the majority of the time, several bits will be high at once OR it will wrap around once and eventually the high bit will 'fade' away.

PCB circuit Schematic

I am seeking any recommendations and/or changes that I can do to make this work. I understand that the circuit isn't very elegant.. I have just been trying what I know.

Some notes:

  • The PCB layout above is meant to go on one layer - the different colors are only to help me. Furthermore, there are a few jumpers in between wires... they are always directly across from one another.

  • The schematic does not include the line drivers, only the flip-flops

\$\endgroup\$
  • 5
    \$\begingroup\$ can you not use something like a 4017 decade counter with reset on 9 \$\endgroup\$ – Grady Player Mar 15 '13 at 22:41
  • \$\begingroup\$ and do you have a scope/logic analyzer? \$\endgroup\$ – Grady Player Mar 15 '13 at 22:42
6
\$\begingroup\$

If your goal is to have one output at a time go high, you don't need a 9-bit state machine. You should probably either use a 4017 which has 10 outputs that are hit in sequence, and wire it so that it resets when the tenth output goes active, or else use a 4-bit state machine which will progress through nine states, along with a device that will output one of nine wires based upon the state of the 4-bit machine.

Alternatively, you could construct your machine so that a "1" will be shifted into an 8-bit latch only when all the other bits are zero. This could be accomplished using a 74HC688 and an inverter, or if you didn't mind having all but one of your wires be "1" (as opposed to all but one being "0") you could feed the output of your 8-bit latch into an 8-bit NAND gate.

|improve this answer|||||
\$\endgroup\$
3
\$\begingroup\$

I may be being thick but to start the process off there needs to be a definite logical 1 fed in somewhere at some point so that the 1st Dtype latch can "be set" and then this 1 can ripple thru to the next D type on the next clk cycle. Also, the clk is anded with a line that comes from somewhere else not shown on the diagram - might this be a possible problem too? On power-up there may be a bunch of random 1s set that cause something to happen fairly illogically. Digital isn't my strong point so sorry if I've missed the problem.

|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ Thanks for the comment, the state machine actually gets initialized properly from the start from a single line driver. The output enable gets turned off and they clock in the proper initial data. \$\endgroup\$ – Dave C Mar 15 '13 at 23:13
  • \$\begingroup\$ OK I hear what you say and I presume this happens along the bus S{1-8} but is your clock synchronized with this happening? I don't see evidence in the circuit that your initial upload of the correct bit pattern it "timed" to be synchronous with the clock - your clock (according to the circuit) appears to be free-running and therefore your clock may not be correctly timed to work with the initial data. \$\endgroup\$ – Andy aka Mar 16 '13 at 0:25
3
\$\begingroup\$

Since there are nine states, use a 4-bit binary counter. Contrive somehow to have it reset on the next clock when it's in the 1000 state. Feed its four bits to a decoder (74HC154) which will put out all 0 with a single 1, or the inverse of that, I forget which. Those outputs can drive your LEDs or whatever.

This has a strong design advantage: the counter is always in one of the nine valid states. The means of relating those states to the desired output pattern is also reliable. As you have seen, shift registers are not a good way to move a fixed pattern around, unless you take care to force them initially into the desired pattern, and occasional while it's running since power glitches and other interference can throw them off.

|improve this answer|||||
\$\endgroup\$
3
\$\begingroup\$

A 4017 is best fit if the requirements won't change and if you have a clock generator already available.

Otherwise a microcontroller like ATtiny2313 would easily solve the problem. For the microcontroller solution, no external components are needed, not even a clock as it has an internal oscillator. These controllers are very cheap (1-2 Euro's).

|improve this answer|||||
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.