Adding an HMI to your Programmable Automation Controller (PAC)
Overview
As the industrial landscape continues to move toward a more automated environment, engineers implementing monitoring and control applications encounter increasingly complex systems. Such industrial control systems often consist of independent Programmable Automation Controllers (PACs) managing specific, individual tasks. As these distributed systems increase in complexity, the control and monitoring tasks must be divided among several such PACs, networked together. Ensuring proper operation of this distributed industrial process requires the direction of system managers and operators. Yet while a central control “hub” is appropriate for managerial supervision, the distributed system is incomplete without Human Machine Interfaces (HMIs) for more direct interaction.
An Industrial Touch Panel Computer
The LabVIEW Touch Panel module completes the National Instruments offering for managing remote systems by extending the LabVIEW graphical programming environment to rugged HMI industrial computers. This application note discusses the benefits of the LabVIEW Touch Panel module and provides a detailed step-by-step tutorial for adding an HMI to your existing PAC system.
PAC & HMI
Programmable Automation Controllers (PACs) exist in a variety of applications spanning several industries. Typical examples of a PAC include the National Instruments CompactRIO and Compact FieldPoint product lines (refer to the links below for details). Each system contains an embedded controller in addition to hardware modules for input/output. While their specific uses vary greatly, the need for effective management of these remote systems is universal. A typical distributed system may look something like Figure 1 below.

Figure 1: A Distributed Control System.
PACs can be distributed throughout a single manufacturing facility or deployed in the field over a wide expanse. The central database or control system provides supervisor-level monitoring, but may not always be immediately accessible. Since most PACs are embedded controllers, they have no user interface of their own; thus, there is a need for Human Machine Interfaces (HMIs) at key access points to complete the system.
CompactRIO and Compact FieldPoint are examples of these “headless” systems; they require the use of additional hardware for a user interface. National Instruments touch panel hardware, such as the family of 6" and 12" touch panel computers (TPCs), provide a robust and compact solution for industrial HMIs. Rugged physical specifications and a variety of I/O ports provide for easy integration into existing networks. (See the related links below for more details on National Instruments touch panel hardware). Such an HMI equips the operator with direct access to specific control or monitoring systems.
However, adding a user interface only solves part of the distributed problem. Equally important as the PACs and HMIs in a distributed system is the infrastructure with which they communicate. Network topologies involving Ethernet, serial, and wireless protocols create an intelligent, distributed system to control industrial processes. Because of the availability and reliability of existing Ethernet networks, a protocol such as TCP/IP or UDP is most often employed for the purpose of networking PAC nodes. The availability of wireless standards, such as 802.11b, also provide for very scalable and flexible network solutions.
The TCP/IP libraries and functions available with LabVIEW provide an easy-to-use API for networking distributed systems. Several examples of message-based protocols exist and have been successful in managing such systems. (Refer to the links below for details). However, as the demands of distributed applications increase, the simple client-server architecture inherent to TCP/IP can become cumbersome. The LabVIEW Touch Panel module and Shared Variable simplify the development of distributed control and monitoring applications.
See Also:
NI TPC 2106/T Product Page
NI TPC 2012 Product Page
Programmable Automation Controllers (PACs)
The LabVIEW Touch Panel Module
The LabVIEW Touch Panel Module provides a single, integrated graphical environment for developing HMI and PAC applications. The LabVIEW Project Explorer window facilitates the distribution of these complex systems across multiple targets and operating systems. With the Touch Panel module, the LabVIEW Project includes supports for programming touch-screen HMIs as well. (Refer to the links below for details). The benefits of programming desktop and Real-Time applications with LabVIEW can now be extended to Windows CE and Windows Mobile powered devices. Some of these benefits include:
- Rapid HMI application development using the NI LabVIEW graphical development environment
- Communication with external devices through Bluetooth, Wi-Fi (802.11), IrDA, and serial protocols
- Integration with the LabVIEW Datalogging and Supervisory Control (DSC) module

Figure 2: Shared Variable Communication
For more specific information on Shared Variables, refer to the links below.
See Also:
Using LabVIEW to Develop Applications for Windows CE OS Devices
Using the LabVIEW Shared Variable
Adding a Touch Panel Interface to your PAC Step-by-Step
The LabVIEW project and shared variable bring the development of Real-Time PAC and HMI touch panel applications into one integrated programming environment. Adding an HMI to an existing “headless” PAC system, such as CompactRIO or Compact FieldPoint, is greatly simplified with the LabVIEW Touch Panel module and shared variable. The following tutorial provides step-by-step instructions for adding an HMI to an existing LabVIEW Real-Time project. The hardware setup required for this tutorial includes an NI-TPC 2106/T, Real-Time target (such as Compact FieldPoint), and a development system.
- First connect the development computer, Touch Panel Computer, and Real-Time Target to the same subnet over Ethernet. The hardware setup should resemble the figure below.
- ADD CONTENT on how to add TPC Service Support
![]() |
| Figure 3: Initial Hardware Setup |
| _ |
- Download the HMIPAC.zip file from the related links section below. Note that there are two top level folders within the zip file: “Tutorial” and “Solution.” The “Tutorial” folder contains the files necessary to complete these step-by-step instructions, while the “Solution” folder contains the completed application.
- Open the existing LabVIEW Real-Time project HMI_PAC.lvproj in the “Tutorial” folder. It should look like the following:

