LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

A vis runs alone but not as subvi

When I run the main the subvi doesn't work and when i run the subvi with the same input data, given by the main, it works and gives the right outputs.
What is the problem?
0 Kudos
Message 1 of 5
(3,182 Views)
How do does it not work? Does it return, but with the wrong values..?

Or does it freeze the main...if it's the latter it would be because there's a loop or other operation in the sub-vi that does not stop...so the main keeps on waiting for the sub-vi to finish.

Do you read any data from globals? In that case it might be due to a race condition...the sub-vi gets started prior to the global being updated...e.g.

If you could post the main and the sub-VI that would be helpful.
0 Kudos
Message 2 of 5
(3,182 Views)
Thanks for your response
i send you the main and the subvis
the main is in the library Temperature.llb and it is ChangeThe Temperature.vi
Thanks
Hortense
Download All
0 Kudos
Message 3 of 5
(3,182 Views)
Which is the sub-VI in question? (I interpret that the ChangeTheTemperature.vi is the main, not the sub-vi...).

One thing I noticed was that you send a serial command and then check bytes at port immediately and instruct the read VI to read those bytes. Normally this would happen so fast that the serial unit you send data to would not be able to answer in time...it would answer though and the next time you run that data will be available at the port. Could that be your problem? Put a probe at the bytes at port property and see if it returns a zero or less bytes than in the actual reply...

If you search the LabVIEW examples you'll find VISA based serial comms examples that use e.g. the timeout functionality to ensure that the read VI will wait
.

Off topic: why write to the graph using a local...just wire the data straight into the indicator. You can still have the property node where it is. Same goes for chamber session, digital etc...If you want to read them in more than one case you could use a shift register too...Locals are inefficient, causes more memory usage, less speed and can give you problems with race conditions, it's good to make it a habit to use wires where you can.
0 Kudos
Message 4 of 5
(3,182 Views)
Thank you very much, it was exactly the problem
0 Kudos
Message 5 of 5
(3,182 Views)