Jump to content

Recommended Posts

Hi there,

I am having some trouble reading variable length numbers in a "Protocol TCP/IP Scan" block.

We are receiving a message of the form "-9999999999.999 [Counts16Bit]". Messages can be positive or negative and can contain a variable number of digits, so "9.999 [Counts16Bit]" is also a valid message.

I am able to successfully use the scan block with fixed length messages.

If I construct a message like "111 [Counts16Bit]0A" where the numeric variable is "Decimal ASCII: Fixed Length", Vector Length = 1, Length = 3, "No Prefix", I can receive any 3 digit number successfully.

If I change the numeric variable to "Negative Only (-)", I can only receive messages with a "-" sign. I would expect to be able to receive 3 digit messages with or without a "-" sign.

If I construct a message like "1 [Counts16Bit]0A" where the numeric variable is "Decimal ASCII: No Fixed Length", "No Prefix", I do not receive any messages, even ones with a single digit.

Is there something I am missing. I would really appreciate any suggestions.

Share this post


Link to post
Share on other sites

Hello,

When using a non-fixed length variable you can not have any other characters proceeding it, whether it is another variable or fixed text. Since you can not have any proceeding characters you can use a stream variable instead of numeric and set the vector length to the maximum message length. Converting 2 received bytes to one linked element will also conserve memory. You can use a terminating character such as the LF in your example, or a silence duration to signify that the message is complete.

Share this post


Link to post
Share on other sites

Thanks, I didn't realise that there was that limitation on non-fixed length variables.

Would you be able to point me to where this is documented for future reference.

I was unable to find documentation of this limitation after looking through the manuals related to TCP/IP Scan function blocks and messages.

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.


×
×
  • Create New...