LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

For loop output tunnel "Last value" outputting default values

Solved!
Go to solution

Hi NI Community,

 

Today I ran into a stange LabVIEW probem. An "Last Value" output tunnel of a for loop returned the default values instead of the actual Last value. The code is below:

2014-03-18 15_24_53-Testrack Actor.lvlib_Electronics Check Sequence.lvclass_Execute.vi Block Diagram.png

Below as well screenshots of the probes 44 and 45.

Probe 44.png

Probe 45.png

 

Where probe 44 contains al the data (all the boards are present (and the correct "Testrack Module" is used)) probe 45 is empty.

 

I already tryed to remove the full wire and re-wire it. The result was the same.

However I also tryed to use shift registers instead of the tunnels and now the code works (see below for the code).

2014-03-18 15_42_06-Testrack Actor.lvlib_Electronics Check Sequence.lvclass_Execute.vi Block Diagram.png

 

The Labview version used is 2013 SP1.

 

Hope you can help,

 

Tim


Edit: if the pictures are too small, you can drag them to a new tab and they become the original size.

0 Kudos
Message 1 of 5
(3,300 Views)
Solution
Accepted by topic author TimBotsM

Tim,

 

my first assumption: the for loop never executes as you pass an empty array to an auto-indexing input.

 

Another option, which is hard to see in the screenshot: Are there two input tunnels above the probe nr 42?

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 2 of 5
(3,290 Views)

All I can think of right now is that somewhere you are swallowing an error and something is not executing and sending out a default value instead.

Bill
CLD
(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 3 of 5
(3,285 Views)

Hi Norbert,

 

I think you found the problem. The 1st time I run the inner loop I have a number for the N input. (probe 90) however the other times I run the outer loop (auto index @ probe 91) this the value at probe 90 is 0. Smiley Embarassed

2014-03-18 16_09_01-Testrack Actor.lvlib_Electronics Check Sequence.lvclass_Execute.vi Block Diagram.png

 

However now I'm wondering how I can make a for loop that runs 0 times has wires running trough it (looks nicer) and returns the initial value (so probe 80 = 84). I mean, if I was doing this in C++ this would be the result. So some code how I would do this in C++ and the testrack would be unaffected.

 

C++ Code:

For(int i = 0; i<currentProbe.getNoOfChannels();i++){

testRackModule RackModule = Testrack.getTestrackModule();

currentProbe.setChannel(i,RackModule);

double Returnvalue[i] = currentProbe.getAnalogValue(RackModule);

}

 

Hope you know more.

0 Kudos
Message 4 of 5
(3,271 Views)

You already found the solution: shift register

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 5 of 5
(3,265 Views)