LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with changing Vi

Hi all,

 

I have this Vi that was given to me to start communications to a Drive that is in the application. It works great, but it's missing some functionality. We're experiencing an issue where the drive may be faulted externally to the PLC (so we don't know about it) the the comms is dropped from the drive. I need to change this Vi so that I can choose to start it again.

 

Currently the Vi tries 3 times to establish comms, if it doesn't it just stops, if it does, it stops and is never called again. What would be the easiest method to call this Vi to run again even if the loop counters have stopped the loops? I'm not asking for someone to do it for me, but I'm still learning LabView and it's not obvious to me where to start.

 

Heres the Vi:

Vi.png

 

Thanks in advance!

0 Kudos
Message 1 of 3
(2,366 Views)

The answer is as always: State Machine.

http://www.ni.com/tutorial/7595/en/

0 Kudos
Message 2 of 3
(2,355 Views)

Definitely a State Machine is the way to go here.

 

Some tips to make your codes easier to read:

1. There is an Increment function.  So you do not need an Add with a 1 wired to it.  This will reduce a little bit of clutter.

2. Your loops here have a maximum number of iterations.  So change them to be FOR loops.  You can right-click on the FOR loop to enable the Conditional Terminal so that you can stop the loop early.  This will eliminate all of your counter logic and make it easier to read.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 3
(2,316 Views)