With the introduction of the LabWindows/CVI Real-Time module, you can use the features of LabWindows/CVI with many new real-time features including tight software and hardware integration, RTmain code generation, direct deployment to real-time targets over Ethernet, real-time threading libraries, File Copy Utility, remote debugging, Measurement & Automation Explorer (MAX) configurations, and the PID Control Toolkit.
Tight Software and Hardware Integration
National Instruments provides a tightly integrated real-time platform that offers commercial off-the-shelf (COTS) software and hardware components that seamlessly work together to create complete solutions. Each real-time hardware target uses standard components such as a microprocessor, volatile and nonvolatile memory, an I/O bus interface, and an RTOS. The embedded software consists of a RTOS, driver software and a specialized version of the LabWindows/CVI run-time engine. Because all LabWindows/CVI Real-Time deployment platforms are based on this common hardware and software architecture, integration is easy between the two components.
Figure 9. National Instruments provides a complete COTS software and hardware platform for real-time.
In addition to the integrated NI-DAQmx Library discussed previously, LabWindows/CVI provides DAQ Assistant, an interactive interface to the data acquisition driver framework. DAQ Assistant interactively defines a measurement task, determines the measurement capabilities of the DAQ device you specify, and generates C code modules that perform the acquisition. The tight integration of DAQ Assistant and NI-DAQmx with LabWindows/CVI gives engineers who perform data acquisition the most efficient, productive way to take measurements in an ANSI C environment.
Figure 10. Creating Data Acquisition Task Using DAQ Assistant
LabWindows/CVI is an industry leader in instrument control and connectivity, along with NI LabVIEW software, through an Instrument Driver Network of more than 4,000 instrument drivers from more than 200 vendors. You can use these drivers to easily program instrument control applications. LabWindows/CVI takes instrument control to the next level of productivity with Instrument I/O Assistant. With Instrument I/O Assistant, you can generate code to communicate with devices such as serial, Ethernet, and GPIB instruments without using an instrument driver.
Instrument I/O Assistant offers a simple interface for quickly prototyping applications and autoparsing instrument data without any programming. You can easily import the code generated into any existing application, which removes the tedium of writing instrument connectivity, basic communication, and string parsing code.
RTmain( ) Code Generation
Use RTmain code generation to automatically create a code template for your real-time applications. The template provides convenient starting points to add initialization and cleanup code. The RTmain function is automatically loaded and executed upon deployment to a real-time hardware target. You can insert the RTMain function to your application from the Edit » Insert Construct » RTmain menu item.
Figure 11. Use the Insert Construct menu item to automatically create RTmain initialization code and a template to begin writing your code.
Direct Real-Time Deployment over Ethernet
You can directly deploy your application to your real-time hardware target over Ethernet using the LabWindows/CVI Real-Time Select Target with Options window. With this option, you can specify the target by machine name or IP address without ever leaving the LabWindows/CVI development environment. If you are unsure of the available targets or need to change hardware configurations, you can also launch Measurement and Automation Explorer (MAX) to view all available targets on the network subnet. After you press the run button, LabWindows/CVI automatically builds your real-time application and copies it the real-time target over Ethernet.
Figure 12. You can target and deploy real-time directly from LabWindows/CVI.
Real-Time Threading Libraries
One important aspect of a real-time system is the ability to control thread priorities so higher-priority tasks are not interrupted by lower-priority tasks on the system. With the ability to set thread priority in LabWindows/CVI Real-Time, you have control over the execution of tasks in your application. There are seven different thread priorities exposed by the LabWindows/CVI threading API, which map to three different levels – high, normal, and low. In order to simplify threading, LabWindows/CVI also includes thread pool functions to simplify creating, transferring, and disposing threads (Figure 13).
LabWindows/CVI also includes thread safe queues to safely pass data between different threads, thus preventing race conditions. A thread safe queue is commonly used in PID control applications to pass data between time-critical PID loop and the low-priority communication loop.
Figure 13. Set the thread priorities to ensure that your time-critical tasks are not preempted by lower priority tasks.
File Copy Utility
Once you create real-time applications, LabWindows/CVI automatically downloads your application and any statically linked DLLs to the target. However, if you wish to manually download other files such as configuration files or dynamically called DLLs, you can use the File Copy utility. This utility also allows you to specify which DLLs should run at system startup.
Figure 14. Use the LabWindows/CVI Real-Time File Copy utility to copy files to the hardware target.
Once you have developed a real-time application, you may want to do debug it while it is executing on the real-time target with actually I/O. This task is typically not trivial. With LabWindows/CVI, you can simply create a debuggable DLL, and then debug the DLL from a local instance of LabWindows/CVI. All of the features available when you are debugging locally, such as breakpoints, step into functions, or watch variable values are fully functional. On the fly, you can even change the values of variables on your real-time target from your local machine. All debugging information is automatically passed over TCP between the real-time application and the local instance of LabWindows/CVI.
Figure 15. Remotely debug your real-time application over Ethernet.
Locating and configuring your real-time hardware target with the appropriate software and drivers is easy using MAX. MAX automatically finds any supported targets on your local subnet, or you can specify an IP address or network name. From MAX, you can download the LabWindows/CVI Real-Time runtime engine and hardware drivers such as NI-DAQmx to the target. You can also interactively configure the hardware on the target, including defining data acquisition tasks, terminal configurations, and even running test panels to remotely to view live data.
PID Control Toolkit
The PID Control Toolkit, included with LabWindows/CVI Real-Time, enables you to create sophisticated closed-loop control applications. The toolkit includes functions for PID control, external reset feedback and error-squared PID algorithms.
Figure 16. Add sophisticated PID algorithms to your control applications.