Sunday 17 April 2011

Scripting - Create Your Own Serial Port Data Logger

Although Serial ports have pretty much become extinct in today's world. There still are a few legacy applications that still require the use of them. In this blog entry, I will show you how to log serial port data to a text file without the use of any 3rd party software or using Hyper Terminal in Microsoft Windows.

Start Notepad and create the following script

@echo off
echo type COM1 >> C:\com1.txt

Replace "COM1" with the COM port you wish to monitor, and set whatever file path you want the log to be output to (in this case C:\com1.txt). This script will keep running until you manually stop it by closing it or if you press CTRL+C.

Save the file with a .BAT extension and double click it to start logging! If you really want to get fancy, you can create a scheduled task and have the script run on boot-up if you need to monitor the port 24 hours day.

Written By: Amardeep Juneja