Micro820 Modbus TCP

CProv

Member
Join Date
Feb 2021
Location
Oklahoma
Posts
13
I’m trying to read values from a device that can either send registers as 32 bit or a pair of 16 bit but if I understand right, the micro can only read 1 16 bit and the only format you can use in the modbus instruction block is a WORD. Is there a way to make this work?
 
Manual: https://literature.rockwellautomation.com/idc/groups/literature/documents/um/2080-um005_-en-e.pdf

The Micro820 has a DINT variable (Signed 32-bit integer value), or you can use a UDINT (Unsigned 32-bit integer value), so that's not the problem. (reference page 49).

The manual shows a UDINT in an example, so it's doable. As far as that goes, the example shows the Modbus message being loaded into a UDT. (p. 19)


Doesn't look like a problem from the PLC side. What are you using on the other end?
 
Totalflow XFC on the other end. I was trying to use the modbus tcp function block. But I see what you’re saying. Except the points you refer to are CIP. In that modbus MSG_MODBUS2 block the local address array only allows a WORD as far as I can tell.
 
Maybe I need to use serial
not if Modbus TCP works, because the data transferred are the same.

1) Are you getting data, even if they are 16-bit Words, from the Modbus Slave device (Totalflow XFC)?
2) If yes,
2.1) What are the values of the 16-bit Words you are receiving on the Micro820?
2.2) What are the values of the 32-bit integers (or REALs) that you expect to reconstruct from each pair of 16-bit words?
3) Do you have a link to the manual for the Totalflow XFC that lists the addresses of the Input or Holding Registers?
 
Cool! Old skool!

It apparently does not support Modbus TCP, and you do have to use serial (I'm referencing the "XFC/XRC Series Start-Up Guide" from: https://library.e.abb.com/public/fc72a9ad432393ef852574f8006b8217/2100902AWAD.pdf Please correct me if I went to the wrong source).

In the guide there is precious little said about Modbus, and it only uses either ASCII or RTU, so you are going to have to use serial, at least to a gateway.

With that said, I would recommend either ASCII or RTU, using RS485, buying a nice USB to RS485 converter that has blinky lights, and using a free or for pay Master/Slave program (aka "Modbus Poll") to get the conversation working at both ends (get XFC to program working to the Modbus Poll first, then the Modbus Poll to the PLC).

I just downloaded: Rilheva Modbus Poll FREE Modbus RTU | Rilheva IIoT Platform It's free for the price of your email address. Looks pretty snazzy too. No idea if it actually works...


As for your data, this is another thing that will getcha is that formatting could done in any number of ways including swapping nibbles on the byte level (which I think is the Modbus standard anyway).

And speaking of standards, there really is no such thing as a Modbus "standard" Just a lot of one bedroom trailers, incest, and kissing cousins. :)


On the PLC side of things, I would suggest dumping your data into a structure set up to provide the 32 bit data types that you are after.


One of the interesting things that I saw was that your XFC speaks the ASCII version of Modbus, pretty cool!
 
not if Modbus TCP works, because the data transferred are the same.

1) Are you getting data, even if they are 16-bit Words, from the Modbus Slave device (Totalflow XFC)?
2) If yes,
2.1) What are the values of the 16-bit Words you are receiving on the Micro820?
2.2) What are the values of the 32-bit integers (or REALs) that you expect to reconstruct from each pair of 16-bit words?
3) Do you have a link to the manual for the Totalflow XFC that lists the addresses of the Input or Holding Registers?
I am getting data. And I am getting the correct number as far as the pairs of 16 bits are concerned. For the decimal 25.5 as 32 bit I’m getting 16844. For the first word. You build the register mapping yourself so I make it whatever I want and just assign the points I want. I really think the issue is there’s nowhere to put it that will read 32 bits.
 
Cool! Old skool!

