LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help making simple VI run correctly

Hi everyone, I am somewhat new to LV.  I'm not a programmer by any means but I would like to become familiar with the software.  I am working on a work project and I need help getting the VI to run the way I need it to.

 

This will be a program to send commands to a RoboCylinder linear actuator contoller.  All I want it to do right now, is wait for the user to click on a "command button" (example: Turn Servo On/Off, Home Actuator, Move to Position), write the correct string to the controller, pause and wait for the next command.

 

Right now, I can only press one button.  In order to send the next command, I need to abort the program and re-run it.  

 

You be wondering why I have that while loop in there.  I'm trying to make the program run until I press a STOP button.  The problem is that the while loop is looping (obviously) the VI.  How can I keep the program running, but make it pause to await the next command?

 

Also, I notice the command buttons are staying pushed even after I set them as a "push till released" button.  

 

The program is communicating fine with the controller.

 

Any help on this would be appriciated!  Thanks,  Mac

0 Kudos
Message 1 of 7
(2,235 Views)

Event structures should almost always be in a loop and loops should have one event structure. You really only need the while loop and one event structure inside the while loop.

 

Instead of wiring to the loop stop terminal you should put your stop button in a value change event for that button. Wire through the event structure to the loop stop terminal.

=====================
LabVIEW 2012


0 Kudos
Message 2 of 7
(2,220 Views)

One problem you have is that you have multiple event structures, and many of them share the same events.  I have no idea why you have an event structure around the initial serial configuration VI.

 

The second problem is that you have "Lock front panel until event completes" set.  So when you hit a button for the second time, the first event structure captures that and locks the front panel until the event completes.  But the event never completes because the initial event structure is no longer in the path of execution once it has run one time.

Message 3 of 7
(2,218 Views)

Try this. I added comments so that you could see what I did.

Tim
GHSP
0 Kudos
Message 4 of 7
(2,204 Views)

Thanks everyone for the help.  I deselected the "Lock front panel" option and it seems to make everything run the way I want it.  

 

Aeastet, thanks for modifying the VI.  Unfortunately, I'm still running 8.2 and was not able to view it.

 

Mac

0 Kudos
Message 5 of 7
(2,169 Views)

Here is an 8.0 version. You might want to take a look at what I did. It will make your life easier.

Tim
GHSP
Message 6 of 7
(2,149 Views)

Tim,

 

Wow, thank you so much for using your own time to create this for me!  This is invaluable information for me.  Since I am relatively new to LV, I will have to study what you did and get back to you.  Your program looks so much cleaner.  I really need to understand arrays, and shift registers because they seem very useful.  Let me look at your program longer and then I'll get back to you with any questions.  Thanks again!

 

Mac

0 Kudos
Message 7 of 7
(2,131 Views)