12-02-2012 06:33 PM
I am trying to change the string input that changes the case statement on my VI. I can change the case when I stop the VI and start it up again, but it also doesn't stop what the last case did. I appreciate the help! Attached is the program.
12-02-2012 06:41 PM - edited 12-02-2012 06:42 PM
Put your string inside the while loop. Your "stop" case does nothing because you're not passing anything to the while terminator.
12-02-2012 07:43 PM
Thanks, but that really doesn't help. I want the signal to time out, I am using a USB-6008 if that helps anyone.
12-02-2012 08:02 PM
What you are saying does not make much sense.
LabVIEW is a dataflow language. That means a node or block of code will execute only when it has data at all its inputs. So the while loop reads the value in Condition when the program starts. (Even it it is empty, that is still "data" because an empty string is a valid value for a string). That data is passed through the tunnel and into the loop. The Condition control will NEVER be read again while the program is running, whether its value changes or not.
If you want to be able to change the value in Condition and have it change the case which executes, you need to do what BillMe said.
What do you mean by time out? You have no timing information of any kind in your program. Your Simulate Signal VIs generate one point each time they are called (0.5, 0.5) and you convert that to an array of booleans, which ends up containing 1 True element.
Please tell us what you are really trying to do so that we can give you answers which might help you solve your problem.
Lynn
12-02-2012 08:39 PM
So what I am wanting to do is take a string input and select 1 of 5 cases, STOP, FORWARD, REVERSE, RIGHT, and LEFT. This will cause a digital signal high to come from a DAQ USB 6008.
I have it to the point where I can select the case, but I can only select the case by stopping the program, typing in the command, and then restarting it. I want to be able to not stop the program every time I want to select a different case.
Also, I cannot get the signal to stop outputting from the DAQ. I found that a solution may be to use the TIMEOUT input of the DAQAssistant. But I am unsure if this is correct as I have not successfully done this.
Thanks for your help.
12-02-2012 09:15 PM - edited 12-02-2012 09:25 PM
@seth.larimore wrote:
I have it to the point where I can select the case, but I can only select the case by stopping the program, typing in the command, and then restarting it. I want to be able to not stop the program every time I want to select a different case.
Also, I cannot get the signal to stop outputting from the DAQ. I found that a solution may be to use the TIMEOUT input of the DAQAssistant. But I am unsure if this is correct as I have not successfully done this.
Thanks for your help.
This is DATAFLOW programming! When you run your program, the while loop waits for the string control to output its value (which happens immediately upon running), then keeps that value and runs happily along, never needing the string control again.
You need to use a user event structure if you want to change the value of the string control, have something happen (like get a sample from the DAQ), then wait for you to change the string control again, do something, etc.
12-02-2012 09:57 PM
Here is a version which does not use the event structure, although that is the better way to handle user inputs.
This simply compares the current value of Condition to the the previous value and writes to the DAQ when the value changes (assuming that the new value is one of the four defined conditions.
I put a Wait in the default case so the loop does not spin thousands of times per second looking for something which takes seconds to occur. Loops without waits are called grredy loops because they can consume all of the CPU resources so that other parts of the program cannot run.
Lynn