LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Defining module VI's

How do I define modules for programmng in LabVIEW?

 

I have made various labview pragrams so far, and would like to use these modules as VI's in my forthcoming programs. Is there any way I can convert my programs to usable VI's ?

 

Thanks

Dheeraj Bharadwaj
IIT-Madras
0 Kudos
Message 1 of 4
(2,369 Views)

Hi Dheeraj,


I think you are trying to use your developed VIs as SubVIs in a particular VI. For that you can right click on the block diagram of your new VI and then click Select a VI and then browse the VI which you want to use it as the SubVI. You can also drag and drop the VIs in to your new VIs block diagram directly. 

 

Regards,

Nitzz

(Give Kudos to Good Answers and Mark it as a Solution if your problem is Solved;)) 

Message 2 of 4
(2,360 Views)

You'll also need to define the sub VI's connector pane.

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 3 of 4
(2,351 Views)

What Nitzz and Jim said above are the mechanics of creating subVIs and you will need to know that in order to create subVIs from existing code.

 

My advice is much more generic and pertains to considering reuse from the start. That is, planning for reuse as part of your normal development practices.

 

First and foremost is that anything that pertains to some external device, equipment or hardware should ALWAYS be viewed as code that will be reused. If code doesn't exist and you need to write it think in general terms about interfacing with the device. Leave specific tasks to the application that will use the device. That application should use combinations of the device driver (API) subVIs to perform more complex tasks. If there are complex tasks that are performed frequently with the device you can create specific subVIs for those tasks.

 

When working with UI elements try to develop standard libraries as you use different components. For example, when working with tables you might want to create a library of basic subVIs that perform operations on the table. I have developed a library which allows new rows to be added, existing cells to be modified, color coding specific cells based on content, standard numeric operations (increment, decrement, etc.) on cells, resizing the table/restricting it's size and managing the scroll bar. As you develop more applications you begin to reuse these basic constructs and having the libraries really helps to speed up development.

 

Consider developing libraries for various algorithms you may use within your industry. If these are used in several applications spend the time to make them general purpose so you can reuse them.

 

Add libraries for working with general constructs (strings, arrays, config files, etc.). This is along the same lines of thought as the UI elements.

 

Learn and adopt using LVOOP. With inheritance you can develop some very powerful and flexible classes. This also helps to define good APIs for working with reusable components.

 

ALWAYS have reuse in the back of your mind as you write code. When developing reusable modules don't try to make them do everything under the sun. Narrow their focus on specific tasks and functionality. The more complex and multi-functional you make subVIs the less likely you will be able to reuse them. At the same time don't try to implement every possible feature in a library in the beginning. Using my table example above it started with a few basic functions I found myself repeating over and over. As I developed new applications that required some new actions I the table I added them to the library. If I tried to create the entire library and capture all possible things you could do with one I may have spent time developing code I never use as well as taking time away from my actual task at hand.

 

Lastly, if it sounds like something that someone has probably needed to do (a device driver for example) spend a little time seeing if that code has already been developed and is available for download. Leverage the efforts of others. For example, OpenG has some great stuff in it.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 4 of 4
(2,340 Views)