It apparently does not support Modbus TCP, and you do have to use serial (I'm referencing the "XFC/XRC Series Start-Up Guide" from: https://library.e.abb.com/public/fc72a9ad432393ef852574f8006b8217/2100902AWAD.pdf Please correct me if I went to the wrong source).

In the guide there is precious little said about Modbus, and it only uses either ASCII or RTU, so you are going to have to use serial, at least to a gateway.

With that said, I would recommend either ASCII or RTU, using RS485, buying a nice USB to RS485 converter that has blinky lights, and using a free or for pay Master/Slave program (aka "Modbus Poll") to get the conversation working at both ends (get XFC to program working to the Modbus Poll first, then the Modbus Poll to the PLC).

I just downloaded: Rilheva Modbus Poll FREE Modbus RTU | Rilheva IIoT Platform It's free for the price of your email address. Looks pretty snazzy too. No idea if it actually works...


As for your data, this is another thing that will getcha is that formatting could done in any number of ways including swapping nibbles on the byte level (which I think is the Modbus standard anyway).

And speaking of standards, there really is no such thing as a Modbus "standard" Just a lot of one bedroom trailers, incest, and kissing cousins. :)


On the PLC side of things, I would suggest dumping your data into a structure set up to provide the 32 bit data types that you are after.


One of the interesting things that I saw was that your XFC speaks the ASCII version of Modbus, pretty cool!
It does support tcp and I’ve done it. That looks like it’s just the simplified manual possibly. I didn’t think about it but the serial wouldn’t work either because the instruction block uses the same array as the tcp one. ☹️ wtf Allen Bradley.
 
Did I have the correct manual? I just searched for "TCP" in it since it would be (should be) included in the name of the protocol.


Tim Wilborne has some YT videos on this subject. And I imagine that he still hangs out here as well. But here's a video on the subject:


He has more Modbus videos as well.


Bottom line is that you should be able to bring the Modbus data into an array of SINTs and then map a UDT to that array.
 
I am getting data. And I am getting the correct number as far as the pairs of 16 bits are concerned. For the decimal 25.5 as 32 bit I’m getting 16844. For the first word. You build the register mapping yourself so I make it whatever I want and just assign the points I want. I really think the issue is there’s nowhere to put it that will read 32 bits.

Go here: IEEE-754 Floating Point Converter

And enter 25.5 in the "Decimal Representation" box. Then take the first 16 bits of your binary result and you will get your 16844. Now we know what's going on.

So since you want the it as a 32 bit result, wouldn't we need to multiply the 16844 x 65536? (or do a bit shift left x 16 I suppose).
 
I got ahead of myself, you don't want to simply do a bit shift, you will want to do a bit shift and then do a "OR" operation with the other 16 bit word. Duh.

IEEE 754 Converter.png

I "fleshed" it out using a number with a "fuller" mantissa to illustrate the need for shift and OR.
 
16844 comprises the high two bytes (16-bits) of IEEE-754 single-precsiont (32-bit) floating-point valuye 25.5:

Code:
>>> struct.unpack('f',struct.pack('HH',0,16844))
(25.5,)

That is Python using the struct module to combine 16-bit (Half-)words 0 and 16844. You can do the same thing: COPy the bits (not the values) of the 16-bit word pair (two contiguous elements of the array from the Modbus TCP transfer) into a REAL tag; you may need to reverse the word order before the COPy. You will not have to swap the byte order within the words.
 

Similar Topics

Hi, I started my journey with Micro820 and I have to read input status address 10001-10010 from one device via Modbus TCP, everything works fine...
Replies
0
Views
1,191
I have the HMI setup as shown in the picture. Then from my PLC and from the handy Baseblock ComTest Pro program I get a illegal data address. "...
Replies
8
Views
4,425
Hi Guys I have completed a couple of applications with the Micro820 from AB so I thought I would use one for an automated test system. I have a...
Replies
12
Views
7,137
Hello, I set up my Micro820 with a basic mapping. When I try to run a script to read the addresses I get errors for illegal addresses...
Replies
2
Views
172
Hi Guys, I am a new member and this is my first post! I have a little PLC experience but it is mostly with siemens logo and using ladder...
Replies
4
Views
905
Back
Top Bottom