LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

fields resetting to default each time

Solved!
Go to solution

Dave_brandt

 

That is very time intensive, not condusive being used in a program loop, and since this is a sub_vi, storing those values can be done in memory.

-Regards

eximo
_______________________________________________
UofL Bioengineering M.S.
Neuronetrix

"I had rather be right than be president" -Henry Clay
0 Kudos
Message 11 of 22
(1,170 Views)
Solution
Accepted by topic author eximo

The problem can be solved by passing a reference to the VI for that particular indicator and then only updating the value for the indicator class of that reference when applicable.

-Regards

eximo
_______________________________________________
UofL Bioengineering M.S.
Neuronetrix

"I had rather be right than be president" -Henry Clay
0 Kudos
Message 12 of 22
(1,166 Views)

The shift registers and a wire is the fastest way to pass data in/out of a subvi. The only faster way would be to write the code in the main vi. The sub vi while loop only runs once because of the constant true on the stop if true.  If you are going to use references the dynamic event structure would be a good choice. It would run in a different loop just waiting for your event. This could be a a subvi outside your main loop. But there are many ways to code in Labview. Choose what you like the best.

0 Kudos
Message 13 of 22
(1,151 Views)

 


@eximo wrote:

The problem can be solved by passing a reference to the VI for that particular indicator and then only updating the value for the indicator class of that reference when applicable.


Unfortunately, this "solution" would likely break in a standalone executable because it 's referring to a front panel object and LV won't retain the front panel of a subVI in most situations.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 14 of 22
(1,140 Views)

mikeporter wrote:

@eximo wrote:

The problem can be solved by passing a reference to the VI for that particular indicator and then only updating the value for the indicator class of that reference when applicable.


Unfortunately, this "solution" would likely break in a standalone executable because it 's referring to a front panel object and LV won't retain the front panel of a subVI in most situations.

 

Mike...


Any static references to a front panel element should force the front panel to be in the executable.  But having a property node in the subVI will also cause that VI's front panel to be in the executable.  That is a potentially large amount of memory that would be added that likely isn't needed at all.  And property nodes are a killer to execution time.

 

I really wish an example VI was given so that we could see exactly what the OP was seeing and suggest something better than passing around references.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 15 of 22
(1,133 Views)

I know this example would not work in a working vi or executable. I think the fields reseting is the issue of not understanding how a subvi pass out the data when the subvi is executed. Any control indicator value inside an un-executed case structure in the subvi will pass the default value for that data type. This is just to show techniques of how to do something, just like the NI examples usually can not be put directly into your code.  I thought we are suppose to share Ideas here and not provide code. If you teach a man to fish and feed him for a lifetime.  Sorry for not being clear in my earlier post that my solution would not completely work. It was just trying to show how to pass multiple control indicators out of a subvi using shift registers.

0 Kudos
Message 16 of 22
(1,123 Views)

@Dave_Brandt wrote:

I know this example would not work in a working vi or executable. I think the fields reseting is the issue of not understanding how a subvi pass out the data when the subvi is executed. Any control indicator value inside an un-executed case structure in the subvi will pass the default value for that data type. This is just to show techniques of how to do something, just like the NI examples usually can not be put directly into your code.  I thought we are suppose to share Ideas here and not provide code. If you teach a man to fish and feed him for a lifetime.  Sorry for not being clear in my earlier post that my solution would not completely work. It was just trying to show how to pass multiple control indicators out of a subvi using shift registers.


I think you misunderstood.  We were commenting that the passing around of the control reference was a bad idea.  Using shift registers is likely the better way to go.  But it is really hard to say without seeing what the OP actually had.
Simple examples will show somebody a lot more than just talking about something.  So I encourage examples that just show the concept.  Don't do their project, but show how to get over a hump.  They will have to put the code in their project.

GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 17 of 22
(1,115 Views)

CrossRulz,

 

 

So I had thought that references were akin to pointers in C.  Pointers are generally faster since they access the location and don't require a copy in memory.  Why would references not be faster?

 

I agree a shift register could be used to accomplish this task, but they are MESSY!  They span the entire VI, (although a feedback node could be used to reduce the number of wires running across the screen.

 

-JW

-Regards

eximo
_______________________________________________
UofL Bioengineering M.S.
Neuronetrix

"I had rather be right than be president" -Henry Clay
0 Kudos
Message 18 of 22
(1,109 Views)

Here is an example subvi, I can create the main if necessary

-Regards

eximo
_______________________________________________
UofL Bioengineering M.S.
Neuronetrix

"I had rather be right than be president" -Henry Clay
0 Kudos
Message 19 of 22
(1,104 Views)

eximo wrote:

So I had thought that references were akin to pointers in C.  Pointers are generally faster since they access the location and don't require a copy in memory.  Why would references not be faster?


And that's where a lot of people go wrong.  It is not a pointer.  It is a reference to a control object.  And when you read or write to a property of a control object, it forces a thread swap to the User Interface.  That alone is kind of expensive time-wise.  But it also forces the front panel(s) to be updated.  That will be an really big hit to your performance.

 

From your example, I would use a feedback node or shift register.  They are quite clean (in done correctly) and very efficient.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 20 of 22
(1,096 Views)