Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Document Type: Tutorial
NI Supported: Yes
Publish Date: Dec 8, 2006


Feedback


Yes No

Related Categories

Related Links - Developer Zone

Related Links - Products and Services

Using LabVIEW 7.0 to Collect Data from FieldPoint Modules

11 ratings | 3.09 out of 5
Print

Overview

Two of the most common methods of collecting data from a FieldPoint module are using the FieldPoint OPC server and using the FieldPoint subVIs in LabVIEW. This document explains how to collect data from FieldPoint modules in LabVIEW using the FieldPoint subVIs. This information applies to FieldPoint 4.0 and LabVIEW 7.0

Getting Started

This document assumes the following:
  • You have successfully set up the modules in Measurement and Automation Explorer (MAX).
  • You can monitor and write values to the modules in MAX.
  • You have saved the configuration (.iak) file.

After you set up the modules in MAX, you see a window like this:



Figure 1. A FieldPoint Comm Resource Configured in MAX

This example uses an FP-2010 with an FP-AI-100 and an FP-DO-301. The name of the configuration file is my_fieldpoint.iak.

When you install the FieldPoint 4.0 software on your computer, the FieldPoint subpalette is installed on the NI Measurements palette, which is located on the Functions palette in LabVIEW. You can find FieldPoint 4.0 on the National Instruments ftp site at ftp://ftp.ni.com/support/fieldpoint/Server/


Figure 2. The FieldPoint Subpalette

FieldPoint SubVIs

In addition to the FieldPoint Express VI, which enables a quick and simple setup, the FieldPoint subpalette has two VIs for use in most applications:
  • FP Read (Polymorphic)
  • FP Write (Polymorphic)

    Reading One Channel

Follow these steps to read one channel of a FieldPoint module using the LabVIEW FieldPoint subVIs.
  1. Place the FieldPoint IO Point Constant on the block diagram. The FieldPoint IO Point Constant specifies the FieldPoint tag to be used for I/O operations. Click the arrow in the constant and select the desired comm resource name, device name, and item name. You may need to browse to the item. In this example we use FieldPoint\FP Res\FP-AI-110 @4\Channel 0.
  2. Place FP Read (Polymorphic) on the block diagram FP Read pulls the values from the FieldPoint module into LabVIEW. You can call FP Read and FP Write as many times as you want. FP Read and FP Write are often called in a loop.
  3. Wire the output of the FieldPoint IO Point Constant to the FieldPoint IO Point In terminal of FP Read (Polymorphic).
  4. We are reading only one value, so we want to change the output type by right-clicking FP Read (Polymorphic) and clicking Select Type>>FP Read (Float IO).
  5. Right-click the value output of FP Read (Polymorphic) and select Create>>Indicator.
  6. Place a Simple Error Handler (Functions>>Time&Dialog>>Simple Error Handler) on the block diagram. This enables you to monitor the error cluster.
  7. Wire error out from FP Read (Polymorphic) to error in on the Simple Error Handler as shown in the following diagram.

Figure 3. This VI Reads One Channel of a FieldPoint Module.

Reading Multiple Channels

Please complete the previous section, Reading One Channel, before starting this section. Then follow these steps to read values from multiple channels:
  1. Place another FP Read (Polymorphic) parallel to the first FP Read (Polymorphic) on the block diagram.
  2. Create a constant for the FieldPoint IO Point In input by right-clicking the new FP Read (Polymorphic) and selecting Create>>Control. Click the arrow in the constant and select the desired comm resource name, device name, and All as the item name. In this example we use FieldPoint\FP Res\FP-DI-301 @3\All.
  3. To view the values of the FP-DI-301 module as an array of booleans, right-click the new FP Read (Polymorphic) and choose Select Type>>FP Read (Boolean Array IO).
  4. To combine the errors from both FP Reads, place the Merge Errors function (Functions>>Time & Dialog>>Merge Functions) on the block diagram.
  5. Wire the error out outputs from both FP Reads into error 1 in and error 2 in of the Merge Errors function.

Figure 4. A VI to Read Multiple Channels

Monitoring FieldPoint Values Continuously

Please complete the previous sections before starting this section. Then follow these steps to monitor values continuously:
  1. Place a While Loop (Functions>>Structures>>While Loop) on the block diagram around the FP Reads.
  2. Place a Wait Until Next ms Multiple function (Functions>>Time & Dialog>>Wait Until Next ms Multiple) on the block diagram inside the While Loop. The wait statement sets the update rate. If you do not include a wait statement, LabVIEW will execute the loop as fast as possible and could use up all of your CPU resources.
  3. Right-click the left side of the Wait Until Next ms Multiple function and select Create>>Constant. Enter the number of milliseconds to wait. This example uses 100 ms, as shown in the following diagram.

Figure 5. A VI to Read Multiple Channels Continuously

Writing Values Instead of Reading Values

To write values to FieldPoint modules, you can replace the FP Reads with FP Writes and replace the value indicators with controls. In the following block diagram, the FieldPoint IO Point Constants contain input modules, but in order to write you will have to access output modules.


Figure 6. A VI to Write to Multiple Channels
Related Links:
Using NI FieldPoint 4.0 with LabVIEW 7.0
11 ratings | 3.09 out of 5
Print

Reader Comments | Submit a comment »

 

Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).