LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Update question

 

Hi, I have created a serial comms VI, (MAIN Tx-Px.vi) which calls for the pressure and temperature of its sensors. The user can chose how fast he wants to read this data by setting a gatetime value, i.e. between 0.01 and 2 seconds,

Anyway it works perfectly i have to say, but my problem is after I package it up as a VI, assigning connectors to various control and indicators, ultimately for use as a subvi in my main VI.

So what i done was, created a new VI for my main program (Main Prog.vi), selected my MAIN Tx-Px.vi and inserted her into my Main Prog. I right clicked at the various points on my sub VI (MAIN Tx-Px.vi) and chose either control or indicator, as you do. However, when I run the main program I don’t see the indicators updating anywhere as near as fast as they do when the subvi is run by its self.

 

How does one get around this? I had assumed it would update my indicators at the same speed?

 

Any ideas.

 

Thanks

 

 

0 Kudos
Message 1 of 5
(2,720 Views)

There is a slight overhead when calling subVI, but that isn't all that big. If it were, nobody would use subVIs. The most likely issue in your case is that you are performing an operation due to calling the subVI in a loop that only should be done once. My guess? You're initializing the serial port inside the subVI, so each time it's called you're taking a hit from that. If you post your code then a more detailed analysis can be done.

0 Kudos
Message 2 of 5
(2,713 Views)

Here you go. And thanks for having a look

 

Main Prog.vi is the main one. and MAIN Tx-Px.vi is my main subvi.

 

C:\Documents and Settings\griogair.dallas\Desktop\Trash\MY PVT CODE

0 Kudos
Message 3 of 5
(2,710 Views)

You might have some misconceptions about dataflow.

 

You don't seem to show the front panel of the subVI and the main VI will only be able to update it's indicators once the subVI completes.

 

I also wonder how you determine the update rate of the main VI since you are only running it once (there is no loop!). Are you using the 'continuous run button" perhaps?

 

As has been said already, the serial config does not belong into the subVI, that only needs to be done once.

0 Kudos
Message 4 of 5
(2,696 Views)

Thaks for your reply.

 

Originally the subvi was a main Vi, whilst i was benchtesting the sesnors. i now want to integegrate this into the main process but as a subvi.

 

And yes, i was running in continously whilst i tested this, and agree a loop on the write reads would be better now.

 

Tha main Vi was something i knocked togther quickly to demonstrate my problem, so wondering what the best dataflow approach would be? i do still want to have this as a subvi, but i'd like the indicators on the main vi to update at the same rate as the sub.

 

What advice could you give to allow me to achieve this?


many thanks

 

G

0 Kudos
Message 5 of 5
(2,680 Views)