You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

Reply
 
Thread Tools Display Modes
Old February 22nd, 2021, 06:43 PM   #1
cstep7263
Member
United States

cstep7263 is offline
 
Join Date: Dec 2019
Location: Katy, TX
Posts: 28
Modbus 16bit uint to rslogix 5000 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?
  Reply With Quote
Old February 22nd, 2021, 06:53 PM   #2
drbitboy
Lifetime Supporting Member
United States

drbitboy is offline
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 2,322
Quote:
Originally Posted by cstep7263 View Post
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?
  Reply With Quote
Old February 22nd, 2021, 07:28 PM   #3
cstep7263
Member
United States

cstep7263 is offline
 
Join Date: Dec 2019
Location: Katy, TX
Posts: 28
Quote:
Originally Posted by drbitboy View Post
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.
  Reply With Quote
Old February 22nd, 2021, 08:20 PM   #4
drbitboy
Lifetime Supporting Member
United States

drbitboy is offline
 
drbitboy's Avatar
 
Join Date: Dec 2019
Location: Rochester, NY
Posts: 2,322
Quote:
Originally Posted by cstep7263 View Post
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.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Module Defined Data Type in RSLogix 5000 recondaddy LIVE PLC Questions And Answers 8 January 23rd, 2018 10:27 PM
How to access other ASIC registers in Rslogix 5000? csjokerd1123 LIVE PLC Questions And Answers 0 August 18th, 2017 02:48 AM
RSLogix 5000 Read Only Access? chrisj91 LIVE PLC Questions And Answers 5 September 19th, 2014 12:23 PM
Modbus Master not polling the Modbus Slave through an EtherNet/IP Connection mihiri LIVE PLC Questions And Answers 3 July 15th, 2010 03:41 AM
Mitsubishi Q Series Modbus TCP module QJ71MT91 set up help req'd... Pocko LIVE PLC Questions And Answers 0 July 30th, 2006 03:45 AM


All times are GMT -5. The time now is 10:02 PM.


.