Using Shared Variables with the NI TPC-2006 and the LabVIEW 8.20 Touch Panel Module

Publish Date: Apr 06, 2007 | 0 Ratings | 0.00 out of 5 |  PDF

Overview

This tutorial illustrates how to create and use network-published shared variables in Touch Panel applications you create with the LabVIEW 8.20 Touch Panel Module. Network-published shared variables allow you to easily and efficiently transfer data between a Touch Panel device and various distributed targets connected together over a network. In addition to the step-by-step guide that shows you how to create and configure shared variables, this tutorial also provides an example of how to use these shared variables to communicate between the NI TPC-2006 Touch Panel target and a distributed monitoring application. The following tutorial uses the LabVIEW 8.20 Touch Panel Module and an NI TPC-2006 Windows CE target. However, the same process applies for other supported Windows CE touch panel computer targets.

Table of Contents

  1. Table of Contents
  2. System Requirements
  3. Creating and Configuring a New Touch Panel Target
  4. Installing Support for Shared Variables
  5. Adding Shared Variables to a Project
  6. Using Shared Variables in Touch Panel Applications
  7. Deploying and Running Touch Panel Applications
  8. Conclusion

1. Table of Contents

  1. System Requirements
  2. Creating and Configuring a New Touch Panel Target
  3. Installing Support for Shared Variables
  4. Adding Shared Variables to a Project
  5. Using Shared Variables in Touch Panel Applications
  6. Deploying and Running Touch Panel Applications
  7. Conclusion

Back to Top

2. System Requirements

This tutorial assumes the following system requirements:

  • LabVIEW 8.20 Professional Development System
  • LabVIEW 8.20 Touch Panel Module
  • NI TPC-2006 Touch Panel Computer
  • Windows 2000/XP development machine connected to an ethernet or wireless network

See Also:
NI LabVIEW Touch Panel Module
Product Manuals: Getting Started with the LabVIEW Touch Panel Module for Windows CE

Back to Top

3. Creating and Configuring a New Touch Panel Target

The Project Explorer window provides the framework for organizing and interacting with various distributed targets from a single location within the LabVIEW programming environment. Shared variables provide an easy method for communicating and sharing data between various targets. The first part of this tutorial is to create a new LabVIEW project and add a Touch Panel target to the project.

Complete the following steps to create a project and add a Touch Panel target to that project.

  1. From the Getting Started window, click Empty Project to open a new project. The project contains the My Computer target, which is the development, or host, PC.
  2. Select File»Save Project in the Project Explorer window and save the new project as TP Shared Variable.lvproj.
  3. Right-click the project and select New»Targets and Devices from the shortcut menu to open the Add Targets and Devices dialog box.

  4. Select Existing target or device and expand the Touch Panel folder to show the available targets. Select Windows CE»Touch Panel Windows CE 4.2 Device and click OK to add a Windows CE 4.2 target to the project.

The Windows CE Touch Panel device appears as a new target in the project.

 

Back to Top

4. Installing Support for Shared Variables

You must install support for the shared variable engine on the NI TPC-2006 Touch Panel target before you can access data from network-published shared variables from the Touch Panel target. To install this support, you can connect the Touch Panel target to your development PC through ActiveSync and deploy the support files automatically through the Project Explorer window. You also can install this support manually by transferring the shared variable support files to the Touch Panel target in a .cab file.

Tip: You can install various support files on a Touch Panel target by right-clicking the target in the Project Explorer window and selecting Install from the shortcut menu. You must establish an ActiveSync connection between the host PC and the Touch Panel target.

Complete one of the following methods to install support for shared variables on the Touch Panel target.

Method 1: Install Shared Variable Support through ActiveSync

  1. Verify you have an ActiveSync connection between the host PC and the TPC-2006.
  2. Right-click Touch Panel Windows CE 4.2 Device in the Project Explorer window and select Install»Support for Shared Variables(ARM) from the shortcut menu.

Method 2: Install Shared Variable by Manually Deploying Support Files

