DASYLab

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get several values at one time from a ASCII string which is received via RS232

Hei,
 
I have a Sensor that gives the follwing reply string: $WI,HT=15,00,+21*3F\r\n
Within this reply string 15 is a setpoint, 00 a current value and +21 the sensor´s internal temperature.
Is there a way to teach DASYLab to get all these values from just one reply string and put them in three diffrent data channels?
 
Many thanks for you answers.
(Yes, I tried the search first, really 🙂  )
 
Malte
0 Kudos
Message 1 of 6
(8,801 Views)
$WI,HT=15,00,+21*3F\r\n

Configure the module with one data request command in channel 0. Add two channels, so that the module has 3, and clear the Data Request Command field for Channel 1 and 2.

Channel 0 Data Format - search for the start string and then parse the value after it, then skip the comma.

"$WI,HT=" 2a 1x

Channel 1 Data Format, parse the value and skip the comma

2a 1x

Channel 2 Data Format, parse the value and skip to the end

3a \r\n


Let me know if it works. If it doesn't, then post a screen shot of the RS322 monitor window in both ASCII and Hex, so I can see where it's going wrong.



Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.
0 Kudos
Message 2 of 6
(8,800 Views)

Hei cj,

thanks a lot, it´s working prefectly. ->Thread closed

Some background infos to the sensors (if you´re intrested in): The sensor are ultrasonic wind measure sensor and used by Vestas on wind turbines. 

0 Kudos
Message 3 of 6
(8,793 Views)

I have a RS232 string which goes something like this:

 

<STX>,0 123456000000<CR>

I basically want the part which goes 123456, so in DasyLAB's serial input, for data format, I have:

4x a \r

This picks up the 123456, but also the six zeros which I don't want.

 

I've tried using "bbbbbb" instead of "a", but that doesn't seem to work.

Using "6a" instead of "a" also doesn't work, and DasyLab doesn't like it if I put "4x 6a 6x\r"...Any ideas?

 

Mark

0 Kudos
Message 4 of 6
(8,570 Views)
I'd be tempted to anchor on the beginning of the line with a search string,

For example,

"\x02\x2c" 2x 6a


You won't need to worry about the characters after the 6a, because it will start looking for the <STX>, again, and line up at the beginning.

Hope this helps.
Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.
0 Kudos
Message 5 of 6
(8,548 Views)

Magic, thanks for your help again!  I found something similar as well and anchored it to the ",0 " sequence.

Thanks,

 

Mark

0 Kudos
Message 6 of 6
(8,546 Views)