Hoops123 Posted August 23 Report Share Posted August 23 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?? Quote Link to comment Share on other sites More sharing options...
Gabriel Franco Posted August 23 Report Share Posted August 23 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. Quote Link to comment Share on other sites More sharing options...
Hoops123 Posted August 23 Author Report Share Posted August 23 Brilliant!! worked a treat. Many thanks Quote Link to comment Share on other sites More sharing options...
Hoops123 Posted September 11 Author Report Share Posted September 11 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? Quote Link to comment Share on other sites More sharing options...
MVP 2022 Ausman Posted September 11 MVP 2022 Report Share Posted September 11 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 Quote Link to comment Share on other sites More sharing options...
Hoops123 Posted September 12 Author Report Share Posted September 12 Thanks Aus, it was an endian problem, unistream does have a swap bytes FB which done the job. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.