Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

UC232R and Flat Sequence Structures

Within the while loop below, I am trying to ensure that my code is making a connection between the PC and the rig I am working with. I am updating 8 test rigs that turn and measure the torque applied to multi-turn valves. For each rig, two serial connections are sent to a PC so I have 16 different devices where 8 devices are one model and another 8 are a different model. My problem is that I need to distinguish which device is sending/receiving information based on both its rig and its model. The subVIs shown work, but I am experiencing an error within the flat sequence structure. The program will enter the while loop, pass a true, and the rig ID. Each rig has a corresponding torque sensor and stepper motor that is identified through it’s serial number (VISA communication). All of the subVIs within run independently, but when added to this sequence, the first frame (torque sensor search) is the only one to execute. There is an issue passing to the next frame and getting the next subVI to execute. The rig ID continues to be passed through (pink wire). Also, the first frame will execute when I first open and try to run this VI, but will not execute a second time. Is it possible the while loop is causing this error, or could it be a timing issue?

 

Device Conenction Loop.PNG

0 Kudos
Message 1 of 4
(2,296 Views)

My first concern is that I do not see any error handling.  If you pass errors out of your subVI, you can chain together your VIs using the error cluster.  This would eliminate the need for the sequence structure and you might find an error is being thrown which is messing up everything else.


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 2 of 4
(2,284 Views)

I have added error handling, but that has not changed anything. The sub vi's are not passing errors and neither is the rest of the code. The problem is getting the subvi's to execute within the sequence structure. The Torque Sensor Search.vi will run once, but only when the top level vi is first opened. None of the following vi's within the flat sequence execute properly, but they do independently when the top level vi has not yet been ran. They pass a false indicating that there was not an error, but they pass a blank string instead of the required com port, which impacts the connection trying to be made to the rig. 

0 Kudos
Message 3 of 4
(2,261 Views)

Hi ltksl,

 

Would you be able to provide the exact error? This could help us narrow down its source.

 

Also, as it has been suggested, using error wires to force data flow instead of the flat sequence structure may increase readability and performance.

 

You also mentioned that the first SubVI runs only when the top-level VI has executed first, and the subsequent SubVIs only run when the top-level VI hasn't executed first. Is there anything related to your dependencies in your project that could be causing this behavior?

Mike B.
Technical Support Engineer
National Instruments
0 Kudos
Message 4 of 4
(2,240 Views)