02-08-2012 04:45 PM
Thanks a lot for all the helpful replies I am seeing here. I may not address everyone but I'll try to give a summary here.
BTW, I already have subVI's for controlling the equipment and for saving files, etc They work beautifully. My question was whether I can package these subVIs together with their input/output and call it somewhere else as one module, basically like what you would do in C. When I call it, can it gets the info it needs from the front panel and generate the output (frontpanel display update and save data to file) within itself? Once again, I am new to Labview and something like this seems so easy to do in C but not sure in Labview for me.
Thanks again and I'll try to read more on the state machine now.
Shukui
02-08-2012 04:55 PM
When I call it, can it gets the info it needs from the front panel and generate the output (frontpanel display update and save data to file) within itself?
You CAN do that, but it violates the "re-use" idea, in my book, because you're putting all your eggs in one basket.
The NEXT time you use the instrument, you're going to want a different file format, or a different display.
I suggest making those into separate pieces, and call them separately. Then next month you can maybe pull out the INSTRUMENT piece AS IT IS, and add a new FILE format, or a new DISPLAY.
Or maybe next month, you have a different INSTRUMENT, and you can use the same FILE piece or DISPLAY piece.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
02-08-2012 05:16 PM - edited 02-08-2012 05:17 PM
A Briliant example of what Steve is suggesting is a construct like the "Resource Module" presented here (Yeah we all have our pet names). And create 1 for each I/O "Resource" that you need LabVIEW to talk to.
02-08-2012 05:25 PM
Thanks for your message.
I do have separate subVI's for each of these jobs.
My question was whether I can package these subVIs together with their input/output and call it somewhere else as one module. You said I can do that. Can you explain a lot more detail how to do it? Thanks.
Shukui
02-08-2012 05:36 PM
@shukui wrote:
Thanks for your message.
I do have separate subVI's for each of these jobs.
My question was whether I can package these subVIs together with their input/output and call it somewhere else as one module. You said I can do that. Can you explain a lot more detail how to do it? Thanks.
Shukui
Can- yes. Recommended NO. this vi is not likely to be reusable on multiple projects. So combining them in order is correcty the function of a "state" of the main application. when appropriate, the main state machine is fired into a "Get/Diplay/File record". the next experiment the would combine different elements in a simillar state that may reuse some (or all) of your resource modules but have different objectives
02-09-2012 01:52 AM - edited 02-09-2012 01:53 AM
@shukui wrote:
Thanks for your message.
I do have separate subVI's for each of these jobs.
My question was whether I can package these subVIs together with their input/output and call it somewhere else as one module. You said I can do that. Can you explain a lot more detail how to do it? Thanks.
Shukui
Make a new sub-vi. Make a cluster of all the inputs and then use all your existing sub-vi's in this new vi and send out an updated cluster.
Bundle/unbundle is the way to handle clusters.
I'd suggest several cluster inputs, one for each part (file and so on), or you can put clusters in the cluster to get some hierarchy.
/Y