LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQ - VI getting Hung

Hello all,
 
This vi is used for reading current from a channel of PXI slot. Measuring the speed from that current is the ultimate goal and also to find the maximum speed value.
The following vi looks ok technically, but when I run it, the problem arises.
 
Requirement is, when "pass_on" is true, the case-structure should start and accumulate all the values with the array connected and then measure the max value of that array by using "array max min" manipulator. The array must store all the values from the time "pass_on" starts(true) till the "pass_on" goes off(false) and it should repeat.
 
I have tried in shown manner using while loop combination also, but result is hanging up. To be precise about th problem, the moment "pass_on" is on, the vi hangs up. I know my vi may not run unless you have the hardware, but I am enclosing the file. Can anyone also post any working example depicting above situation, excluding the DAQ h/w??
 
Thanking you for your time.
Download All
0 Kudos
Message 1 of 5
(3,004 Views)

Technically, your VI doesn't look ok at all.Smiley Wink

While your inner while loop is spinning, the outer while loop is paused, waiting for the inner to finish. The inner cannot finish because it needs the local variable to be updated, which can never happen. You need to get a better grasp of dataflow and how LabVIEW executes code. Turning on highlight execution would have revealed the problem. There is a simple way to accomplish what you want and it does not require any local variables or additional loops. Try the attached mod. It uses a shift register and a build array to accumulate values that pass.

0 Kudos
Message 2 of 5
(2,994 Views)
Hello Mr. Dennis,
 
Your advice is really incredible and realised the loop lock. There were few modifications needed, to achieve the full operation, which I have done successfully. I am just enclosing the replica,if you would like to have a look.
 
Just a clarification: Why the while loop does not recognize the change in local variable that was fed through the loop's tunnels??(referring to my old file) B'coz in my first vi, the while loop never comes out as you said, inspite of the change in connected variable through its tunnel.
 
Thanking you once again for all your help.
0 Kudos
Message 3 of 5
(2,969 Views)

You didn't have a connected variable through a tunnel - you had a local variable inside the while loop. The local wan't doing anything becuase the place where you were writing to it wasn't getting updated. Even if you had used a wire going through a tunnel, that wouldn't have worked either. The while loop would only get the intitial value of the wire. You can't pass updates to loop until it stops and your restart it.

And why did you go and mess up a perfectly good example. Smiley Surprised The shift register and indicator will work just like I did it. A local variable is just bad programming in this case.

0 Kudos
Message 4 of 5
(2,962 Views)
HI,
 
Your example is intact and with me. There were few reasons for my modfications,
 
- In your example the max_speed is not changing according to every occurence of pass_on.
 
-The array is getting reset when false case occurs, i.e when pas_on goes off. Actually, the max_speed has to be calculated at that point from all the values stored in the array from  the point when pass_on is on by using araay max min function.
 
Note: max_speed is the max value within the time since pass_on gets on and off. So max_speed is not the max value of over all, its just in one cycle and it may be different for every time pass_on gets on and off.
 
Hope I am able to convinve you.
 
Thanking you.
0 Kudos
Message 5 of 5
(2,946 Views)