Jump to content

Parse Message function


Recommended Posts

Hello everyone,

I'm currently communicating with a device using RS232. I'm using the build message function to convert a message from message composer to a buffer. Then I transmit the message using the COM Tx function. I then receive a certain amount data packets and use the COM Rx to convert these into a buffer.

I programmed my own function to convert the values of this Rx buffer into a proper response but it is very inefficient because I manually check each index of the buffer for its value and convert it to the corresponding numeric value. I think the Parse Message function is build to do this job for you, however, I can't seem to figure out how to use it to convert a buffer into a message.

Can anyone explain the usage of the Parse Message function?

Thanks in regards!

Link to comment
Share on other sites

1. You have to pass to Parce function full message.

In case you youse RS232 ot low speed, PLC will read fragments of full message at each scan.

To read a full message, you have to check "Last Bytes waiting in Buffer" for your RS232 to be a string termination character,

And only then read buffer.

After this you can parce buffer content.

image.png

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