Hoops123 Posted August 23, 2023 Report Share Posted August 23, 2023 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. 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 More sharing options...
Gabriel Franco Posted August 23, 2023 Report Share Posted August 23, 2023 1. Create a new tag buffer type (array long enough to hold string lenght) and a new tag string-ascii type. 2. Create a new Modbus operation using buffer name. 3. In ladder, use copy buffer to tag. Link to comment Share on other sites More sharing options...
Hoops123 Posted August 23, 2023 Author Report Share Posted August 23, 2023 Brilliant!! worked a treat. Many thanks Link to comment Share on other sites More sharing options...
Hoops123 Posted September 11, 2023 Author Report Share Posted September 11, 2023 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 More sharing options...
MVP 2023 Ausman Posted September 11, 2023 MVP 2023 Report Share Posted September 11, 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 More sharing options...
Hoops123 Posted September 12, 2023 Author Report Share Posted September 12, 2023 Thanks Aus, it was an endian problem, unistream does have a swap bytes FB which done the job. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now