Sorry if this shows up twice...
Real-time data aquisition under unix
Hello fellow netters -- I am really hoping some of you can give me some
good tips on how to solve a problem I'm currently working on.
Description of problem:
Our institute has just bought an hp9000/400 to be used for real-time data
aquisition of oceanographic and navigation data on board the university's
research vessel. The oceanographic instrument and navigation system are
hooked up to the hp9000/400 through two serial ports, each transmitting at
9600 baud. The oceanographic instrument has a sampling rate of 33
measurements pr. second, of which we want to store ALL samples, while we
want to sample the nav. data at user specified intervals ranging from about
1 second up to once every 5 to 10 minutes. All this is happening while the
ship is moving, so at the same time we want a real-time plot (profile) of
the oceanographic data either in an X-window or on a hp-plotter (7475a).
Optionally, as a back-up, we would also like to write a line of data either
to a printer and/or to the screen at user specified time intervals.
I have implimented all the above steps -- and it "sort of" works. What I
mean is each step works as prescribed, but that my implimentation is a
simple-minded, typical straight-forward, follow-your-nose method where each
step happens in sequence in one main loop:
read the clock, if its time, get the nav. data -> read the oceanographic
data -> save the data to disk -> if it is time, write out a line to the
printecreen -> plot some data -> read the clock ----> etc
The most important part of this process is to read and store ALL the
oceanographic data, next priority is the nav data, and then if there is
time we can print and plot. Do I risk loosing data by using my implimentation?
Even though I only read the serial ports 1 byte at a time, are they
automatically buffered in some way by the system? Should I use some sort of
signal mechanism to jump to a read and save data routine every time data
comes down the line? Basically -- How do I ensure that I'm getting all the
data, and still be able to do the other stuff?
I am really feeling kind of lost at the moment, and would appreciate any
help at all; either sample code, references to litterature and/or just some
plain good advice. Thanks, in advance!
Geophysical Inst., Oceangraphic Dept.
University of Bergen, Bergen, Norway