Matthewb Homepage Computer Efficiency Section Desktop Computer System Selection Guide Laptop Computer System Selection Guide Netbook Computer System Selection Guide Netbook PC energy savings

Serial Loopback Test - Simple Serial Interfacing of a switch input

Quickly test a serial port is operational by transmitting and receiving test text.
Place a switch between the transmit and receive line and create a simple serial interfacing input.

Result 1 shows the last test start time, data transfer result and finish time.
Result 2 show a log of all tests made with start time, data transfer result and finish time.

Uses for a simple serial interface of a switch

  • Allow a computer to monitor alarm contacts
  • Allow a computer to monitor a relay or contactor contacts
  • Have a switch interface into a computer to start other processes
  • Test a serial port and serial loopback cabling

Serial Loopback Wiring

Serial Port Loopback Wiring Serial Port Interfacing cabling

Pin 2 is receive and pin3 is transmit.

A D9 to RJ45 adapter can be useful to bring out pins 2 and 3 away from the computer using a Category 5 cable with RJ45 connectors.

Serial Loopback Test Software

The software is written for a Windows PC with .NET framework 2. This will be present on XP, Vista and Windows 7 computers. There are 2 files to choose from relative to which serial port is to be used.

  1. SerialLoopbackTest.exe is used for Serial Port 1 (COM1)
  2. SerialLoopbackTest2.exe is used for Serial Port 2 (COM2)

Save the files into any directory. When run they will create 2 text files in the same directory.
The serial port loopback test process takes less than 1 second to complete.

  1. SerialLoopbackCheck.txt - This is a text file showing the last serial loopback result with start and finish times.
  2. SerialLog.txt - This is a text file showing all results of serial loopback tests with start and finish times.

Serial Loopback Test Software


Serial Loopback Check result sample

Start,8/16/2010 11:10:58 AM
SerialLoopbackTestSuccessful
Finish, 8/16/2010 11:10:59 AM

Serial Log result sample

Start,8/15/2010 12:45:13 AM,SerialLoopbackTestSuccessful,Finish, 8/15/2010 12:45:13 AM
Start,8/15/2010 12:45:50 AM,SerialLookbackTestFailed,Finish, 8/15/2010 12:45:50 AM
Start,8/15/2010 12:46:11 AM,SerialLoopbackTestSuccessful,Finish, 8/15/2010 12:46:11 AM

Facebook Linked In Delicious Reddit Tweet


Matthewb Homepage Computer Efficiency Section Desktop Computer System Selection Guide Laptop Computer System Selection Guide Netbook Computer System Selection Guide Netbook PC energy savings