FieldPoint Family

cancel
Showing results for 
Search instead for 
Did you mean: 

New to LabView and Fieldpoint I/O

This may be an obvious kind of question, but this is my first app. I would like to easily access individual points of my FP from several places in my app, and I'm considering using global variables to pass my data back and forth to a "service" VI that will actually read and write the data to the serial port. So far, this seems to be working, but I'm wondering if there's a better way. It would seem like opening and closing ports, generating tags and writing directly to the I/O from within the main VI's would be rather wasteful of resources.

Any insight would be appreciated!
0 Kudos
Message 1 of 4
(3,254 Views)
My first recommendation would be to read the section about local and global variables in LabVIEW User Manual found on page 10-1. The LabVIEW User Manual can be found at the following web site:

http://www.ni.com/pdf/manuals/320999d.pdf

Next, if you must pass data around, you may want to consider using Functional Globals with more information that can be found at the following web site:

http://zone.ni.com/devzone/conceptd.nsf/2d17d611efb58b22862567a9006ffe76/82e60e34e609c22a862569f8007e3f4a?OpenDocument

Overall, using global and local variables can be used in a program, but they should only be used when absolutely necessary. Another source that you may want to refer to is the LabVIEW Development Guidelines.

Best Regards,

John M
0 Kudos
Message 2 of 4
(3,254 Views)
Thank you for your comments, but it doesn't address the nature of my question. I am quite familiar with the concept of local and global variables.

My question concerns common methods employed to access physical I/O in several places of several VI's to control a process and sequence for a machine. I feel quite certain that this is an issue that comes up for most people deploying these systems.

Perhaps some example code from an integrator would be useful.

Also, I am somewhat amused by the aversion to variables. It seems like a VI of any size at all without any variables would be a hopeless mass of wires.

Thanks!

Charlie Adkins, P.E.
0 Kudos
Message 3 of 4
(3,254 Views)
Hi Charlie,

I don't know how I missed your question earlier. Must have been one of those days I skipped out.

What you are looking for is a variation on the "functional Global" called a "Action Engine". I use these to serve as a central clearing house of related I/O groups.

The Idea goes as follows. You take the functional global that comes with a read and write and add the functions you will be perfroming in your code. Functions are added by adding new cases. Common functions for FP would be Open, Close, Read, Write, etc. Insatead of the functional global just soring a value, it uses a connection ID that is stored in one of the Action engine's shift registers. The last read value can also be stored there so that a dozen threads monitoring a "stop" button I/O poi
nt don't cause alot of extra I/O. The last witten values saved in another shifter register is actually preferable to read from the FP output point due to latencies.

Ask away if you need more details.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 4
(3,254 Views)