02-20-2012
09:43 AM
- last edited on
03-31-2025
03:37 PM
by
Content Cleaner
Hey all, newish LabVIEW user here (~6 months). I am going to be using LabVIEW applications to control some simple test/assembly fixtures that use various NI 24V DIO Modules and boards + DAQmx to interface with a handful of industrial sensors and components (pneumatic cylinders, photoelectric sensors, relays) – basically beginning to replace many of our PLC-controlled systems with LabVIEW control. The other day, I came across the NI Dev. Zone tutorial Machine Control Software Design, and my interest was peaked by the I/O Scan and I/O Memory Table sections. In my understanding, they’re using a task separate from, and parallel to, the control code to update the state of Digital Inputs and Digital Outputs to a LabVIEW Global at a given refresh rate. This global is then read and written to in various other tasks.
It seems that some of their example code for this tutorial can be found here: http://zone.ni.com/devzone/cda/epd/p/id/5750
Though my LV knowledge is limited, it seems that this method may be a bit cumbersome, no? From browsing around the forums, I’ve seen people mention the fact that continuously reading and writing to LabVIEW Globals isn’t necessarily the most efficient method of sharing data between various program tasks. I am often not using LabVIEW Real-Time, so determinism isn’t necessarily the biggest issue for me. I’d just like to create an I/O Scan engine I can use on my various projects that is fast, efficient, readable, and scalable.
What do you guys suggest? Is the method in the NI Dev. Zone Tutorial completely adequate, or would you guys look at using other methods? I’ve read a bit about Functional Globals - would an implementation of those be a performance increase above using the LV Globals?
I’d love to see any example code, suggestions, or advice. Once I get a bit of direction on a solid implementation, I’ll post some code for comments.
Thanks everyone! I’m quite excited to become a member of the LV users’ society on here. These forums are great!
Jim Neumann
02-22-2012
10:51 AM
- last edited on
03-31-2025
03:39 PM
by
Content Cleaner
Hi Jim,
Two major issues with global variables are race conditions and performace issues as detailed here . Functional global variables eliminate race conditions because they are non-reentrant and they add functionality in comparison to global variables. Hence, I would recommend using functional global variables in your case.
Here are some other documents that I suggest looking through:
cRIO I/O Engine (CIE) Reference LIbrary for Machine Control
Recommended Practices for Using the LabVIEW I/O Variable and NI Scan Engine
Best of luck with your application and welcome to the forums!
Regards,