Does MATLAB R2026a Industrial Communication Toolbox support custom Modbus function codes?

I used the Modbus explorer to read data from an HMP110 sensor from Vaisala. I can read data from my device without any issues, but I also need to read the device identification information.
To do this, instead of sending a decimal "03" function code to read data from a specific register, I need to send a function code of "43" with the subfunction code "14" based on the data sheet of this device. However, I don't know how to do this. The "read" function should be a decimal "03" function code according to the Modbus interface documentation.
Does MATLAB R2026a Industrial Communication Toolbox have a function where I can build a string of commands to make a custom Modbus request so I can read the "Device Identification Objects"?

 Accepted Answer

As of MATLAB R2026a, the Industrial Communication Toolbox does not support creating custom Modbus requests (for example, using function codes such as 43/14). The Modbus interface provides high-level functions that map to standard operations and does not allow constructing arbitrary Modbus frames. 
One workaround would be to use the serial port interface (if the instrument is connected through serial RTU) or TCP/IP interface (if connected through TCP/IP) to create these custom data packets by following their corresponding workflows of writing and reading data, and then use the Modbus interface to read and write data from and to specific registers.
Please note that all aspects of the Modbus request and response (including frame construction, CRC calculation, and parsing) need to be handled explicitly in this approach.

More Answers (0)

Products

Release

R2026a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!