LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using stop button boolean in case structure

Your green wire does not go to the selector terminal of the case structure. You still have only the dynamic data there.

0 Kudos
Message 11 of 24
(1,874 Views)

How can I do that other than with a combined signal like earlier?

0 Kudos
Message 12 of 24
(1,869 Views)

disconnect the dynamic data wire instead?

0 Kudos
Message 13 of 24
(1,864 Views)

I see. I should have clarified your instructions. Thank you for being patient with my ignorance.

 

I realized after my last post that I had not tried other ways of feeding a boolean to the case selector. I tried an 'exclusive or' and that works!

 

My last problem is sending 'true' to the stop condition. When the case selector sees 'false' I need the content of the case structure to execute and send a constant 'true' to 'stop condition'. But, the stop condition sees 'true' and the case structure never executes. Any thoughts on this?

 

Many thanks for your help.

 

0 Kudos
Message 14 of 24
(1,845 Views)

@phillipcurtsmith wrote:

I realized after my last post that I had not tried other ways of feeding a boolean to the case selector. I tried an 'exclusive or' and that works!


That seems quite random. Is the "not" still in there? There are plenty of other boolean operations (AND, OR, Implies, etc.) and it is not clear why a XOR would provide the correct truth table. Does it really? An XOR is the same as a "not equal", meaning you get a TRUE if the values differ.

 


@phillipcurtsmith wrote:

My last problem is sending 'true' to the stop condition. When the case selector sees 'false' I need the content of the case structure to execute and send a constant 'true' to 'stop condition'. But, the stop condition sees 'true' and the case structure never executes. Any thoughts on this?


In the sentence above you said "it works", but now you are saying it does not. The stop cannot happen until everything in the current iteration has completed, and that includes the case structure. You are not making any sense. You don't even need the boolean constants in the case structure cases, a simple "NOT" on the boolean would work just fine.

 

0 Kudos
Message 15 of 24
(1,838 Views)

XOR does seem random, but the truth table (attached) verifies a valid solution. I use two XORs. Updated vi attached.

 

Yes, I say that my first problem is solved. However, I have two problems as mentioned in my OP. The second problem is that the 'false' side of the case structure sets the current to zero and sends 'true' to the 'loop condition'. However, what seems to happen is that the loop condition turns true and the code inside the case structure doesn't execute. So, the program stops without ever setting current back to 0.

 

I verified that the code inside the case structure behaves as intended by always sending 'false' to the 'loop condition'. When I do this, current returns to 0, but the program remains running.

 

Thanks again for your time. I understand I'm not always explaining myself very well.

Download All
0 Kudos
Message 16 of 24
(1,826 Views)

The reset would occur in the next iteration, but if you stop the loop, there is no next iteration, right?

0 Kudos
Message 17 of 24
(1,809 Views)

First, let's clean up your code and get rid of the Rube Goldberg stuff that you hadn't cleaned up yet.

 

Proceed with the attached code.

0 Kudos
Message 18 of 24
(1,800 Views)

Many thanks for cleaning up my code. I should have removed that outer-most loop before I posted my revised code.

 

When I run your code, I see that I have the same problem. The program does end when it should, but the current does not reset to 0. I made several attempts at revising this code to make it work. I must be dense, because I can't for the life of me get the 'feedback node' to accept an updated value of current after multiplying by 0. Code attached.

 

The functionality I'm trying to achieve is something like (in java):

 

if ( select function ) {

     current = current + 2;

} else {

     current = current * 0;       // this never happens!

     System.exit();                  // this happens successfully!

}

 

Holy cow I miss java. I appreciate your help and patience.

0 Kudos
Message 19 of 24
(1,776 Views)

Your VI is broken due to a bad connector between wires.

Do you really need to initialize the DAQ with every iteration of the loop? Wouldn't once before the loop be sufficient? Similarly, if you close after the loop, you could reset the current to zero there.

To repeat, you still don't seem to understand dataflow. Your output is written at the start of the loop iteration and nothing more will happen there once the loop stops.

 

This really is a simple problem, easily solved with a simple state machine architecture. You should never need loops inside loops for something like that.

0 Kudos
Message 20 of 24
(1,774 Views)