Archived: (Legacy) Can I Use Microsoft Visual C++ 6.0 and/or Visual C++ .NET with My FieldPoint Modules?

Updated Mar 15, 2018

Reported In

Hardware

  • Controller for Compact FieldPoint

Software

  • Measurement Studio

Driver

  • NI-FieldPoint

Programming Language

  • Visual Basic .NET
  • C++

Issue Details

I would like to use Visual C++ 6.0 and Visual C++ .NET with my FieldPoint modules, but I do not know what support is available.

Solution

You must have NI Measurement Studio installed to use the Measurement Studio for Visual C++ FieldPoint API. You can use FieldPoint with Visual C++ with all I/O modules (and all settings) and all ethernet I/O modules; however, you cannot use the API with serial or FieldBus modules. The API contains a set of objects that are used to access the FieldPoint bank, you do not make direct calls to any DLL.

Note: The C++ FieldPoint interface is being made obsolete with Measurement Studio 7.1. Existing programs that use the class library will continue to compile, but there will be no more updates or bug fixes for this interface. Refer to the link at the bottom for more information.

Key Points include:
  • 1.) The API does not use FieldPoint Explorer to program, so users do not need to setup any names in FieldPoint Explorer before beginning development. Finished applications do not need to be distributed with FieldPoint Explorer or any FieldPoint Explorer configuration files, as they do with other APIs.

    2.) Automatically detects what modules and channels are available on a given IP address or hostname. Automatically detects if the hardware supports an operation, and throws an exception in that case. 

    3.) The user can install event handlers for asynchronous notification of changes to channel data. The new data value is reported along with a timestamp and a status, which reports messages in the case of an open thermocouple, or open RTD, for instance.

    4.) Native support for MFC and C++, and interoperability with other Measurement Studio for C++ components, including environment integration tools similar to the Measurement Studio Add/Remove Components Add-in. Help is also integrated into the environment.

Technical Details:
  • There are three classes of primary importance:
     
    • 1.) CNiFieldPointNetworkModule represents a bank, e.g. FP-1600, FP-2000, etc.
      2.) CNiFieldPointIoModule represents an I/O module connected to a bank, e.g. FP-AI-110, FP-TB-10, etc.
      3.) CNiFieldPointChannel represents a channel connected to an I/O module
      Of these three, you create only CNiFieldPointNetworkModule objects; objects of the other types are received from this object.

    There is one class that useful for working with event callbacks:
     
    • 1.) CNiFieldPointEventHandlerId is used as a cookie or ID for a callback function that the user has installed. You can use this ID later to remove the callback. You don't have to work with this class unless you want to this functionality.

    There are three exception classes:
     
    • 1.) CNiFieldPointConnectionException encapsulates a connection exception and is thrown when the user supplies a bad IP address or a network connection has timed out.
      2.) CNiFieldPointInvalidArgumentException is thrown when the user supplies a parameter that is invalid. The common cases where this is thrown is if the user attempts to write a value to a channel that doesn't support that value (e.g. writing 23 V to a 0-10 V channel) or asking for the 17th I/O module when there are only nine attached.
      3.) CNiFieldPointNotSupportedException is thrown when the user calls a method on a I/O module or channel that doesn't support that method.

  Note: Measurement Studio no longer provides active support for Visual Studio 6.0, Visual Studio 2003, and Visual C++ MFC. If you want to continue building or developing applications using these legacy environments/languages, you can use the NI Measurement Studio for Legacy Environments/Languagesproduct, which includes support for these products and compatible device drivers. 

WAS THIS ARTICLE HELPFUL?

Not Helpful