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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.