Seraph Posted April 6, 2010 Report Share Posted April 6, 2010 From some books and documents, these two seem don't have much difference, the result of using a Functional Global Variance is the same as that of calling a sub-vi with same function, then why does LabVIEW develop the concept of Functional Global Variance? Is there any good reasons to use the Functional Global Variance instead of a sub-vi? Thanks a lot! Quote Link to comment
PaulG. Posted April 6, 2010 Report Share Posted April 6, 2010 From some books and documents, these two seem don't have much difference, the result of using a Functional Global Variance is the same as that of calling a sub-vi with same function, then why does LabVIEW develop the concept of Functional Global Variance? Is there any good reasons to use the Functional Global Variance instead of a sub-vi? Thanks a lot! I'm not sure I know what you are talking about. Do you mean "Functional Global Variable"? More info here. Quote Link to comment
Seraph Posted April 6, 2010 Author Report Share Posted April 6, 2010 I'm not sure I know what you are talking about. Do you mean "Functional Global Variable"? More info here. Sorry, I made a incorrect spell for "Variable". Yes, I mean Functional Global Variable, and I wonder why and when we should use a Functional Global Variable instead of implementing it as a geneal sub-vi, Or simply speaking, why do we call the function part as Functional Global Variable, not as a sub-vi. Thank you for your quick and kind reply. Quote Link to comment
crelf Posted April 6, 2010 Report Share Posted April 6, 2010 A functional global *is* a subVI with an unitialised shift register that stores data. You can do more with it than just that (hence the "functional" part of its' title), but all functional globals have the unitialized shift register as their basis. Quote Link to comment
Grampa_of_Oliva_n_Eden Posted April 6, 2010 Report Share Posted April 6, 2010 (edited) A functional global *is* a subVI with an unitialised shift register that stores data. You can do more with it than just that (hence the "functional" part of its' title), but all functional globals have the unitialized shift register as their basis. I have seen two exceptions to that rule, one good one bad... The FG could be wrapping up a single element queue to stor the data (good) The FG could be using off-icon-connector controls to store the data (bad and down right cruel to expose a young G-babe too. I still wince thinking about it). Ben Edited April 6, 2010 by neBulus Quote Link to comment
TG Posted April 21, 2010 Report Share Posted April 21, 2010 From some books and documents, these two seem don't have much difference, the result of using a Functional Global Variance is the same as that of calling a sub-vi with same function, then why does LabVIEW develop the concept of Functional Global Variance? Is there any good reasons to use the Functional Global Variance instead of a sub-vi? Thanks a lot! One thing to note about a simple subVI (statically defined default when you define one) it acts as a semaphore. The locking is implied by the fact that only one call to a static subVI can proceed at a time. This makes default data inside the subVI 'safe' in that only one access at a time is permitted to the subVI however, using default data in controls always has a way of causing strange bugs so it is critical to initialize a subVI on the first iteration of it. That said Functional Globals are excellent way to initialize data and retain values between calls. Use FG's whenever you need to initialize data and then safely maintain the data in that subVI. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.