Error 538178 When Reading the Exception Status in Modbus TCP

Updated Jun 13, 2024

Reported In

Software

  • LabVIEW
  • LabVIEW Datalogging and Supervisory Control Module

Issue Details

When I try to read the exception status code of a device from my host PC by utilizing the LabVIEW Modbus API and, specifically, the Modbus TCP protocol together with the Read Exception Status VI, the following error is displayed:
 
Error 538178 occurred at Modbus Master.lvclass: Read Exception Status.vi

Possible reason(s):

This modbus master does not use a serial protocol and cannot perform that action. 


The error is shown in the below dialog box:

Error 538178
 

Solution

There are two possible solutions to address this error:
  • If your Modbus Master and Modbus Slave support serial communication, use the Create Master Instance VI and manually select the New Serial Master instance from the polymorphic selector. This VI will then generate a Serial Master Instance that you can utilize with the Read Exception Status VI for the intended purpose. There is further information that you will need to provide when using the Create Master Instance VI with serial communication. Please refer to the function documentation for more information. 
  • In case either your Modbus Master or Modbus Slave does not support serial communication, you can still try to read the exception status code by using direct TCP communication between your devices. For doing so, you will need to review the documentation of your Modbus Slave to determine what code or combination of bytes have to be sent to receive the exception status code as a response. Once you have determined this requirement, you can use a configuration similar to the one that is shown in the image below:
Read Exception Status with TCP
Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram

Additional Information

This error is being displayed because the LabVIEW Modbus API meets the Modbus Protocol Specification requirements which establish that the Read Exception Status function is defined for Modbus ASCII or RTU (serial communication) only.