Jump to content

Recommended Posts

Dear, how are you? I have a problem and would appreciate any help.

I use a serial port from Visio 230 to read data from a Vaisala WXT520 weather station. It´s all right but the rain message. I´ll explain.

I receive repeatdly the rain message in the following format:

0R3,Rc=9.9M,Rd=8s,Ri=7.7M,Hc=6.6M,Hd=5s,Hi=4.4M,Rp=9.9M,Hp=2.2M<CR><LF>

But dependent on the intensity of rain, the message changes its long and may be like this

0R3,Rc=19.9M,Rd=18s,Ri=27.7M,Hc=16.6M,Hd=25s,Hi=14.4M,Rp=91.9M,Hp=22.2M<CR><LF>

In resume: only the dividers are constant, but the numbers are not. The message lenght changes because of numbers change.

How can I use Protocol Scan to read this message "all the time", independent on values or string length?

I tried to use 8 Variables at the configuration protocol to this message, but it not worked.

Some doubts:

- What configurations may I do on message properties? I tried to use Numeric, Decimal ASCII with no fixed length, with No Prefix. It should be working?

- When I use only one variable to transfer all the message to, it worked, but it´s very difficult solve the values when the positions are not fixed.

Link to comment
Share on other sites

  • MVP 2014

There are a few of options I have used.

1. Check the features of the Vaisala instrument - maybe you can change the numeric format to have "leading zeroes". That will make the numeric fields always have a constant length.

2. Determine the number of different possible messages based on the different length numeric variables that can be sent. If there are not "too many" different messages then create a protocol scan message for each different option. When the input message is received the PLC will match it to the scan message that fits.

3. If there are too many variations to use option 2, then the only other option is to use the "stream" variable type to catch the string as a stream and decode it using ladder programming. This is by far the more complex option, so I would look very closely at whether you can solve it with option 2 above.

Link to comment
Share on other sites

  • 1 month later...

So, just using protocol scan FB, It's not possible to get numeric data with different lengths even there's control char or any other characters as a separation between values ?

I have a similar issue, 5 values to get, all numeric, all with different lengths, so, there's so many combinations.

Decimal ASCII no fixed length confuses me.

Link to comment
Share on other sites

  • 1 year later...
  • MVP 2023

You're going to have to read the whole string and parse it in logic by searching for the commas and breaking it into pieces. Then you can use the ASCII->NUM functions to get your numbers out.

I just went through this with a comma separated barcode that had variable fields like yours. It wasn't too bad once I figured out what I had to do. Post your code and maybe we can help.

Joe T.

Link to comment
Share on other sites

  • 6 months later...

Via Termite (http://www.compuphase.com/software_termite.htm), I'm getting the following string:

 

[02]   402.2LG 

 

There is a space (aka "<SP>") on the end of that string for the "status" field.  

 

The weight is 402.2.  I need to extract this weight from the string and store it with my V130.

 

The "L" is for "pounds" and the "G" is for "gross."  I'm assuming the "[02]" indicates the <STX> control character.

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