LISST-
Tau User’s Manual
Appendix C: Parsing Serial Data String
Page 25
Appendix C: Parsing Serial Data String
Below is pseudo code that shows how the serial data string can be parsed into individual
variables. This is how the LISST-Tau windows program captures and displays real time data
from the LISST-Tau instrument.
// Assumes instrument is connected to a serial com port and is currently sampling in user
mode.
// Read line from the serial port
string
serialString = TauComPort.ReadLine();
// Split serial string using tab as the delimiter
string
[] stringVariables = serialString.split
(‘
\
t’
);
// Load substrings into variables (see Appendix B: Data Output Format
in User’s Manual
)
string name = stringVariables[0];
DateTime
timestamp =
DateTime
.Parse(stringVariables[1]
, ‘
"yyyy-MM-ddTHH:mm:ss"
)
;
float
beamc = stringToFloat(stringVariables[2]);
float
tau = stringToFloat(stringVariables[3]);
int
netRefrence = stringToInt(stringVariables[4]);
int
netSignal = stringToInt(stringVariables[5]);
float
tempRcvr = stringToFloat(stringVariables[6]);
float
supplyVoltage = stringToFloat(stringVariables[7]);
float
firmwareVersion = stringToFloat(stringVariables[8]);
DateTime
calTimestamp =
DateTime
.Parse(stringVariables[9], ‘
"yyyy-MM-ddTHH:mm:ss"
)
;
float
transmissionCal = stringToFloat(stringVariables[10]);
float
tempCal = stringToFloat(stringVariables[11]);