Transfer 32 bit floating point to 16 bit integer via Modbus TCP/IP

kratos1

Member
Join Date
May 2017
Location
viet nam
Posts
25
Hi eveyone. I need transfer signal from system 1 to DCS via modbus. System 1 only can send 32 bit floating point. DCS receive 16 bit integer. How should I do?
For example, system 1 send signal at address 1 (32 bit floating), DCS will receive at address 1 and 2 (16 bit integer), and we need convert address 1 and 2 in DCS...I don't know about that. Could anyone help to explain and solve this issue. Thanks
 
We need more information to be able to offer useful help.

What make and model are the [system 1] and [DCS] devices? Can you provide PDF manuals for the devices?

Which system initiates the transfer? That is,


  • Is the [system 1] device writing the 32-bits to the [DCS] device?
  • OR
  • Is the [DCS] device reading the 32-bits from the [system 1] device?
Explanation


The Modbus protocol only provides two kinds of access

  • single-bit: read or write single or multiple Coils; read single or multiple Discrete Inputs)
  • 16-bit: write single or multiple Holding Registers; read multiple Input or Holding Registers; etc.
This process will be using 16-bit access.

The REAL value in [system 1] probably comprises 32 contiguous bits, like this:
590px-Float_example.svg.png

(Cf: https://en.wikipedia.org/wiki/Singl...cision_binary_floating-point_format:_binary32)


Let us assume that the [DCS] device is going to initiate a Modbus TCP/IP read of those 32 bits as two 16-bit integers. So, bits [0:15] on the left half of the image above map to (will be) one 16-bit integer (Register), and bits [16:31] on the right half map to (will be) another 16-bit integer (Register).

Read the [system 1] programming manual to determine the addresses of the two 16-bit Modbus Registers that map (point) to the 32 bits of the real number, and also what type of reg; they will almost certainly be adjacent e.g. 40011 and 40012.

Once that Modbus transfer is working, we now have the bits of the real value on the [DCS] device as two 16-bit integers; that is the easy part.

We do not know the word order, or the byte order, of the bits on either the [system 1] device or the [DCS] device. Also, because we know nothing about the DCS system, we do not know how to recombine the two 16-bit integers into a single 32-bit real.

The best way to proceed would be to do the transfer, and then post the results here in this thread:

  • The value of the real on the [system 1] device
  • The value (hexadecimal preferred, decimal also okay) of the two 16-bit integers received by the [DCS] device, as interpreted by the [DCS] device.
    • In fact, you should probably make the Modbus read operation retrieve at least three or four contiguous 16-bit integers and post all of the values.
 
What model is the DCS and system1? Without that the only thing we can say is "yes".
There's always some instruction (or flexibility in the variable address space) to do this.

In Rockwell, you'd use a COP instruction, in Siemens you'd write the two 16 bit words continuously and then read the address as a floating point value.

But without knowing the platforms it's impossible to say more.
 
Thanks for your support. We need to transfer 32 bit floating point from vaisala system to Toshiba DCS but currently we changed design to transfer from vaisala to Rockwell PLC. I have used Modbus TCP slave sample code to receive modbus signal via ethernet module (EN2T), can we do as same practice in this case
 
In Logix, either copy them:
COP myInt16Array[0] MyReal 1

Or byteswap and then copy:
MOV myInt16Array[0] myTempInt16Swap[1]
MOV myInt16Array[1] myTempInt16Swap[0]
COP myTempInt16Swap[0] MyReal 1
 
  1. Which Vaisala device? Can you point us to a manual?
  2. Which Rockwell PLC, and Rockwell Software package, and versions?
  3. If Vaisala device is HMM170, then
    1. Set up the Rockwell PLC to read (command 03) eight Holding Registers starting from address 7936
    2. read those eight Holding Registers into an array of eight INTs,
    3. post to this thread the resulting values of the Holding Registers from the Rockwell PLC
  4. For any other Vaisala device,
    1. Set up the Rockwell PLC to read (command 03) eight Holding Registers starting from an address three less than the register of interest
    2. read those eight Holding Registers into an array of eight INTs,
    3. post to this thread the resulting values of the Holding Registers from the Rockwell PLC
 
Thanks,
1, Controllogix 1756-L73 controller Studio5000 version 30
2, I already setup a Modbus TCP Slave in Studio 5000 for the Allen Bradley Controllogix L73 using Add on via Ethernet module EN2T install with same controller rack at slot 2, so I set MBTU_EnetModulePort is $01$02 to communicate with Toshiba DCS.
3, now i plan to set up a Modbus TCP Master using Add on via other Ethernet module EN2T installing in Remote IO rack (Controlnet node 3, slot 16) to communicate with Vaisala (Slave). In this case, I don't know how to set MBTU_EnetModulePort. If connection can establish, how can read data from Vaisala 32 bit floating.
My plan is communicate Vaisala to L73, L73 to Toshiba DCS. L73 to DCS already establish
 
Based on the description and tag names, you are trying to use old Modbus sample code.
There is a better AOI based code that is available for download from the Sammple code library.
 
I cannot help with the MBTU_Enet... setting, but my Google skillz (;)) did find this:
MBTU_EnetModulePort this value should be set to '$01$00' for all CompactLogix 5370
processors. This value should be set to '$01$xx‟ where xx is the 1756 backplane slot number, in hex,
of the desired Ethernet module for all 1756 ControlLogix processors, for example '$01$02' for an
Ethernet module located in 1756 backplane slot 2 or '$01$10' for an Ethernet module located in 1756
backplane slot 16.
But I don't know how the Remote IO rack would work into that.

