Protocol issues with streamed data

Recommended Posts


Excuse my ignorance, I'm a total beginner with Daqfactory.

I have a device (an Omega HX200 Temperature/RH probe) which streams data over an RS232 connection, I can see the data coming in under monitor and get a sting of data such as this below...


Rx (09:46:46.923): \010

I have set up a new protocol, but think that the script in the user guide (shown below) is telling the "if loop" to stop after the first (13), is this correct?



if (strIn == Chr(13))
private string datain = ReadUntil(13)
Channel.AddValue(strDevice, 0, "Input", 0, StrToDouble(DataIn))


I cannot for the life of me work out how to get this to display as values for individual measurements for RH and Temperature. Please help with an appropriate protocol.

Link to comment
Share on other sites

Looking at the numbers in the comm monitor you have ASCII data, so if you uncheck the box that says "Display all chars as ASCII codes" you will better be able to see what the data looks like, and then how to parse it. 

I also don't recommend creating a user protocol.  Just create the device with a NULL protocol and create a sequence to do the processing.  

If you can post the ASCII form of the data stream I can better tell you how to process it.

Link to comment
Share on other sites

With display all characters as ASCII unchecked I get something like the following...


Rx (09:25:11.004): \010
%RH= 44.86, DPC= 9.11, ATC= 21.35

 All the values listed as RH, DPC and ATC are variables and change with the climatic conditions.

I'm not sure where to start with a sequence for this data!

Link to comment
Share on other sites

OK, so now you can see it is pretty easy to read, and not hard to parse.  Assuming you created a serial device named "myDevice", the script would be something like:

   private string datain = device.myDevice.readUntil(13)
   private string pdata = parse(datain, -1, ",")
   private rh =strToDouble(parse(pdata[0],1,"=")
   private dpc = strToDouble(parse(pdata[1],1,"=")
   private atc = strtodouble(parse(pdata[2],1,"=")

Then you just have to decide what you want to do with those three private variables with your values.  Probably add them to a channel:




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.

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.