LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving Port Assignments

I have a vi in which I am using a sub vi in which I have assigned three differnt digital outputs to three specific ports. When I save the vi, the port assignments I have chosen are lost. When I save the sub vi, the same thing happens. Can I somehow combine the sub vi and the vi into one saveable unit that will save my port assignments? I am using LabVIEW 7.1.
0 Kudos
Message 1 of 4
(2,841 Views)

In general, you shouldn't have a case where you have to set the same value for a VI and its subVI. The subVI should have an input which the VI can use to pass the value to it. You can set a value as default by right clicking it and going to the Data Operations menu.

If you want this to be changeable, what you should do is save the values to a file and load them when the program starts. OpenG's File I/O package includes some VIs which will help you with that.

To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).

___________________
Try to take over the world!
0 Kudos
Message 2 of 4
(2,835 Views)
Are the port assignments saved in a control or indicator?  If so click on the control and "make current values default".  Otherwise serialize them to a file and load the file programatically at the start of the code.  The first is quick and dirty, while a solution such as the second suggestion is much more work/time intensive but will allow for a flexible configuration solution in the long run.  If the digital port values are not ever going to change, use a constant on the diagram.  Without seeing code, I am speculating about your problem (I have had the same problem in the past when closing a vi, the values are reset to the default which sucks when you made many specific value sets in the controls).  Hope this is what you are looking for.
Paul
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 3 of 4
(2,833 Views)
What I was getting at is that saving a vi does not include values changes to controls which is a property of the vi instance.  The default value however is a property of a control and is saved with the vi's code.  Forgetting this can be very frustrating, but is done for an important reason, variables are variable and should not become constants.  If a constant is needed don't use a variable, use a constant.  Variables should always be initialized to a default value, these principles are constant independent of the language used.  In labview we forget this because the default value of all data types is specified and only changed implicitly by the programmer.
Paul 
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 4 of 4
(2,831 Views)