Jump to content
Sign in to follow this  
BobH

TCP/IP string communication

Recommended Posts

Hello,

I am writing a communication program. I receive a string of data and need to compare it with a couple of parameters. Anyone?

example :

i receive : /X354,Y653,Z345/

my PLC needs to recognize :  /X... , Y..... , Z.... /

in the future i also need to parse this and display the values in different text boxes.

thx in advance

Share this post


Link to post
Share on other sites

first configure the PLC to be a TCP-Server

phpyxz1v4

After that insert to the ladder the element to receive data from the client. The "Received Buffer" should be very long so your incoming message can be fully received with no problem. The "Length received" integer and "Received message" bit will be use to parse your message and get your information.

phpAI9f2t

After receiving your buffer you would like to parse the massage, for that you first need to create the general form of the message your PLC receives. You said you will send a message that looks like "/X300,Y300,Z300/" while the numbers are the only one who change, so this is the general message form and in the places your numbers appears I put a different variable for each number. 

phppAk1Wo
phpOfINnS

 

After that you should put the ladder element for parsing your message, and add your number to the HMI.

phpqhcKgV

You can use a program called Hercules, to simulate TCP connection as a client, this is how I checked that my application works.

phpTNQ061
  • Like 1

Share this post


Link to post
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.

Sign in to follow this  

×
×
  • Create New...