This is a command line (aka console) based tool for redirecting stdin to a serial port. This was written specially for use on Windows 95 where this behaviour is not built in.
The default behaviour for the tool is to take lines of input on stdin and write
them to a serial port defined with the --port
switch. Whilst you
can do this interactively it was always intended that you'd want to do this by
piping the ouput through from a previous command, e.g.
> echo Hello, World! | SerialPort --port 3
By default any data coming through on stdin is silently directed to the serial
port, but if you also want to echo it onto stdout you can specify the
--echo
switch
> echo Hello, World! | SerialPort --port 3 --echo Hello, World!
If you just need to veriy that a serial port exists on a certain port you can
use the --test
switch which just attempts to open the specified
port. If the port was open okay it will write a success message on stdout and
set errorlevel
to 0. However if opening it fails then a failure
message is written to stderr and errorlevel
is set to a non-zero
value.
> SerialPort --port 3 --test Port opened successfully.
To find out what the default settings are for a given serial port you can use
the --defaults
switch. This will write out the basic port
settings.
> SerialPort --port 3 --defaults Baud Rate: 1200 Data Bits: 7 Parity: 2 Stop Bits: 0
Note: This switch essentially gives you the same information you'd get from
using mode comX: /status
.
To change the COM port configuration you can use the --settings
switch. The argument value is a comma-separated list of values for the baud
rate, parity, data bits and stop bits. The parity can be the first letter or
whole word of: none, odd, even, mark or space. The number of data bits can be
between 5 and 8, and the numbr of stop bits is 1, 1.5 or 2.
> SerialPort --port 3 --settings 9600,N,8,1
Note: Some combinations of data bits and stop bits are invalid, e.g. 5 with 2 and 6/7/8 with 1.5.
This application is freeware - you get what you pay for, nothing more, nothing less.
The full source code (C++) is available from my web site listed below.
Using the --version switch will also display my contact details. Please check the web site for updates.
Email: gort@cix.co.uk
Web: www.chrisoldwood.com
Chris Oldwood
24th October 2017