Jump to content

Reading strings from modbus slaves result with wrong text


Hoops123

Recommended Posts

Hello,

 

I now have a few unitronics PLC's on site, I am getting more familiar with them but still fairly new.

I have an application where the PLC talks to a cobot over modbus, everthing works great, never had any problems with it. This morning i was asked if I could display the "current program" running on the cobot on the unitronics HMI. 

image.png.85705bbba660318a163fa96616c6d9f2.png

I thought it would be as easy as just reading a string data type.. 

I'm now thinking that to read the string, I read each interger in addresses 7701-7799 assuming that the numbers are Ascii code(manual doesnt say) then concatenate them to get the string.

Does anyone have experience of reading strings from modbus slaves??

Link to comment
Share on other sites

  • 3 weeks later...

I spoke to soon on this one. I thought it was working but I just didnt look at the result properly.

Each pair of letters in the string are switched.

So the cobot has a program in it called "320rpm" reading this over modbus (as above) and displaying the result on the HMI I get "23r0mp"

Anyone have any ideas on how to fix this one?

 

Link to comment
Share on other sites

  • MVP 2023

As a Vision only user, that looks like an Endian problem, which would require some simple rearranging of data, in a consistent pattern for everything received. 

In Vision this is done with Swap Bytes, don't know what it is called in Unilogic, but have to assume it exists.

cheers, Aus

Link to comment
Share on other sites

  • NoamM changed the title to Reading strings from modbus slaves result with wrong text

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...