As far as reading the 32-bit floating-point values, that is straightforward and much easier than making the connection, but knowing the Vaisala device model number would help immensely.
 
Thanks debitboy. Yes, I use the mod-bus Master sample code from Rockwell. As same confuse for me to set port for EN2T in remote IO rack.
 
Well, .LocalSlot is a SINT, so there are only 255 possibilities, and I expect if you start at 0 and try every one it will not take long until you hit the right one. It's not a brilliant strategy, but I've seen (and executed) strategies far less brilliant to achieve success.


Unless there is no correct .LocalSlot because that AOI cannot work with Remote IO racks:

Requirements
Hardware Requirements
The Modbus TCP Client code requires a ControlLogix or CompactLogixcontroller with anEtherNet/IP module that supports Logix Sockets functionality. SeeKnowledgebasetechnote470690 for complete list of controllers and modules. https://rockwellautomation.custhelp.com/app/answers/detail/a_id/470690
 
@drbitboy:
OP is not using AOIs, he is using old Master/Slave code 1.02 or 1.03 that is no longer available at the Sample Code Library
 
Maybe, the last post seemed to suggest they switched to the new one, but the query is still how to specify the "slot" for an EN2T in slot 16 of Remote IO rack Controlnet node 3 (as if I had any clue what those words meant ;)).

Until the Modbus TCP starts working, we really can't help with the INT16/REAL32 bit, which is apparently now the easy part.

Is this OP's problem really that common, that configuring a ControlLogix to speak Modbus is not a problem that has been previously solved? Or does the hurdle have more to do with the Remote IO location of the EN2T?

If it's the ControLogix is a Modbus TCP client and it is always making the same call, would it be easier to simply send the 03 command and wait for the response in a standard TCP socket client/server dialogue on port 502? It's not e.g. CIP implicit, so I suspect there's no extra baggage in Modbus TCP.
 
Modbus AOI (and I believe the old application) supports only local EN2T module.
ControlNet bridging is not supported.
While Logix messaging supports bridging, this AOI uses sockets that works with Local Modules.
 

Similar Topics

Hi all, I was under the impression that Load and Transfer operate independantly of the RLO ? If this is the case the following code shouldn't...
Replies
10
Views
9,048
I have an RIO network consisting of a 1747-SN, two 1749-ASB's with 48IO each, and a 1791-IOBX with 64IO. I have a steady green COM light on all...
Replies
9
Views
3,552
hi all PLC experts, im now doing a project where i have limited input terminals. so i tried to reduced the usage of input terminals in operation...
Replies
2
Views
2,365
Hi all, Im having trouble transferring a program from one panelview 550 to an new one. I can insert a flash card into the old panelview and upload...
Replies
20
Views
307
Hi Everyone, I have a customer that needs a CQM1H (CPU51) replaced. They purchased the processor new-old-stock from a source they found online...
Replies
3
Views
320
Back
Top Bottom