Skip to content

Modbus Addressing using MB_TCP_Server_3 as slave

Hi,

 

I am currently using function block MB_TCP_Server_3 as a slave to an external C# application for the purposes of sending real time field device values via Modbus.

I have the modbus communications up and working correctly between the master and slave and the Modbus Inputs correctly addressed for BOOL variables in the application.

I was wondering how I can address REAL variables to the ModbusData word array (first screenshot) for InputRegisters or HoldingRegisters. Every attempt I have made so far throws this Modbus Slave error in my C# application:

 


Exception of type 'Modbus.SlaveException' was thrown. Function Code: 132, Exception Code: 2 - The data address received in the query is not an allowable address for the server (or slave). More specifically, the combination of reference number and transfer length is invalid.

 

I am trying to reproduce Rockwell's Modbus mapping (second screenshot) as we are looking to replace Micro820's with AXC F 2512's, and I cant find any more documentation other than the Modbus_TCP_8 function block PDF.

(if I could also get a rundown on how to address the other data types in the second screenshot that would be really helpful)

 

Cheers,

Michael.

Comments

  • Hi Michael,

    Since a REAL value has 32 bits and a Modbus register only contains 16 bits, the REAL value must be mapped to 2 x 16 bit registers:

    inline 108170162

    The same would apply to UDINT, which is also a 32-bit value.

    Hope this helps.

    ~ Martin.

     

  • Hi Martin

     

    I was still getting the error even when using Modbus Poll (see attached). Upgrading to MB_TCP_Server_5 fixed that issue.

    This method of addressing works for me, cheers.

     

    Michael.

Sign In or Register to comment.