Parsing serial strings, Introduction, Examples – Measurement Computing DBK70 User Manual
Page 64: Dasylab, Logview

5-34
919092
PidPRO & PidPRO+
Parsing Serial Strings
Introduction
When the DBK70 captures a data value for an assigned analog output or virtual channel, it automatically
reports the value, as an ASCII string, on its RS-232 serial port. Each captured channel value is reported as
one line, terminated with a carriage return
The format of the string is as follows, where ch# is the channel number of the DBK70 and value is the
integer value of the parameter in user units.
NC1 ch#,100,value
For example, if RPM is assigned to channel 12 and it’s newly captured value is 1,593 RPM, the string
reported on the serial port will be:
NC1 12,100,1593
A value string is reported on the serial port only when a new network message satisfying a channel’s filter
settings has been captured. If no such messages are detected, no values are reported on the serial port.
The DBK70’s serial port settings are fixed. Baud rate: 115200. No parity. 8 data bits. 1 stop bit.
Examples
The following examples are designed to parse a DBK70 data string to extract the value of channel 5.
C++
if(sscanf(dbk70String,"NC1 5 100,%d",¶meter) > 0)
{
printf(%s, parameter);
}
VB
‘dbk70String is the string from the DBK70. DataString is the extracted data
‘value. If the header is not found, no value will be assigned to DataString.
If InStr(1, dbk70String, “NC1 5,100,”) then
DataString = mid$(dbk70String, InStr(1, dbk70String, “100,”) + 4, 10)
Debug.Print DataString
End if
DASYLab
Place an RS-232 input module on your worksheet then double click the module. Assign a formatting string to the
desired channel as shown.
Assigning a Data Format String in DASYLab