06-02-2010 12:28 PM
Solved! Go to Solution.
06-02-2010 12:30 PM
superomario wrote:
I want to send two commands to my device, the first to stop running and the second to exit remote control mode. This is done over RS232. What I want is a way to put this in my existing VI which tells the device to run. Right now if i stop the program the devices just run at the last command unless i stop them manually. How can i set up a stop button that wont send any commands unless pressed? I tried the case structure but did not know how to put a "do nothing" part if ithe stop button in the while loop is not pressed.
Have the stop button be a boolean control.
If true, write the command to the device using 'serial write' in the case structure.
If false, you don't need to put any code, just leave the case blank.
06-02-2010 12:32 PM
06-02-2010 12:33 PM - edited 06-02-2010 12:34 PM
06-02-2010 12:36 PM
06-02-2010 12:41 PM - edited 06-02-2010 12:42 PM
1) Just because the code appears left to right on your block diagram doesn't mean that is the order in which the code operates.
This means that the 3 'serial write' operations on the left don't necessarily occur before the code in the while loop.
2) The 'unwired terminal' error has to do with your while loop. There is no condition set to stop the loop, so it will loop infinitely.
When would you like the loop to stop? Is this supposed to continually loop until the stop button is pressed?
If so, wire your 'stop' control to the red stop sign in the bottom right of your while loop.
3) You have no 'Wait' function in your while loop, so it will run as fast as possible,
which is probably much faster than the device can receive and process the data that is being sent to it.
06-02-2010 12:44 PM
06-02-2010 01:14 PM
06-02-2010 01:21 PM
Try this VI.
It is a modified version of your VI.
Notice that the data flow is dictated by the wires, rather than the position of the code.
You still need a wait function though, I'm not sure what time scales you are working with.
06-02-2010 01:23 PM