Termite: a simple RS232 terminal
Termite is an easy to use and easy to configure RS232 terminal. It uses an interface similar to that of "messenger" or "chat" programs, with a large window that contains all received data and an edit line for typing in strings to transmit. Highlights of the utility are the ease of installation (possibly with pre-configured settings) using a heuristic search for the appropriate COM port and, as was mentioned, its user-friendliness.
Other features are:
- log all sent and received data to a file
- plug-in interface for pre-processing or alternative views of the data
- a history for commands that you typed
- resizable main window, with a "keep window on top" option
- support for COM ports above 10 (with thanks to David Snir)
- ability to run with pre-configured settings from a read-only medium (no installation is necessary)
Downloads & license
- Termite version 1.8 (43 kiB)
- Termite RS232 terminal in a ZIP archive. Just unzip and run; Termite writes nothing in the registry, no installation or uninstallation is required.
- "Time stamp" filter, including source code (28 kiB)
- For those who want to write their custom plug-in filters, this ZIP file contains a example filter (for time-stamping received data), with commented source code.
- "Hexadecimal View" filter, including source code (20 kiB)
- Another example for a plug-in filter, which shows the received data as a hex dump instead of as plain text. This ZIP file contains a compiled filter as well as with commented source code.
Termite 1.8 is copyrighted software that is free for personal and commercial use. You may use it and distribute it without limitations. You may however not remove or conceal the copyright. There are no guarantees or warranties whatsoever; use it at your own risk.
The example plug-in filters are distributed under the zlib/libpng (open source) license.
Usage
Termite focuses on text data, and specifically text that is sent and received as strings terminated with "new-line" characters. It has no provisions for transferring files or any kind of binary data. (That said, you may write a "plug-in" filter to pre-process or extract binary data from the received data stream).
The interface of the Termite program has one large (initially empty) text area, which is called the "reception view". Above it is a set of buttons in a "button bar" and below it is a "transmit" line into which you can type a line of text. The utility automatically opens the RS232 port for which it was set up. It shows the current configuration at the left in the button bar. If these are not correct, you can use the button Settings to choose a different port or configuration. The Settings dialog also allows you to enable/disable "local echo" and/or to append a line termination to every string that you send.
Received bytes with values below ASCII 32 (the space character) are displayed as two hex characters between square brackets. So[08]stands for the "backspace" character and[1B]is the Escape key. There is an exception for the tab, carriage return and line feed characters (ASCII 9, 13 and 10 respectively); these cause spacing (tab) or a line break.
If you wish to send a non-ANSI/ASCII character, you must use this same syntax: put the hexadecimal code of the character between square brackets. The alphabetic characters in the hexadecimal code must be in upper case: that is, "[1A]" is valid, but "[1a]" is not. Sending bytes as hexadecimal codes must be explicitly enabled, see the section "Configuration".
After connecting a serial cable between the PC and the remote device (or remote PC, in which case you must use a null-modem cable) and configuring the port, you can send data by typing text in the transmit line and pressing the "Enter" key. Any data that the remote device sends, will appear in the reception view. Optionally, the text that you transmit is copied to the reception view (the option is called "local echo", you will find in in the dialog under the Settings button). To distinguish the received data from the echoed data, the echoed text is coloured blue, whereas the received data is green.
The remaining functionality is straightforward: the Clear button clears the reception view, the About button gives copyright information and the Close button terminates the utility.
One "hidden" feature is the ability to disconnect the RS232 port, without terminating the utility. You can close an RS232 connection with a click in the status field in the upper left corner of the window (left of the button bar). Another click on that line re-opens the connection with the current settings. You can use this to "free" the port temporarily for another application.
Configuration
Termite stores the configuration in an INI file (see the next section for the location of the INI file). This way, Termite remembers its settings between sessions.
When distributing Termite, you may wish to include an INI file with presets. You can run Termite directly off a CD-ROM, but the utility will not be able to store its configuration in the INI file if the INI file resides on a read-only medium. A typical INI file is below.
[Settings] Port=1 Baud=57600 DataBits=8 StopBits=1 Parity=0 Handshake=0 [Options] LocalEcho=1 AppendLine=2 Topmost=0 Monospaced=0 AllowHexEntry=1
Most of these settings can be chosen from the "Settings" dialog. This means
that to get an appropriate INI file, you can launch Termite, adjust the settings,
and voilà: you have your pre-configured INI file. The two exceptions are
the keywords Caption and AllowHexEntry in the
[Options] topic; you have to edit the INI file directly to change
these settings. The Caption item allows you to change the title bar
of the main Termite window. Below the topic [Options], add the
item Caption and set it to the string that you wish to have displayed.
The AllowHexEntry item enables the interpretation of hexadecimal
syntax in transmitted text.
INI file location
Termite accesses the INI file from one of two directories, depending on the start-up situation.
- Termite first tries to locate a file called "Termite.ini" in the application directory (i.e. the directory that the Termite ".EXE" file resides in). If it can open (or create) "Termite.ini" in the application directory for read/write access, it uses that file.
-
If either the application directory does not permit read/write access (e.g.
Termite is launched directly from a read-only medium), or the Termite.ini file
is marked "read-only", Termite creates a directory under the "Application Data"
folder of the current user's "Local Settings". This new directory is called
"Termite", and the INI file is stored there.
The first time Termite uses the sub-folder below the current user's Local Settings, it also copies the "Termite.ini" file from Termite's application directory (if it exists). This allows one to store pre-configured INI file on a CD-ROM disk and still allow the user to change the configuration.
RS232 port scan
Most RS232 settings for a device can be chosen by the developer (the Baud rate and
the number of data and stop bits are usually determined by the other device). One
setting that the developer cannot foresee, however, is what COM port the
user will attach it to. For this reason, Termite contains a simple "port scanning"
protocol that you can activate by setting the "Port=0" below the
"[Settings]" section. Port scanning chooses the first port for which
the two following conditions hold:
- the port is not already open (in use);
-
after setting the
DTRline, the remote device pullsDSRup.
Port scanning cannot be selected from the Settings dialog, you have to edit the INI file to activate it.
The tests for port scanning are primitive. They do not check what device or program is hooked at the other end. The only thing that you know after a port scan is that something is connected to the port and that no other program is currently using that particular port.
In the old days, it had become common practice to connect the DTR
and DSR pins in the connectors of the cable (sometimes even at
both ends). This is bad practice, because with such cables you cannot even
diagnose cable connection problems. Yet, such cables still exist, and the port
scan may be fooled by it.
The DRT/DSR handshake usually works with USB-to-RS232 converter cables too. Since serial ports are slowly being "fased out" on PCs (and especially on notebooks), these cables are regularly used.
Filters (plug-ins)
Plug-in filters allow you to extend Termite in several ways:
- Append or insert text or data to what is received (for example, the "timestamp" sample filter inserts the relative time of reception to every packet of data that Termite receives).
- Remove received data from Termite's queue (before Termite processes it), for example to automatically dump it to a file or to process it separately.
- Create windows with different views of the received data. In combination with the ability to remove data from Termite's queue, this allows you to filter out different kinds of data from a complex stream, and display each kind in its own way.
On start-up, Termite collects all plug-in filters that are in the same directory as the Termite application itself. Termite also loads all filters, unless those filters that have been "unchecked". When Termite finds a new filter in its base directory, it automatically enables it. Installing a filter is therefore a mere matter of copying the file to the correct location and restarting Termite.
A filter can be enabled or disabled through the Settings dialog (see above). When removing the checkmark in front of a filter name, the filter is disabled. Optionally, filters may have their own configuration options. To access the configuration dialog of the filter, double-click on the filter name (you must double-click on the name, not on the "check box"). Although the filter may decide on its own where to save its configuration settings, a filter commonly uses the same INI file as Termite to save its configuration (Termite passes the path to this INI file to the filter when it loads the filter).
Technically, a filter is a DLL with a few special functions (of which only one is mandatory). The filename extension must be ".flt" instead of ".dll" for a filter. In the Settings dialog, Termite uses the filename minus the ".flt" extension for the filter name. See the sample filter "timestamp", which comes with C source code, for details on writing filters.
Alternatives
I made Termite because I needed a utility for monitoring RS232 data that was very easy to set up and to configure. Ideally, it should run "out of the box". The last point means that it should be easy to add a pre-configured utility to a product's CD-ROM. I also wanted the utility to be runable directly from the CD-ROM --requiring no installation.
In case Termite is not what you are looking for, some alternatives are:
- The HyperTerminal applet that comes with Microsoft Windows.
- MCS Electronics provides the free "simpleterm" utility amongst its downloads. (Choose "Downloads", then "BASCOM". Then select the "MCS Simple Terminal" from the list.)
- YAT, a freeware serial terminal by Dieter Fauth is listen on the site of Lakeview Research.
- "Termie", an open-source clone of Termite.
- "Terminal" by Br@y++, a free terminal that supports text and hexadecimal display, macros and more. It used to be available at "http://bray.velenje.cx/avr/terminal", but this now appears to be a dead link. The software can still be obtained from the site http://www.smileymicros.com/; look it up in the "Downloads section" in the left column.
Termite was rated as "good" (5 points out of 6) by NONAGS.