Jump to content

Sending Strings over Modbus TCP to a V560 PLC


Recommended Posts

So i am currently looking in to the possibility off sending strings (probably between 20 and 32 characters) to a v560 plc over modbus TCP. The purpose of the string is product name/version that is going to be produced on the machine where the v560 is installed. So the operator can easily sees if the right parameters are loaded. currently we do this with a 7 to 10 digit number but a mistake is easily made.

How i am thinking of achieving this is by converting the string to ASCII and writing it to 16 integers. Then in theory i could use ASCII string variable to display the name on the HMI.

For the moment i dont see any problems with the setup, but before i start writing the program i thought i might be smart to ask around here for other opinions. maybe there is a smarter way to do this?

Link to comment
Share on other sites

  • MVP 2023
10 minutes ago, LeonMötter said:

For the moment i dont see any problems with the setup, but before i start writing the program i thought i might be smart to ask around here for other opinions. maybe there is a smarter way to do this?

Frankly, I don't see any other way to do this that wouldn't be overly complex. This is exactly what I'd do.

Link to comment
Share on other sites

  • MVP 2023

To me it depends on what is harder to implement overall.  If the numbers always remain the same you could have a database in the plc that matches numbers to the visual description you want, and then displays that instead.  But if the numbers change all the time, then you need to do as described.

cheers, Aus

Link to comment
Share on other sites

Thanks for the input,

@Ausman, the numbers always stay the same, but new ones are constantly added. that is the reason we have a external database (SQL server) that can send recipes to each production machine. There are 11 production machines so keeping some sort of an internal database in each of them is probably not the best idea. Still Thanks for the reply.

Link to comment
Share on other sites

I think it will be easier over TCP or UDP, you could send the ascii characters as string and the PLC will be able to read it as it is, I kind of did that while trying to implwment a FTP client on a v570, i could retrive the folder and file names.

However Modbus  its ok, but it deppends on how easy it will be for you to work on the database/computer side, you maye need to rearrange the bytes because of the endianess and also you need to set the specific modbus addreses. I did the other way arround ASCII string stored on the PLC to database over modbus TCP, and was tricy because my client (PC) had a slightly different implementation for de modbus protocol, and I did not had a way to combine the different MIs to a single string, best i could do was hex values, and at the end I needed to learn new programming languages and how to re compile the Database software (which is open source) just to add one custom function to convert everything into a human readable string.

 

over TCP its just sending the message to an specific port and socket, the PLC has a function block for reading the protocol as ASCII 

Link to comment
Share on other sites

On 9/1/2022 at 10:05 AM, Flex727 said:

Frankly, I don't see any other way to do this that wouldn't be overly complex. This is exactly what I'd do.

 

I'll just leave this over here...

image.thumb.png.b4c9bf557d9a830225c7d67eb9c4e4c6.png

 

PLC:

Just 2 function blocks required on the PLC Socket Init and UDP_RAW scan (In theory should be the same over TCP, UDP was easier to implement required fewer things)

 

PC:

I'm using Node-Red and just send a "payload" containing the string "Hello world" using the UDP node :

udp out

This node sends msg.payload to the designated UDP host and port. Supports multicast.

 

And that was it. It took me 5 minutes no ASCII string conversion no data splitting, no byte re arrangement. just send a pure string as it was written.

Of course LeonMötter  It will be easy as easy it is from your the other end to get that string to an specific port and socket

Link to comment
Share on other sites

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...