LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Function like code block reuse

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.

 

  1. State machine seems the ultimate and an elegant way;
  2. Bundling inputs or outputs into clusters will reduce the number of connections and make things a lot easier;

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

 

 

0 Kudos
Message 11 of 16
(1,390 Views)

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.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 12 of 16
(1,383 Views)

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.


"Should be" isn't "Is" -Jay
0 Kudos
Message 13 of 16
(1,378 Views)

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

0 Kudos
Message 14 of 16
(1,374 Views)

@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


"Should be" isn't "Is" -Jay
0 Kudos
Message 15 of 16
(1,371 Views)

@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

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 16 of 16
(1,357 Views)