You also can manually transfer the shared variable support files to the TPC-2006. The support files are in the National Instruments LabVIEW 8.2 Shared Variable Support.CAB file, located in the labview\PDA\Utilities\Variables directory. You can manually transfer the CAB file from the development PC to the TPC-2006 through FTP or by copying it to a CompactFlash card and manually transferring it to the TPC-2006. The following steps use FTP to transfer the support files to the TPC-2006. Refer to the KnowledgeBase 3T9C8LX1 (linked below) for information about configuring the TPC-2006 to accept file transfers through FTP.

  1. With the TPC-2006 connected to a network, open an FTP session to the device from the development machine by typing ftp://xxx.xxx.xxx.xxx in the address field of an Internet Explorer browser, where xxx.xxx.xxx.xxx is the IP address of the TPC-2006. This allows you to browse the file structure and transfer files to the TPC-2006.
  2. Copy National Instruments LabVIEW 8.2 Shared Variable Support.CAB, located in the labview\PDA\Utilities\Variables directory, to the HardDisk\wince\config directory. Create the HardDisk\wince\config directory if it does not exist.
  3. Reboot the TPC-2006 to start the installation process.
  4. Verify the shared variable support is installed by checking the list of programs in Add/Remove Programs.

See Also:

KnowledgeBase 3T9C8LX1: Configuring the NI TPC-2006 as an FTP Server for File Transfer

Back to Top

5. Adding Shared Variables to a Project

You can now add network-published shared variables to a LabVIEW project. The shared variables provide a memory space that you can use to send and receive data between different targets in the project. One target in the project must host the shared variables. All other targets can connect to that host as clients to publish or subscribe to the data stored in the shared variable memory space. Only certain targets, such as Windows PCs, FieldPoint controllers, and CompactRIO controllers are capable of hosting shared variables. Touch Panel targets cannot host shared variables and only can access shared variables as clients. You create and host the shared variables on the host PC. The Touch Panel target serves as a client and subscribes/publishes to the shared variables remotely that are hosted on the host PC.

Complete the following steps to add shared variables to the project.

  1. Right-click My Computer in the Project Explorer window and select New»Variable from the shortcut menu to open the Shared Variable Properties dialog box.

  2. Give the shared variable a logical name by typing Temperature in the Name text box.
  3. Select Double from the Data Type drop-down list.
  4. Select Network Published from the Variable Type drop-down list.

  5. Click the OK button.The shared variables appear in the Project Explorer window under Untitled Library 1. LabVIEW automatically creates this library because all shared variables must reside in a library in a project.
  6. Right-click Untitled Library 1, select Save As from the shortcut menu, and save the library as Weather Data.lvlib.
  7. Create another network-published shared variable and name it Wind Speed.

Back to Top

6. Using Shared Variables in Touch Panel Applications

With the network-published shared variables hosted on the development PC in the project, you can use these shared variables to send and receive data between all of the targets in the project. The next step is to create example applications that run on the host PC and the TPC-2006 that publish and subscribe to these shared variables. The example host application simulates the acquisition of weather data and publishes that data to the Temperature and Wind Speed shared variables. The example Touch Panel application subscribes to the weather data and presents the results on the Touch Panel user interface. This tutorial shows shared variables in a distributed acquisition and monitoring application.

Right-click My Computer and select New»VI from the shortcut menu. Save this VI as Weather Station.vi. This VI will run on the host PC.\

You can add shared variables to a VI by dragging and dropping the shared variables from the Project Explorer window to the block diagram. You can then change whether to read from or write to the shared variable by right-clicking the shared variable and selecting either Change to Read or Change to Write from the shortcut menu. Complete the following steps to add the shared variables to Weather Station.vi.

  1. With the Project Explorer window and the Weather Station.vi block diagram visible, drag and drop the Temperature and Wind Speed shared variables from the Weather Data library in the Project Explorer window onto the block diagram.
  2. Right-click the shared variables on the block diagram and select Change to Write from the shortcut menu.

For the purposes of this tutorial, the example application publishes simulated weather data to the Temperature and Wind Speed shared variables. Realistically, this simulated data would be replaced by data acquired from a data acquisition device or distributed I/O system. Complete the following steps to create the host application that simulates weather data.

  1. Place two Simulate Signal Express VIs on the block diagram, configure the simulated signals with your choice of settings, and wire the data outputs of the Express VIs to the Temperature and Wind Speed inputs of the shared variables.
  2. Place While Loop around the Simulate Signals Express VIs and shared variables. Place a Wait for Next ms Multiple function within the loop and wire a value of 50 to update the shared variables every 50 ms.
  3. Wire the error clusters and stop button to the While Loop condition terminal, as shown in the following block diagram.

