The PDA Emulators provided in the LabVIEW PDA Module are features of the LabVIEW PDA software that allow you to emulate the hardware of various Pocket PC 2003 and Windows Mobile 5.0 devices from the development environment. The PDA Emulators open an instance of a ‘virtual’ PDA device on the development machine that emulates the Pocket PC 2003 or Windows Mobile 5.0 operating system. The example emulator shown in Figure 1 appears as a fully functional depiction of a PDA device running the Pocket PC 2003 operating system. The user can interact with and run software on the emulated device in exactly the same way they would a real portable device, which provides a useful tool for developing and debugging PDA applications without the actual PDA hardware present.
Figure 1. Pocket PC 2003 Device Emulator
Network-published shared variables, new to the LabVIEW PDA Module, allow you to easily and efficiently share data between devices connected over an Ethernet or wireless network. To demonstrate the use of network-published shared variables with a PDA Emulator, some extra steps are required in order to simulate the network connection between the host PC and PDA device.
2. Configuring a Virtual Network Connection
The first step for configuring a virtual network connection between the host PC and PDA device is to establish a network connection and IP address on the host PC. If the host PC is already connected to an existing network, the PC will already have obtained an IP address, and the following procedure is not necessary. However, for systems that do not have access to a network connection or do not have a network adapter installed, it is necessary to use the Microsoft Loopback adapter to simulate a network connection on the host PC.
Microsoft Loopback Adapter Installation
The Microsoft Loopback adapter provides a virtual network adapter that allows you to simulate a network connection in situations where network access is unavailable. If your system has already established a connection to the network and obtained an IP address, you do not need to install the Microsoft Loopback adapter and the following steps do not apply. The Microsoft Loopback adapter is included as a component of the Windows 2000/XP operating system. The following steps describe how to install and configure the Microsoft Loopback adapter through the Windows Device Manager.
- Click Start, and then click Control Panel.
- If you are in Category view, click Switch to Classic View under Control Panel in the left pane.
- Double-click Add Hardware, which will bring up the Add Hardware Wizard.
- Click Next to begin the process of adding the Microsoft Loopback adapter as new hardware in your system.
- When prompted, select Yes, I have already connected the hardware, and then click Next.
- You will now see a list of hardware you can add to your system. At the bottom of the list, click Add a new hardware device, and then click Next.
- Select Install the hardware that I manually select from a list, and then click Next.
- From the list of hardware categories, select Network adapters, and then click Next.
- In the Manufacturer box, select Microsoft, and in the Network Adapter box, select Microsoft Loopback Adapter. Click Next to begin the installation process for the Microsoft Loopback adapter.
- Click Finish.
The Microsoft Loopback adapter will now appear in the list of Network Adapters in the Windows Device Manager. You can check this by going to Start»Control Panel, double-click on System, select the Hardware tab, and click on Device Manager. The Microsoft Loopback adapter will automatically configure its own network connection and obtain its own IP address. You must disable any other existing network adapters in the Windows Device Manager in order for the Loopback Adapter to function properly with LabVIEW network-published shared variables. You can disable a network adapter in the Windows Device Manager by expanding the Network Adapter section, right-clicking on the entry for the existing network adapter and selecting Disable.
Virtual PC Network Driver Installation
Now that the host PC has a network connection and IP address, you must enable the PDA Emulator to obtain its own unique IP address so that the two can communicate to each other using network-published shared variables. The Microsoft Virtual PC Network Driver allows the PDA Emulator to simulate a network connection and obtain its own IP address. You can download the installer for the Virtual PC Network Driver from Microsoft’s website linked below. Follow the instructions on the Virtual PC Network Driver download page for installing the driver. With this utility installed, the PDA Emulator will automatically obtain its own IP address on the same subnet as your host PC and be able to communicate to your host PC using network-published shared variables.
With these utilities installed, you have everything necessary in establish a network connection between a PDA Emulator and your host PC. The next step is to configure the PDA Emulator and network-published shared variables in the LabVIEW Project Explorer.
3. Adding a PDA Emulator to the LabVIEW Project
The LabVIEW Project Explorer provides a useful tool for managing development for various targets from a single location in the LabVIEW environment. In addition to organizing your development targets, the LabVIEW Project Explorer also contains the shared variables used to communicate between the various targets. Refer to the LabVIEW PDA Help and theCreating and Using Shared Variables in the LabVIEW PDA Module tutorial for more information about adding PDA targets and network-published shared variables to the Project Explorer. You will begin by creating a new LabVIEW Project to organize the host PC target, PDA Emulator target, and network-published shared variables within a single location.
Complete the following steps to create a new LabVIEW Project and add a PDA Emulator as a target to this project.
- 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.
- Select File»Save As in the Project Explorer window and save the new project as PDA Emulator Shared Variable.lvproj.
- Right-click the project and select New»Targets and Devices from the shortcut menu to open the Add Targets and Devices dialog box.
- Select Existing target or device and expand the PDA category to show the available targets. Rather than selecting an actual PDA device, select PDA»Windows Mobile»Pocket PC 2003 SE Emulator to add a Pocket PC Emulator target to the project.
The Pocket PC 2003 SE Emulator now appears as a new target within the project.
4. Adding Shared Variables to the Project
You can now add network-published shared variables to the LabVIEW project. The shared variables provide a memory space that can be used 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. PDA targets and emulators cannot host shared variables and can only access shared variables as clients. You create and host the shared variables on the host PC. The PDA 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.
- 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.
- Give the shared variable a logical name by typing Temperature in the Name text box.
- Select Double from the Data Type drop-down list.
- Select Network Published from the Variable Type drop-down list.
- 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.
- Right-click Untitled Library 1, select Save As from the shortcut menu, and save the library as Weather Data.lvlib.
Create another network-published shared variable and name it Wind Speed.
Complete the following steps to add Weather Station.vi to the My Computer target, and PDA Weather Monitor.vi to the PDA Emulator target. These files are attached at the end of this tutorial. For step-by-step instructions of how these VIs were created, refer to the Creating and Using Shared Variables in the LabVIEW PDA Module tutorial.
- Right-click the My Computer target and select Add File. Browse to Weather Station.vi and select Add File to add this VI as a program under My Computer. This VI simulates weather data and publishes that data to the network-published shared variables.
- Right-click the Pocket PC 2003 SE Emulator target and select Add File. Browse to PDA Weather Monitor.vi and select Add File to add this VI as a program under the PDA Emulator target. This PDA VI subscribes to the network-published shared variables hosted on My Computer and displays the data on the user interface of the PDA Emulator.
The Project Explorer should now look similar to the following.
You will now need to create a Build Specification for the PDA Weather Monitor.vi, in order to compile the PDA VI into an executable for the Pocket PC 2003 OS.
- Under the Pocket PC 2003 SE Emulator, right-click Build Specifications and select New»Application (EXE).
- In the Application Information section, enter PDA Weather Monitor for the Build specification name and a convenient location on disk for the Destination directory (i.e. <My Documents>\PDA Weather Monitor). You will need to know this location later in order to transfer the executable to the PDA Emulator.
- In the Source Files section, add PDA Weather Monitor.vi as the Top-Level VI.
- In the Machine Aliases section, select Deploy aliases file. The aliases file contains the IP addresses of the targets in your project and allows them to communicate through network-published shared variables.
- Click OK in order to complete the build specification settings.
- To compile the PDA Weather Monitor.vi into an executable, right-click the PDA Weather Monitor build specification and select Build.
The PDA Weather Monitor.vi has now been compiled into an executable to run on the Pocket PC 2003 OS. You are now ready to launch an instance of the Pocket PC 2003 Emulator and deploy this executable.
5. Configuring the PDA Emulator for Shared Variables
The next step is to launch an instance of the Pocket PC 2003 Emulator and configure it to support shared variables.
- Within the LabVIEW Project Explorer, right-click on the Pocket PC 2003 SE Emulator target and select Install»Support for Shared Variables.
This will launch an instance of the Pocket PC 2003 Emulator and install the necessary files to support connections to network-published shared variables. This process may take several seconds, and you will know this is complete when the PDA Emulator shows the following PDA desktop.
The next step is to deploy the PDA Weather Monitor executable to the PDA Emulator target. When working with actual PDA hardware, this deployment process occurs automatically when the PDA device is connected to the development PC through Microsoft ActiveSync. For an emulated PDA target, you can use folder sharing to transfer the PDA executable to the PDA Emulator. Complete the following steps to configure folder sharing between the PDA Emulator and the development PC.
- From the Pocket PC 2003 SE PDA Emulator, select File»Configure to open the Emulator Properties dialog box.
- In the Shared folder field, enter the same path you selected for the Destination directory when creating the PDA Weather Monitor build specification. This will allow you to access the contents of that directory, including the compiled PDA Weather Monitor executable, from the File Explorer on the PDA Emulator.
6. Deploying and Running the PDA Application
With the PDA Weather Monitor.vi compiled into a Pocket PC 2003 executable, you are now ready to deploy and run the executable on the PDA Emulator and connect to an application running on the host PC through network-published shared variables. With folder sharing enabled on the PDA Emulator, you can use File Explorer on the PDA Emulator to deploy and run the PDA Weather Monitor executable.
- To launch File Explorer, from the PDA Emulator desktop, select Start »Programs. Select File Explorer from the list of programs.
The shared folder containing the PDA Weather Monitor executable will appear as an external Storage Card on the PDA Emulator.
- To browse to the shared folder from File Explorer on the PDA Emulator, select My Device from the Show drop down list.
- To access the contents of the shared folder, select Storage Card.
- To launch the executable on the PDA Emulator, click PDA Weather Monitor.exe. Clicking the Run button on the front panel will start the application, but first you must deploy and publish data to the network-published shared variables.
With the PDA Weather Monitor application deployed to the PDA Emulator, you will need to run the Weather Station.vi application on the host PC. Running this application will automatically deploy the Temperature and Wind Speed network-published shared variables on the host PC, and begin publishing simulated weather data to these shared variables. With the shared variables deployed and data being published, you can run the PDA Weather Monitor executable on the PDA Emulator in order to subscribe to those shared variables over the network and present the data on the user interface of the PDA.
- From the LabVIEW Project Explorer, double-click to open Weather Station.vi, and click the Run button. This will deploy the Temperature and Wind Speed shared variables, and begin publishing simulated data.
- From the PDA Emulator, click the Run button on the user interface of the PDA Weather Monitor application to subscribe and display the data from the Temperature and Wind Speed shared variables.
To review the steps covered in this tutorial, you first began by configuring the host PC and PDA Emulator target to connect to each other over a local network connection. You then created a PDA Emulator target within the LabVIEW Project Explorer and added network-published shared variables and VIs to the project. You then compiled the PDA VI into an executable by creating a build specification, and deployed that executable to the PDA Emulator through folder sharing. With these steps complete, you can run applications on the host PC and PDA Emulator target that communicate to each other using network-published shared variables. This procedure can be very useful for demonstrating the use of shared variables with PDA target and testing applications without the actual PDA hardware present.