Example Code

Read cFP TC-120 channels on cFP 180x with Modbus I/O server

Code and Documents

Attachment

Functional Description

This example shows how to read values from a cFP TC-120 thermocouple module inserted on a cFP-180x device through a Modbus I/O server.

FP.JPG

BD.JPG

All you have to do is to configure the correct alias for the shared variables so they can be linked to the correct Modbus registry address. A FieldPoint Modbus address scheme is described into the Using the cFP-180x as a Modbus Device help which location is

C:\Program Files\National Instruments\FieldPoint\documentation\Online Help\FPModbus.chm

MultipleVarEditor.JPG

The FieldPoint Modbus address scheme must be used in conjunction with the shared variable Modbus address scheme that is described in the following document:

Using Modbus I/O Servers (DSC and RT Modules)

Caveats and Additional Notes

For the attached example, the cFP TC-120 module is located into slot 3.Shared variable adresses have been configured as:

  1. F333001 (from right to left):
    • F -> Denotes a 32-bit floating-point number
    • 3 -> this is a Read-Only register in Modbus
    • 3 -> FieldPoint Data Type associated with scaled I/O data. Refer to "Using the
      cFP-180x as a Modbus Device" help for further informations
    • 3 -> Slot number for the module on the cFP bank
    • 001-> channel index (1-based for shared variables)
  2. AF333001L8 (from right to left):
    • AF -> Denotes an array of 32-bit floating-point number
    • 3 -> this is a Read-Only register in Modbus
    • 3 -> FieldPoint Data Type associated with scaled I/O data. Refer to "Using the
      cFP-180x as a Modbus Device" help for further informations
    • 3 -> Slot number for the module on the cFP bank
    • 001-> index (1-based for shared variables) for the FIRST channel of the array
    • L8 -> lenght of the array

This example has been built in LabVIEW 8.6.1 and requires the following LabVIEW Modules/Addons:

  • LabVIEW Real Time Module if you want to use the Modbus I/O server on a RT target;
  • LabVIEW Datalogging and Supervisory Control Module (DSC) if you want to use the Modbus I/O server on a Windows Host target;
  • LabVIEW Datalogging and Supervisory Control Run Time System (DSC RTS) if you want to build and distribute a Windows standalone executable;

Fabio M.
NI
Principal Engineer

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Mr._Jim
Active Participant
Active Participant
on

Thanks a lot!  This is exactly what I was searching for.  It has proven to be a very reliable way for us to communicate between our cFP-2200 and our cFP-1804, allowing us to circumvent occasional Ethernet hiccups.

Contributors