_ 
Figure 4: LabVIEW Real-Time Project Window_ - This simple example is intended to simulate data acquisition. The Generator.vi on the Real-Time target will continuously publish a sine, square, or sawtooth wave depending on the “type” input. Since the Generator.vi will be embedded on the Real-Time target, its front panel will not be visible. Thus a touch panel is necessary for an HMI. The HMI.vi will get the data from the Generator.vi and display it on the graph on its front panel:

_ 
Figure 5: HMI.vi Front Panel_ - We need to add the Touch Panel to the project to target the hardware. Right-click the “Project: HMI_PAC.lvproj” in the Project Explorer and select New » Targets and Devices… Select the Existing target or device bullet and expand the Touch Panel folder to see the touch panel. Click TOUCH PANEL WINDOWS CE Device and click “OK” to add the touch panel to our project.
- After adding the touch panel to the project, we must add its VI, called HMI.vi. Do this by right-clicking on the Touch Panel target in the project explorer window and selecting Add File… Browse to the HMI.vi file, click “OK” to add the file to the project.
- The block diagram is incomplete as it does not have any means of communicating with the PAC. We need to add shared variables to communicate with the Real-Time target. Begin by creating a library for the shared variables. Right-click the Real-Time target in the project explorer window and select New » Library. An “Untitled Library” will appear under the Real-Time target.
- Save the library by right-clicking “Untitled Library” and selecting Rename. Name this library as “Variables” and save it to the “Tutorial” folder.
- Add the shared variables to the library by right-clicking the “Variables” library and selecting New » Variable. The Shared Variables Properties window will appear.
- First we’ll configure the data that will be graphed on the touch panel. (Refer to the shared variable properties window as shown in the figure below.) Do this by changing the name to “Data” and the data type to array of double. Set the Variable Type to Network-Published, and the variable can be read from or written to any place on the network. The properties window should now look like this:

_ 
Figure 6: Configured Shared Variable Properties Window_ - Click the “OK” button, the shared variable “Data” will now appear under the “Variables” library:
- We need to add the other two variables to the library. Do this by right-clicking the “Variables” library again and selecting New » Variable. Repeat the steps above twice more for two additional shared variables:
Name Data Type Stop Boolean Waveform Type Int16 - The PAC and the touch panel will communicate through the shared variables. The PAC will write values to the “Data” variable, and the touch panel will display those on its front panel graph. The touch panel in turn will write values to the “Stop” and “Waveform Type” variables, and the PAC will read from them. This allows the operator to select a waveform type on the touch panel to change the data sent by the PAC.
- To complete the application, we need to add the variables to the Generator.vi on the Real-Time target. Open the VI and drag the “Data” variable from the project explorer to the block diagram as shown below. Also, drag the “Waveform Type” variable and two copies of the “Stop” variable to the same block diagram.

_ 
Figure 7: Add Shared Variable to Block Diagram_ - The HMI needs to read the data from the “Waveform Type” variable. Right-click on the variable and select Change to Read. Do the same with one of the “Stop” variables such that the block diagram resembles the figure below:

_ 
Figure 8: Completed Generator.vi Block Diagram_ - Now that we have added the variables to the Generator.vi, we must add them to the HMI as well. Open the HMI.vi and drag the “Data” shared variable from the project explorer to the block diagram. Right-click the “Data” shared variable node of the block diagram and select Change to Read.
- Drag the “Waveform Type” and “Stop” variables to the HMI.vi block diagram and wire it as shown:

_ 
Figure 9: HMI.vi with Shared Variables_ - Select File » Save All from the project explorer window to save the project.
- To use shared variables on the touch panel, we need to install shared variable support. Do this by running the setup.exe located in the C:\Program Files\National Instruments\LabVIEW 8.2\PDA\Utilities\Variables directory. This will install support on the touch panel while it is connected to computer via ActiveSync.
- The touch panel application is not yet complete, as it is not deployed on the touch panel hardware. Create the deployable application by right-clicking the Build Specifications under the touch panel target in the project explorer window and selecting New » Application (EXE).
- Select the HMI.vi and click the right-arrow button to make it appear under Top-Level VI. The dialog box should now look like the following:

_ 
Figure 10: Build Specification Source Files_ - Click the “OK” button, and the build specification “My Application” will appear in the project explorer window as shown below:

_ 
Figure 11: Project Explorer with Touch Panel Build Specification_ - At this point, the VI is still on the development machine. Download the application to the touch panel by right-clicking the “My Application” build specification and selecting Run.
- We must also download the Real-Time portion of the application. Right-click the build specification under the Real-Time target and select Build. Right-click the build specification again and select Deploy. This will deploy the Real-Time executable and shared variables.
- The touch panel and PAC are now communicating through the “Data,” “Waveform Type,” and “Stop” shared variables. We can disconnect the USB cable, and the PAC and touch panel will continue to communicate.
- Our HMI is now complete and the distributed system is independent of the development machine. Our setup now resemble the following:

_ 
Figure 12: Touch Panel - PAC System Diagram_ - Refer to the LabVIEW Help files for more detailed instructions.
Conclusion
Related Links:
Using the LabVIEW Shared Variable
Programmable Automation Controllers (PACs)

