Store PLCnext CommunityPLCnext on LinkedInPLCnext on Instagram  PLCnext on YouTube Github PLCnext CommunityStore PLCnext Community

  1. michael.declosey
  2. PLCnext Engineer
  3. Thursday, 07 January 2021

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.

Attachments (2)
Accepted Answer
Martin PLCnext Team Accepted Answer Pending Moderation
0
Votes
Undo

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.

 

Phoenix Contact Electronics Headquarters - PLCnext Runtime Product Management and Support

michael.declosey Accepted Answer Pending Moderation
0
Votes
Undo

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.

Attachments (1)
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.