LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

JK flip flop problem

Solved!
Go to solution

Hello,

I'm trying to simulate a 2 binary counter using JK-FF but is is not working. I tried another way such as testing 2 JK-FF with individual clock (clock 1 and clock 2) and LED (LED 1 and LED 2). When clock 1 is ON, clock 2 is OFF, LED 1 and LED 2 is on. I spent a week to solve the problem but it doesnt work. Please, help me. Thanks.

0 Kudos
Message 1 of 6
(10,355 Views)

Hi Joebui,

 

Here is another forum that deals with building a JK flip-flip that make prove helpful.  There is also a community example that deals with building a flip-flop.  Notice how this example uses case structures instead of multiple logical gates.  A case structure will make your code cleaner and will be easier to debug.   

 

Hope this helps,

 

Starla T. 

0 Kudos
Message 2 of 6
(10,294 Views)

Thank for your reply. I'm trying to build another JK-FF which use case structure. I think my JK flip flop is ok because I double check it with a truth table and it works fine. My problem here is when I put 2 individual JK flip flop in the same block diagram with individual clock and LED, the second JK's LED run when clock is low and another is high. Can you explain why we can't use multiple logic gates? 

0 Kudos
Message 3 of 6
(10,264 Views)
Solution
Accepted by topic author Joebui

Go to VI properties, Execution for your flip-flop subVI and make it reentrant.  That way each instance has its own memory state.  As it is now as non-reentrant, each call to the subVI only goes to a single memory state and thus the other flip-flop is remembering the how the feedback registers were set in the other case where it was called.

0 Kudos
Message 4 of 6
(10,219 Views)

Joebui:

 

Here is the code I promised you.  Let me know if you have questions.

 

- tbob

Inventor of the WORM Global
Message 5 of 6
(10,186 Views)

@Raven Fan: Thank you very much for your helping.

0 Kudos
Message 6 of 6
(10,160 Views)