Serial data capture


Thread Starter

Thomas S. Snyder

I apologise if this has been asked before. I am looking for a program that reads ASCII data from a COM port and then simply stores to a file. It would be nice if the file name could be changed at midnight.

I am trying to reduce the amount of paper my facility has to store by having a computer read an events logger output (to a serial port printer)by having it available on a PC.

Is there any shareware programs out there? I would like to program my own, but I really need an example to start with.

Thank you,
Do you have access to Visual Basic? I have used the Comm Control in VB 6.0 to do a lot of ascii output. ascii input should not to too different. There is a comm occured event that can trigger a
data read. The main question becomes what sort of data terminator does your logger use. ie: what character denotes an end of string? If you can get this, you should be able to read
sporadically into strings, and parse out the relevant data based on splitting your strings on the proper boundaries.

Are you looking to simply write raw data to a file? Do you need to do anything to it first? How about writing to a database? How do you look at the data after it is stored to a file?

If your viewer app is robust enough, you could skip the whole data terminator thing, and just do a read comm port, write to file endless loop. The only caveat here would be to have some sort of UPS on the system, and a way to trigger a shutdown so that the file gets closed properly, etc.

--Joe Jansen

Curt Wuollet

Hi Tom,

Most terminal emulators will do this. I know kermit and procomm would way back when Microsoft products were still usable (DOS) for work.
Failing that, it requires nothing more than a shell command to do this under Linux and almost any other UNIX. something like:

cat </dev/ttyXX >filename. &

The ampersand puts the process in the background.
Any programming language that lets you open ports and files should take less than a page of code.

I can send you a Linux example if you like. I can't afford MS tools and won't use their OS's so you are on your own there. But, even lowly
quickbasic can do this. Since this sounds like a job for a standalone box, I'd find an old 486 or buy one for 50 bucks and put Linux on it. Then you can have cron handle the switch at midnight with absolute reliability.


Curt Wuollet, Owner
Wide Open Technologies
Hey, great that you work at Hoover. I am a DWP employee. I work at the Adelanto Converter station. A number of the Operators came from the dam.

I have looked at Taltech, WinWedge might do the trick. I was hoping to find a free solution first. Once the concept has been proved and sold to management then a commercial application might be justified.

Thanks for your input.

Helmut Meissner

Hi Tom,

I did programs like this in Turbo Pascal 6.0 under MS-Dos for 386-PCs to collect data from concrete pipe messuring machines.

I used a UART-Unit from the Internet, that makes the Init and the reading from the UART in the PC. It is using a 6000 character buffer that is working in the background driven by the Interrupt of the UART (COMx). In the front program I read the system-Clock, interprete the characters
and write then to a file. I open and close the file for each dataset, so if there is powerfail you will not lose all data of the day. At midnight
I change the the filename to new day "QSYYMMDD.DAT".

I think you can do this in any programming language, I use MS-DOS and Turbo-Pascal because you will find in every company some old PC´s that
are to slow for SCADA or Office-APPs.

If you need more informations you can contact me at:

[email protected]


Helmut Meissner
Schlosser-Pfeiffer GmbH
Aarbergen, Germany

Preston Todd Johnson

You might consider the LabVIEW program from National Instruments. There are several examples of moving data to a file, and reading and writing to and from a serial port. The software is available for many operating systems.

National Instruments also has a product called measure that works inside microsoft excel. Both LabVIEW and Measure have extensive parsing tools,
making it easy to diesct the serial port stream and take the data into columns for example. And yes, you can change the file name at midnight.

Todd Johnson

Christian Grebe


> I am looking for a
> program that reads ASCII data from a COM port and then simply
> stores to a file.

Check out Portmon at A very good programm for monitoring traffic on serial and parallel ports since it can monitor the port even if another programm uses the same port. Maybe overpowered for simple text logging. Monitors _all_ calls to the port subroutines (opening, closing, polling...) so you should filter with *READ* and *WRITE* to get the real data only.

> It would be nice if the file name could be changed
> at midnight.

Sorry, it does not.


Christian Grebe

ITK Dr. Kassen GmbH
Beim Eberacker 3
D-35633 Lahnau
Tel: +49 6441/6 50 05-14
Fax: +49 6441/6 50 05-29

Heinz-Juergen Oertel


there is a nice scripting language that allows you doing this. its called Tcl.
Numerous books and articles are available,
and also source examples
I am sure "your problem is solvable within some our with a page of source.
The software is free, runs on Windows, Macs, LINUX many RTOSes...

If you wish, There is also e extension available to build a GUI, that the Tk ToolKit.

See at our Web page for links to the software.
or the Tcl-"home"

with best regards / mit freundlichen Grüßen

Heinz-Jürgen Oertel

Heinz-Jürgen Oertel
port GmbH phone +49 345 77755-0
Regensburger Str. 7c fax +49 345 77755-20
D-06132 Halle/Saale mailto:[email protected]

Jason Sprayberry

Two products are made to do just what you want. They are both a very reliable means of collecting serial data in depositing it into almost any database or file type. You can also use one of their serial-to-ethernet converters to send the serial data across your network. Good Luck, Jason