06-29-2017 03:41 AM
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:
Thanks in advance!
06-29-2017 03:46 AM
The answer is as always: State Machine.
06-29-2017 05:38 AM
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.