Problems logging Flowmeter


Recommended Posts

Has anyone had luck logging from a device that responds in multiple lines? I can't seem to be able to parse the response. An example of my protocol is below:

private string dataout = "DAFxx0001" + chr(13)
private string datain
if (!LockPort())
   ErrorMessage("Unable to lock port")
   return(NULL)
endif
try
   Purge()
   Write(dataout)
   DataIn = ReadUntil(13)
   if (IsEmpty(DataIn))
	 ErrorMessage("Device Timeout")
	 UnlockPort()
	 return(NULL)
   endif
   UnlockPort()
   delay(0.15)
   return (StrToDouble(Mid(Datain,0,5)))
catch()
   UnlockPort()
endcatch
return(NULL)

Here is the response from the instrument if I don't have the device config com monitor start a new line on CR/LF:

Tx (23:21:31.937): DAFxx000113

Rx (23:21:31.952): OK131068.851310

If I let it start a new line this is what I see:

Tx (23:21:03.905): DAFxx000113

Rx (23:21:03.921): OK1310

68.851310

So far I am only getting NaNs. The data I need to parse is 68.85.

Thanks for any ideas!!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.