Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 01 Nov 1997 15:06:01 +1030
From:      Mike Smith <mike@smith.net.au>
To:        "User Rdkeys Robert D. Keys" <rdkeys@seedlab1.cropsci.ncsu.edu>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Looking for ways to do serial datalogging on FreeBSD 
Message-ID:  <199711010436.PAA00937@word.smith.net.au>
In-Reply-To: Your message of "Fri, 31 Oct 1997 14:14:12 CDT." <199710311914.OAA07431@seedlab1.cropsci.ncsu.edu> 

next in thread | previous in thread | raw e-mail | index | archive | help
> If I wanted to use a serial port as a datalogging input port on FreeBSD,
> from, for example a small outboard box emitting lines of data at 300 baud
> continuously, what might be good ways to do that? 

What format is the data in?

> Ideally, I would like to have a script or a small program running that
> would poll the system clock, poll the port for a line of data at hourly
> intervals, write that line to a logfile, then sit until the next hour,
> and repeat, over the course of several weeks or months.

You would use a cron job for this; it takes care of the scheduling for 
you.  Then, assuming you've configured the port appropriately in
/etc/rc.serial, something like this:

#!/bin/sh
#
# Read a line of data from the logger, write (stamped) to the logfile
#
read line </dev/cuaa1
echo "`date`: $line" >/wherever/logfile

as the script called by cron would be all that you required.

> In another direction, could one of the generic data acquisition boards
> be used to do this, instead.  I have heard that that is not always
> easy to do on a unix box.

I think this would be pretty gross overkill, unless you were aiming to 
replace the stripchart recorder.  Talking to low-speed AD hardware is 
easy stuff.

> Any pointers, resource-persons, etc., are appreciated.  I am sure lots
> of folks have done this type of thing before, right?

Yup.  8)

mike





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199711010436.PAA00937>