Showing results for 
Search instead for 
Did you mean: 

Problem running two parallel while loops

Go to solution

1) Moving the VISA write outside the loop will not work if the instrument needs to get the command for ecah value it returns.


When a loop iteration starts the time delay starts. The iteration indicator updates. The Stop button is read. [ Elapsed time within the iteration is probably ~ microsecond. ] ......... The delay ends. The Write and Read occur. The other indicators including the chart update. The next iteration starts.


So what you may be seeing is the normal dataflow behavior.  Try running the loop with Execution Highlighting turned on (the light bulb on the block diagram toolbar).


2) If the issue is the dataflow I described above the timed loop will make no difference.


I am not sure exactly what you want it to do, so I cannot offer a fix suggestion.



0 Kudos
Message 81 of 95

Hi johnold,

    My main requirement from this program is the following;

Two scales collect material continuously. Now, I need the weight display reading every 15 seconds from the scales at that particular instant in time. Presently I get that correct reading only when the delay time is set to zero.

Let's say the delay time is set to 15 seconds, the weight of the added material in the 15 second duration is not displayed on the chart at the next iteration, what I get is the same reading from 15 seconds ago.


hope this helps.


0 Kudos
Message 82 of 95

Honestly, I cannot see a flaw with your logic.  It must be that the equipment itself goes into a sleep mode or something.  Have you tried really small values for your delay, like 1 ms?  I know this is a sandbox you are playing with, but I would roll all my duplicate code into a subVI (select the code you want to make into a subVI, then edit --> create subVI).  Then you can use the code in both loops.  Make sure to make the subVI re-entrant, or each loop will have to wait until the other loop is done using the subVI before it can use it.

(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 83 of 95

What does the "SIU" command actually tell the scale to do? Delaying the readings should not change the way the scale works.  I suspect that your communication with the scale is not doing exactly what you think it is doing.


Why not read the scale once per second or at some rate which appears to work but only update the chart every 15 seconds?  This could be a work-around until you solve the real problem.



0 Kudos
Message 84 of 95

The SIU command tells the scale to send current display reading "continuously". Considering this, I switched to command "SI" which tells the scale the same thing except there is no "continuously" feature. But for me, with respect to my issue, both result in the same behavior.


 I have attached screenshots of the exact description of these commands.


And, regarding updating the chart every 15 minutes, but recieving continuous data from the scales. Is this achieved by moving the time delay to the waveform section? or is there another way to do it?





Download All
0 Kudos
Message 85 of 95

The way I interpret that is that is sends what it has in a buffer but does not necessarily make a new measurement.


What is the specification on how may measurements per second that the scale can make? Not the number of readings it can transmit.


I read through the manuals you posted.  They stink. You wonder how good the equipment really is when the documentation is so bad.


Run some simple tests.  With your program with short delays (and maybe just one scale at a time) watch both the scale display and your VI while adding discrete masses to the scale. Try to estimate how long it takes for a change is mass to show up and to become stable both on the display on the scale and on your VI.



0 Kudos
Message 86 of 95

It takes between 0.8 secs and 1.0 second for a change in the display as well as labview. The difference between the display and labview is beyond my ability to visually percieve.

With regards to how many measurements the scale makes per second, I have no information in any documentation, certification given with the device.


Can the issue be caused due to VISA's default timeout?

Also, how do I program Scan from String to pass on values every 15 seconds only? That way, LabView will be set to collect data continuously, but data used will be the string every 15 seconds as you suggested in a previous post.




0 Kudos
Message 87 of 95

Elapsed Time Express VI set for 15 seconds.  The output of that will drive a case structure.

Message 88 of 95

Ravensfan, thank you. I have included the case structure and elapsed time vi. It almost does what it is supposed to do. It reads every 15 secs, but reads multiple values. I am going to try and figure out how I make it read just one string, instead of multiple strings. Specifically it reads about 8 readings every 15 seconds. I believe thats because of the time it takes for the case strucutre to switch back and forth, please let me know if i'm right?


EDIT:  Can I configure the VISA Read output tunnel on the case structure using String Pallete>something in there, to configure the case structure tunnel to let only one string through (See screenshot). Apologies for poor sentence construction.




Download All
0 Kudos
Message 89 of 95
Accepted by topic author avi0111

No. The case structure switches almost instantaneously.


You have two problems.  1. The case structure selector terminal onnly accepts booleans or integers.  You are feeding it a Double. Notice the coercion dot where the wire enters the selector. Probably several iterations of the loop occur while the Elapsed Time value is close enough to 1 that the coercion forces it to 1.  Thus, the case probably executes several times for each fifteen seconds. 2. You should use the Time has Elapsed boolean output for the case structure.  It will only be true once every 15 seconds.



Message 90 of 95