Jump to content

TCP/IP string communication


BobH

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

Link to comment
Share on other sites

  • 1 month later...

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