LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How avoid cycle when using Labview to simulate coupled NAND-gates?

I'm taking a course in digital circuits, and tried to use labview to simulate simple digital circuits, like AND, OR, etc. This is ok, when I change true/false controls, the output indicator behaves as expected. I then tried to wired a little more complex circuits like flip-flops, and got stuck with cycle errors.
 
See attached fil to get the idea of one such simple "locking-circuit": Two NAND-gates where output of first goes to one input of second and vice versa.
 
I tried to solve it by making a while-loop with a 0,1s delay, with a shift register so output from the NAND-gate is kept one cycle, but I still got cycle errors.
 
Ideas? Hints?
 
Ola
0 Kudos
Message 1 of 3
(2,866 Views)

You need ot understand "dataflow". 😉

  1. A node or structure will execute once all inputs have received data.
  2. A node or structure will produce output once everything in it has finished.

In your particular case, the upper AND cannot start until the lower AND has finished and vice versa. You are deadlocked. 😞

Place your code inside a while loop and look into feedback nodes and shift registers. You should get it all working. 🙂

Good luck and keep us posted.

A good tool to get a feeling of dataflow is execution highlighting. Try it!

Message 2 of 3
(2,833 Views)
Thanks, just one feedback node, and putting everything inside a while loop did it!
 
Ola
0 Kudos
Message 3 of 3
(2,803 Views)