I have connected a CR1000 to a Los Gatos (LG) isotope analyser. I get the data from the LG using its RS232 output and reading it with a control port on the CR1000. I have 2 problems
1. The LG outputs data every 2s and I scan it every 2s. Every 20-30s the logger only gets half of the data string, and the next scan gets the other half. This makes it difficult to split the strings consistantly. Any thoughts on how I can overcome this timing problem?
2. Once I have the string (12/10/08, 11:09:00.00, 12.3, 3.99E-04 ...) I split it into its component parts, but I am still left with strings. Is there a way to convert strings to numerics using CRBasic so I can average the data over time?
Hunty
Are you using SerialInRecord to retrieve the data? I have found this to be the best at "trapping" received RS232 data strings.
To change from string to numeric is simple:
numericval = stringval
Using your example:
string$ = "12/10/08, 11:09:00.00, 12.3, 3.99E-04"
battery = Mid(string$,26,4)
Hope this helps,
IslandMan
Thanks Sc and IslandMan
How could I have missed the numval = stringval, must be getting old!
I was using the SerialIn option but will try the SerialInRecord suggestion. The analyser has been returned for repairs, so I won't be able to try out it out until it returns (hopefully before Xmas).
Cheers
Hunty
Which buffer size you used? And how many strings is it?
I would like to know about this instrument. You used it for liquid water or gas?
The instrument is a Los Gatos water vapor isotope analyser which measures water vapor concentration, d18O and d2H. Piccaro also make a similar analyser. I have heard better things about the Piccaro, but we could only afford the LG machine. Our instrument arrived and the main optical bench had not been tightened so we have had to send it back. While it was here (for 2 weeks) I started on the CR1000 - serial comms part.
The output from the analyser is via an ethernet, a USB or a serial connection. The fastest it scans at is 0.5Hz (every 2 seconds) and as far as I can see the output via the serial port is the same. It produces a single sting, comma delineated, containing the data and time, then 7 data values and 3 values for the internal pressure, cell temperature and ring time. I think followed by a CRLF. Some are in engineering format and some straight numerical.I am not sure how to find out the number of bytes so I set my SerialOpen buffer to 10,000 and the InputString length to 100.
Hunty,
When you get the instrument back, connect it to a PC and use HyperTerminal to capture the data string. If you want, post the capture here and I'll help you with the CR1000 program.
Regards,
IslandMan
Islandman
Thanks for the offer of assistance. We had to send the analyser back for repairs. A new one is not due until Christmas. In the SH, Christmas combines with summer holidays so it might be mid Jan before I get back to you.
Cheers,
Hunty
Hunty,
No worries, I'm not going anywhere soon. It's COLD in the NH right now so no "holidays" planned here.
Cheers,
IslandMan