From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sub VI

Hi,  I am working to communicate with a Como torque sensor. My program is working perfectly.

I need to create a sub VI of my program and once I do it, half of the program is not running anymore. 

You will find attached the program. I meant when I use my program as a sub Vi and I am trying to define the range the subvi is working but when I am starting the measure I am not getting any value in my indicator but my program (orange) is running on behalf like shown in the picture. 

 

any ideas or suggetions please?

Capture.PNG

0 Kudos
Message 1 of 9
(3,346 Views)

Hello,

 

What do you mean you need to use your program as SubVI?

 

If you encapsulate the entire program as is, you won't have information display in the Main VI or control the execution unless you wire those indicators from the subVI to the main VI.

 

I suggest you create a subVI with a state machine to configure your measurement, and another subVI to acquire the data,

 

You could use a event case in the top level VI to configure the communication, then to setup the measurement and once its connected, it could read data in the timeout.

 

 

Guilherme Correa
0 Kudos
Message 2 of 9
(3,338 Views)

Hi, 

thanks for your answer and help. 

I meant that I want to use it as a block as in the folder attached. 

 

I didnt get what you mean by sub Vi with a status machine.. Could you please provide me a folder or more explanation?

0 Kudos
Message 3 of 9
(3,321 Views)

Hi again, I have done like you asked. 

I divided my program on 2 programs one for  start the measurement and one to define the range. But It's the same thing; the define range is working perfectly but the SubVI start measurement is not as shown in the screenshot Unbenannt.PNG

 

 

 

You will also find attached the two programs. 

Any suggestion please? I am struggling here since 2 days

Download All
0 Kudos
Message 4 of 9
(3,272 Views)

You need to review some labview programming concepts such as SubVis.

 

I am sending the corrected code.

 

Good luck with your measurements.

 

Let me know if you suceed in getting the measures. 

Guilherme Correa
Download All
0 Kudos
Message 5 of 9
(3,264 Views)

Hi, I can not see your code cause I am using the 2014 version of Labview :S 

Is it possible to change the version? or to make a screen shot please?

 

0 Kudos
Message 6 of 9
(3,257 Views)

Data Flow!

 

You are calling a subVI that has a while loop in it.  It will not return until someone hits the stop button inside of it.  If you don't show the front panel, then no one is going to see it and be able to hit that button.

 

I would recommend you learn more about LabVIEW from here. How to Learn LV

0 Kudos
Message 7 of 9
(3,253 Views)

Sure.

 

I have converted the files to 2014 and also took a screenshot.

Main VI

 

Sub VI

subvi.png

Guilherme Correa
0 Kudos
Message 8 of 9
(3,250 Views)

Marwah,

 

You can eliminate all of those Timeout property nodes scattered throughout the subVI.  There is no need to continually set the timeout to the same value.  Doing it once at the beginning of the VI by using the timeout input to the Configure Serial Port will work just fine.

 

I would also put the carriage return and linefeed into the string constant itself (turn on \codes so they are visibile).  Then you can get rid of the extra constants and the concatenate string.

0 Kudos
Message 9 of 9
(3,245 Views)