The next step is to create a Touch Panel application that subscribes to the shared variables hosted on the host PC. Complete the following steps to create a Touch Panel VI under the Touch Panel Windows CE 4.2 target that reads from the Temperature and Wind Speed shared variables within that VI.

  1. Right-click Touch Panel Windows CE 4.2 Device in the Project Explorer window and select New Touch Panel VI from the shortcut menu. Select an appropriate template for the Touch Panel VI and save this VI as TP Weather Monitor.vi.
  2. Add the shared variables to the Touch Panel VI by dragging and dropping them from the Weather Data library in the Project Explorer window to the block diagram. Place the shared variables within the existing Case structure and While Loop on the block diagram of the Touch Panel VI.

  3. To display the data read from the Temperature and Wind Speed shared variables, you must place indicators on the front panel window of your Touch Panel VI. Place a Thermometer and Gauge indicator, located on the Controls»Numeric palette, on the front panel of the Touch Panel VI.

  4. On the block diagram of the Touch Panel VI, wire the data outputs of the Temperature and Wind Speed shared variables to the Thermometer and Gauge indicators.
  5. Place a While Loop around the shared variables and indicators to update them continuously when you click the Run button.
  6. Place a Wait for Next ms Multiple function within the While Loop. Wire a constant with a value of 50 to the input of the function to control the speed at which the shared variables are read and the indicators updated.

Back to Top

7. Deploying and Running Touch Panel Applications

You are now ready to deploy and run the applications so you can share data between the host PC and TPC-2006 through network-published shared variables. You can deploy the Touch Panel application to the TPC-2006 through ActiveSync or by manually transferring the executable to the TPC-2006 through FTP. For both methods, you must create a build specification for the Touch Panel VI.

  1. Right-click Build Specifications under the Touch Panel Windows CE 4.2 Target and select New»Application(EXE) from the shortcut menu.

  2. Enter TP Weather Monitor in the Build specification name text box.
  3. Select the Source Files category and add TP Weather Monitor.vi as the top-level VI.
  4. Select the Machine Aliases category and place a checkmark in the Deploy Aliases File checkbox.
  5. Click OK.

After you create a build specification, you can click the Run button to build TP Weather Monitor.vi into a Touch Panel application, deploy the application on the Touch Panel target, and run the application on the Touch Panel target. You must connect the Touch Panel target to the host PC through ActiveSync. You also can build the Touch Panel VI into a Touch Panel application by right-clicking the build specification in the Project Explorer window and selecting Build from the shortcut menu. You can then manually download the application by copying TP Weather Monitor.exe and TP Weather Monitor.aliases to the TPC-2006 through FTP. Refer to the LabVIEW Help, available by selecting Help»Search the LabVIEW Help, for more information about building, deploying, and running Touch Panel applications.

After you deploy the Touch Panel application (TP Weather Monitor.exe) to the Touch Panel target, run the Windows VI (Weather Station.vi) on the host PC. When you run the VI on the host PC, you deploy the Weather Data shared variables in the project to the host PC and begin writing simulated data to these variables. You now can run the Touch Panel application on the TPC-2006 and read the simulated data over the network. Note that the TPC-2006 and the host PC must have active connections to the Ethernet or a wireless network to subscribe to the network-published shared variables hosted on the host PC.

Back to Top

8. Conclusion

This tutorial shows how to create, configure, and use network-published shared variables to communicate data over a network between a host PC and a TPC-2006 Touch Panel target. The Project Explorer window serves as the framework for organizing various targets and configuring how the nodes in a distributed network communicate with each other through shared variables. The example application illustrates how you can use network-published shared variables to develop an application where a TPC-2006 is used to remotely monitor a process running on a host PC. You could expand this example to create an application to monitor processes running on multiple embedded targets using a Touch Panel device. You can use network-published shared variables to quickly develop applications with distributed intelligence.

Back to Top

Bookmark & Share


Ratings

Rate this document

Answered Your Question?
Yes No

Submit