Modbus 16bit uint to rslogix 5000 int

cstep7263

Member
Join Date
Dec 2019
Location
Katy, TX
Posts
33
Hello,
I'm using Compact Logix L33 in RSLogix 5000. I'm trying to message over modbus register that is 16bit UINT. In Rslogix 5000 do I message everything to a tag tat has a data Type INT and then copy it over to a dint? Or Do I leave it as an INT? No registers are over the value of 16,000. Do I loose any resolution if I Message everything over as a INT?
 
Hello,
I'm using Compact Logix L33 in RSLogix 5000. I'm trying to message over modbus register that is 16bit UINT. In Rslogix 5000 do I message everything to a tag tat has a data Type INT and then copy it over to a dint? Or Do I leave it as an INT? No registers are over the value of 16,000. Do I loose any resolution if I Message everything over as a INT?


Bit patterns for signed INT and unsigned UINT are identical for all values between 0 and 32767 (32k), so with 0-16k it should be fine. The only possible issue would be byte order, but maybe Modbus takes care of that internally?
 
Bit patterns for signed INT and unsigned UINT are identical for all values between 0 and 32767 (32k), so with 0-16k it should be fine. The only possible issue would be byte order, but maybe Modbus takes care of that internally?

Good question on the bye order. I do need to know if the byte order will be shifted.
 
Good question on the bye order. I do need to know if the byte order will be shifted.




Actually you do not need to know that now, because there are only two possibilities: it's either swapped or it's not, and it is not worth the time to figure out which it is a priori.



TL;DR


Once I realized the above was true, I never worried about it. I set up a test where I knew what the integer value should be from the source, and ensured that the 2-byte integer had a different pair of bytes. If the transferred result was not exactly the same at the destination without the swap, then I swapped the bytes, and the final result was always correct.


I've applied this method on everything from two-byte integers to 8-byte IEEE-754 floating point values to 6x6 transformation matrices. It has not failed me yet: it is always easier to learn and extrapolate from a small set of actual data than it is to try to anticipate those data from manuals; CPUs, serial connections and networks are too stupid to lie; manuals often do.
 

Similar Topics

Hello, I need to access the bits from the fire system control panel through RS-485. So, I used Read Var block to read from the panel...
Replies
0
Views
44
I am having a problem communicating my PLC with Drive via Modbus connection. I start by opening the port and there is no problem, but then when I...
Replies
5
Views
64
Does anyone have an example project of the cm ptp ET200 SP HA with 410-5H DCS (PCs7 9.1 SP1) for MODBUS MASTER/SLAVE communication ?
Replies
2
Views
68
Hi, Do you have any trick to make a software working when the 30 days demo version is expired? I've tried to uninstall/clean the registers etc...
Replies
6
Views
243
Hello, I am new to Codesys, and am trying to learn about it for a project we're developing. I've got a couple questions, but first a little...
Replies
1
Views
72
Back
Top Bottom