Delicious Bookmark this on Delicious    StumbleUpon.comRecommend at StumbleUpon

Using a PC's serial port

This is your entry point to a variety of material about using the serial port of a Windows PC. Some of the information here, for instance the pin assignments, will even be useful to Linux users. There's a table of contents in a moment.

While some things here can be found elsewhere, it include this link to my essay on writing to the serial port. Once you have done that, there's also my tutorial on a program which reads from and writes to a device using the serial port. There's more about these in the Software section of this page. While they are most immediately useful to a Delphi programmer, there is little "Delphi cleverness" in them... the Delphi just "wraps" some Windows API calls, so the tutorials should be useful, whatever language you like.

What follows started as a Hodge-Podge of things I "harvested" from the internet back when I was looking for an answer to accessing the serial port from Windows 95 programs written by me. Over the years, some USB, LAN and TCP/IP stuff has crept in. If any of those are your interest, use your browser's "Find on this Page" tool to search for "USB".

Some rough edges have been worn smooth over the years, but is still not typical of my other web-pages. A detail: References to "me" in the following do not always refer to the editor of this page.

I have a much more polished page with information to help you use a parallel port.... My Parallel Port FAQ Answers. Also a page specifically about the issues of connecting big computers to microprocessors like the Arduino, etc. (Or microprocessors to each other.)

PLEASE NOTE: You CAN damage your computer if you make ill-advised connections to it. Any use you make of anything you find here must be AT YOUR OWN RISK

I've also published information and an offer about a small, hobbyist friendly circuit with relays and opto-isolators, which may be of interest. It is for protecting your PC if you connect things via the parallel port.

Don't let the warning above worry you too much... I want to stress that there is a lot of fun to be had with electronics projects. Find yourself an 'antique' PC. If you can't rescue one from a dusty corner, you can buy one for almost nothing. You can use the same monitor as you use on your main machine. If you wreck the antique, it hasn't cost you much! (I got one, with monitor, off a sidewalk once!)

Table of contents, Sheepdog's Serial Port Page:


Before we get to the serial port stuff, two ads from our sponsors...

1) If you are going to use this page, you are probably not a computing novice. Ever set up a web server? It isn't hard! If you have an always- on broadband connection, FarWatch may be of interest. I have written pages for you explaining how to use an old Win98 box (or better) to give yourself a way to monitor the premises the old Win98 box is at from anywhere on the internet. Nothing to buy! And if you connect something to that PC via it's serial port, you can "see" the data from the serial port from afar, too.

2) If you would be willing to help bring this information about the serial port to a wider readership, please check out my plea for translators?


Much of this page is about the software aspects of talking via a serial port... but there are also hardware issues to master.

Not least, if it is relevant to what you are doing, you need to know which pins carry which serial port data signals! What do you connect where? And what about cables? Mundane though those "details" are.

There are also other hardware issues to master. If you are coming here from one of the several great hobbyist friendly microprocessors out there, e.g. the Arduino, I hope you will find the following useful.

You probably know that a stream of serial data is, conceptually, a string of ones and zeros. In happy innocence, you may think that "zero" is represented by zero volts, and "one" is something reasonably close to 5 volts. And the can be shown that way. But they aren't always shown that way. The next few sentences may give you rising annoyance, but hang in there... it has a happy ending!

Once upon a time, serial ports from PCs, i.e. the ones referred to as COM1, COM2, etc, used about 12v and negative 12v to show "zero" and "one"... or was it the other way around? (I always check those "which way around is it?" questions each time I develop a new project. I'm pretty sure it was the "illogical" way around I've stated.) There were reasons for these annoying, unhelpful voltage conventions, concerned with giving you reliable links. These voltages were part of what it meant when you said "RS-232", a name for the commonly used serial communications protocol. Wikipedia has more on the subject. ("V.24" is a similar protocol.)

Quite a while ago, most computer's serial ports were changed to use lower voltages. (RS-232 merely mandated "below -3v and above +3" for the two states.) Things were done to let you continue to attach the older equipment, but gradually everyone shifted gear to the lower voltages.

Now we get to the happy ending. There are simple chips, if you want to do things the hard way, and simple small circuits if you want to go the "luxury" route, to translate between the RS-232 requirements and the zero volts/ 5v environment that you are probably working in if you are using a microprocessor. Note that we are not talking just about the change from 12 to 5... relatively trivial, but from a system with negative voltages... potentially very harmful, to the wrong circuit... to a system with no negative voltages. I've explained all this in greater detail, and presented solutions for you, at my page on RS-232 / TTL converters.

A quick diversion for neophytes: Beware "RX" and "TX". They stand for "transmit data" and "receive data".... but... are you looking at this from the PC's point of view, or from the point of view of the attached device? The PC transmits to the attached device's receive line. So is the blue wire the TX or the RX wire? This, like the voltage levels mentioned earlier, is one of those things I re-check every time. In general, you have to be careful when not sure if something is an input or an output. In this instance, you will often times get away with shorting an output to ground, because the RS-232 spec says the equipment must survive such a mistake. But don't rely on every part of your "RS-232" circuits being fully compliant!

Back to How We Do Serial Comms, the hardware: And it gets better! Although operating systems still have support for serial communications channels, the hardware is increasingly scarce on the PCs being sold today. One solution is a virtual serial port carried across a USB device. The hardware half of you sees a USB device, but the software side of you only has to deal with the virtual serial port created by the USB hardware. Again, Wulfden to the rescue with their "BUB" USB serial port. (Yes, that's the same page the PA4B is on.)

A left over detail: Earlier I mentioned "TTL" in passing. Even after you have converted the 12v/ negative 12v levels on the PCs serial port to zero volts/ 5v (or is it the other way around?), there remains a problem. How "strong" do they have to be? In other words, how much current can run in, or out, of the wire before the 5v droops or the zero volts rises? If you say that a circuit is a "TTL" circuit, you are making certain promises about the current levels it will demand or supply. This isn't something you need to lose a lot of sleep over if you are just using a MAX232 based circuit to connect your PC's serial port (be it "real", or virtual over USB) to a microprocessor, e.g. an Arduino. Just don't think that you can, for instance, connect a serial port output to a bank of 50 LEDs to get a simple high frequency light show! (As ever, Wikipedia can tell you more... which you probably don't need. I just didn't want you worrying about the TTL stuff that you will see when you read about the MAX232.)

Return to page's Table of Contents


I have, after several serious attempts sprinkled across MANY years of trying, finally sussed out the underlying routines for a Hyperterminal clone. While they are most immediately useful to a Delphi programmer, there is little "Delphi cleverness" in them... the Delphi just "wraps" some Windows API calls, so the tutorials should be useful, whatever language you like.

The best place to start is my tutorial on writing to the serial port. Once you've mastered what is in that, there's also my tutorial on a program which reads from and writes to a device using the serial port. Both pages include links to downloads for the sourcecode and for compiled .exes.

In the second, you will be shown the core routines for a "Hyperterminal clone". Hyperterminal was a simple serial comms package for Windows which allowed you to send messages to and receive answers from devices connected to a Windows computer's COM1 (or 2,3,4..) port, i.e. the serial port. The port is sometimes referred to as an RS-232 port, for the protocol used. Hyperterminal is being phased out.

Any serial project, but definition, requires two pieces of silicon intelligence, even if it is just a printer at one end of the cable and a PC at the other. When you are developing a project, you can only do so much at once. For those times (and those finished projects) when you need a simple, made-for-you-by-others serial terminal program, I am in the early stages of becoming a fan of PuTTy. It is free. It works with Windows and under Linux. It is modular and un-bloated. If you just want a simple terminal, you only need to download the file called putty.exe... and you will have one. That is not a set up program. It is the serial terminal program. Doesn't get much simpler than that! If only everything were so simple.

More on software.... until you reach the page's USB remarksthe material below is somewhat dated. It is scraps of information collected along my journey to the happy state I finally achieved in April 2010, which is explained in the paragraphs just above this one. It does include some links to information about connecting to telephone equipment which aren't found elsewhere in this page.

Return to page's Table of Contents

One of the best "answers" to "how can I add serial comms to my program??" I found was at....
Robert Clemenzi's helpful page

The following is taken from there, with alterations. I think the author was working with Delphi 5; Other sources suggested that a similar approach will work with Delphi 2. For Delphi 1, you'd take a different approach.

Subsequently, a Google search on "commtimeouts delphi" turned up Peter Johnson's useful page. He has written a number of articles, components and applications. Search Google for "peter johnson" delphi, and you'll find all sorts of good things. Among other things, his page shows how to programmatically set baud rate, etc, too.

Writing a Port

The following code from Borland's FAQ 16400 shows how to write to the comm port as a file. The code in the FAQ also verifies a valid handle before writing to it. Warning: There may be an error in the FAQ - it may be that NumberWritten must be dword not LongInt
var NumberWritten:dword;
     PhoneNumber, CommPort:string;
- - - -
PhoneNumber := 'ATDT 1-555-555-1212' + #13 + #10;
CommPort := 'COM2';
hCommFile := CreateFile(PChar(CommPort),
From the same source.....

Reading a Port

Well, reading the port is almost trivial ... if you know the trick. You must configure the TimeOutBuffer. I don't know what good values should be, so I used 300.
//hCommFile : THandle;   // Global variable set elsewhere
  GetMem(TimeoutBuffer, sizeof(COMMTIMEOUTS));
  GetCommTimeouts (hCommFile, TimeoutBuffer^);
  TimeoutBuffer.ReadIntervalTimeout        := 300;
  TimeoutBuffer.ReadTotalTimeoutMultiplier := 300;
  TimeoutBuffer.ReadTotalTimeoutConstant   := 300;
  SetCommTimeouts (hCommFile, TimeoutBuffer^);

  FreeMem(TimeoutBuffer, sizeof(COMMTIMEOUTS));
Having done that, ReadFile waits until I scan a barcode. Eventually, I will use ReadFileEx because it will call a routine when a barcode is scanned. Once the port is open and configured, here are 2 routines that will read the port. For test purposes, each was connected to its own button. Uh, both routines work when run from the IDE ... the second refuses to work if you double click on the exe file. I have no idea why.
procedure TForm1.Read_ComPort_UIButtonClick(Sender:TObject);
 InputBuffer : string;
 NumberOfBytesRead : dword;
 Buffer : array[0..255] of char;
 i: Integer;

  if hCommFile=INVALID_HANDLE_VALUE then exit;

  for i := 0 to 255 do    // This is just for test
       Buffer[I] := #42;  // It demonstrates why InputBuffer
                                 // is built inside a "for" loop

  if ReadFile(hCommFile, Buffer, sizeof(Buffer),
              NumberOfBytesRead, nil) = false then
     ShowMessage('Unable to read from comport');
  InputBuffer := '';
  for i := 0 to NumberOfBytesRead - 1 do
      InputBuffer := InputBuffer + Buffer[i];

  Test_UIEdit.Text := InputBuffer;
This next routine works from the IDE, but not if you run the app by double clicking the exe file.
procedure TForm1.ReadToString_UIButtonClick(Sender:TObject);
 InputBuffer : string;
 NumberOfBytesRead : dword;
 MaxBytesToRead : dword;
  if hCommFile=INVALID_HANDLE_VALUE then  exit;

  InputBuffer := '11111111111111'; // the string must be longer than
                                            // the number of bytes you expect to read
  InputBuffer :='';      // This fails, the string must have a length

  MaxBytesToRead := 14;  // could use sizeof(InputBuffer) instead

  if ReadFile(hCommFile, PChar(InputBuffer)^,
              NumberOfBytesRead, nil) = false then
      ShowMessage('Unable to read from comport');
  InputBuffer := copy(InputBuffer, 1,
  Test_UIEdit.Text := InputBuffer;
When CreateFile, ReadFile, and WriteFile are used, Delphi does not use MSComm. Instead, it uses the following Kernel32 commands (found using Depends.exe)

SetCommTimeouts, SetCommConfig
GetCommTimeouts, GetCommConfig
If you try to search the Delphi 5 help for ReadFile, there are no hits. This is because ReadFile is a Windows API command ... not a Delphi command. Instead, click on it in your code and press F1.

Additional information on parallel port, serial, USB (Some great pages from Jan Axelson.)

On the Internet, there are several TCommPort type components (see the references below or just search for them).

I have been successful using TCommPort...
http://users.pandora.be/dirk.claessens2/downloads/tcomport.zip ... by Dirk Claessens...
(freeware with full source code).

I strongly suggest using someone else's component rather than trying to build one yourself. Why? Because they have already been tested on numerous systems and various undocumented "features" have been taken into account.

(Here ends the quotes from http://www.cpcug.org/..../Delphi_SerialIO.htm), and here begins a quote from what was once on a Borland site, that subsequently re-directed to http://dn.codegear.com/article/16400 which at 1/2010 was unavailable. It said "article withdrawn... and had comments from people interested in it, but I'm done chasing what was once a good company. Hope you can find that if other sources don't give you what you're looking for!

How can I dial out through the modem under Win32? - by Borland Developer Support Staff

Question and Answer Database

FAQ1400D.txt How can I dial out through the modem under Win32?
Category :Windows API
Platform :All
Product :All 32 bit

How can I dial out through the modem under Win32?

You can use the Windows API function CreateFile() to get a handle to the com port, and use standard file I/O to communicate with the given port.

  hCommFile : THandle;

procedure TForm1.Button1Click(Sender: TObject);
  PhoneNumber : string;
  CommPort : string;
  NumberWritten : LongInt;
  {N.B.: I saw the following in a newsgroup post:
  Warning: There is an error in the FAQ - NumberWritten must be
  dword not LongInt}
  PhoneNumber := 'ATDT 1-555-555-1212' + #13 + #10;
  CommPort := 'COM2';
 {Open the comm port}
  hCommFile := CreateFile(PChar(CommPort),
  if hCommFile=INVALID_HANDLE_VALUE then
    ShowMessage('Unable to open '+ CommPort);

 {Dial the phone}
  if WriteFile(hCommFile,
              nil) = false then begin
    ShowMessage('Unable to write to ' + CommPort);

procedure TForm1.Button2Click(Sender: TObject);
 {Close the port}
Article ID: 16400 Publish Date: July 16, 1998 Last Modified: September 01, 1999

Return to page's Table of Contents


You might find the following of interest: To use the serial port, you can install one or more third party components into your Delphi. I have to admit: This is only the second time I've done it, as I generally don't like to do it. But I've had no regrets. I used Dejan Crnila's TComPort component A program called "Example" which once (and still does, for all I know) came with the component provided most of the "backbone" of my program.

There were once a whole bunch of promising files at Programmers Heaven, including....
CATE - Communication component
A free, Win95 serial comms component. For Delphi. 20k

Another free, probably Win95 serial comms component.
For Delphi. 1k zip.

TSerial for Delphi 2
This is a no-frills serial component that saves you
having to tangle with the Windows Comms
API functions to handle a serial port. Uses overlapped
I/O for full Windows NT
functionality. Only basic serial comms are provided -
no terminals, protocols etc.

The above is another free(?), probably Win95 serial comms
component.  26k zip... 5 star rated by Programmer's Heaven.

When I checked with Groups.google.com, there was praise for
Rick Crowther's TSerial, said to be exactly what someone wanted,
"not free, but at GBP10 last time I bought it, you can hardly grumble."....

That discussion continued.....

TSerial is great, but it's not free and so I searched
the web again and again and found AsyncFree which is free
and offers the same if not better functionality.

I searched for AsyncFree, and came up with....

a list of Good Stuff from AsyncFree's source. For AsyncFree...


Described itself as follows....

Serial communication in Delphi and related components.
The goal is to offer quality and open solution of
serial communication in Delphi including
closely related components e.g. terminal window, TAPI,
etc. My idea is to split the problem
to several parts, create independent components for
each part and thus limit the usage of
extensive and complicated code for simple
applications: Suggested project parts:

Basic serial communication (input and output buffer, line events)
Data and event dispatcher (user timers, input data-driven events...)
Opened for linking to other communication enabling components,
e.g. WinSocket, DCOM,...
Visual components (terminal window,...) compatible
with dispatcher by means of a link (like TDataLink with databases).
Events will be both synchronized with VCL and without this
synchronization. technology enabling remote connection of serial lines
through the network (without the need for cabling from one point
to individual computers). I have something prepared, but the code should be rewritten as it is rather closed and not divided according
to the above description.

Current version: 1.03
Supported Delphi versions: 3,4,5

Download: AsyncFree.ZIP, 105kB, 17.10.1999

Win16 & Win32 DLLs. Version 2.1, . Serial comm library
based on the Windows API. Includes

25 functions plus modem control, XMODEM & YMODEM, and
5 example programs. Requires Delphi compiler.
By MarshallSoft Computing, Inc.

Product homepage: Unknown
Order page: Unknown
Language: Delphi 2
Platform: Windows 95
Release Date: Unknown
File type: Unknown
Size: 68 KBytes
Price/ fee (US$): 0.00$
Number of downloads: 4944


TPort Component Version 1.5 (not rated)
This component will read and write from the computer's
I/O ports.

File name: TPort Component Version 1.5
Product homepage: Unknown
Order page: Unknown
Language: Delphi 2
Platform: Windows 95
Release Date: Unknown
File type: Unknown
Size: 8 KBytes
Price/ fee (US$): 0.00$
Number of downloads: 11056

The following looked like it might be what I wanted.....
SerialNG V2.0.15
Full featured Serial Communication Component for
Delphi 2.0.15 Fully Serial Communication
with Delphi and Windows 95/98/NT/Me/2000. This tool is
a fully redesign of my former Tool for Windows 98/98.
It enables an Application to communicate through an serial port.
It uses only WinAPI and Delphi functions, so no other third
party software is needed. It comes with several Demos
and Source Codes.

File name: SerialNG V2.0.15
Product homepage: Product homepage
Order page: Unknown
Language: Delphi 3-4-5-6-7
Platform: Windows 2000-95-98-ME-NT-XP
Release Date: 11/13/2002
File type: Public Domain
Size: 48 KBytes
Price/ fee (US$): 0.00$
Number of downloads: 2514

Is a simple Communications VC for Borland Delphi 2.0
which demonstrates the Win32 Communications functions and the
new Delphi 'TThread' class. It is implemented using two threads:
one for reading from, and one for writing to a Comm Port.

File name: Comm32
Product homepage: Unknown
Order page: Unknown
Language: Delphi 3 (Yes: That conflicts with description above)
Platform: Windows 95
Release Date: Unknown
File type: Unknown
Size: 13 KBytes
Price/ fee (US$): 0.00$
Number of downloads: 4687

QCCom32 1.4.0
A Delphi 5 component for doing simple serial (RS232)
I/O in Windows 95/98/NT or 2000. Has
built-in dialogs for choosing a port, displaying error
messages, etc... Includes full
source code, and a help file. It should work with
Delphi 3, 4 or 6, but I can't say for sure.

File name: QCCom32 1.4.0
Product homepage: Product homepage
Order page: Unknown
Language: Delphi 5
Platform: Windows 2000-95-98-ME-NT-XP
Release Date: 7/1/2002
File type: Freeware
Size: 14 KBytes
Price/ fee (US$): 0.00$
Number of downloads: 4109

(Also at Programmer's Heaven, I think... Not just serial port stuff, but
telephony support, too......)
KDTele Tools 3.0 (ActiveX/VCL)
KDTele is a collection of controls that provide to
your application advanced telephony
features, such as: -Make and answer phone calls
-Detect tone and pulse digit from the phone
line -Capture Caller ID -Play and record on the phone
line or sound card -Silence detection
when recording -Send and ...
Size: 4865 Kb  Downloads: 2801 Updated: 2002-11-5
Rating: (Not Rated) $77

Other possibly useful links, probably at least checked by me in at least a cursory way... things that looked like they might be worth further investigation.....


http://www.lvr.com/serport.htm Serial Port Central....
Many resources- serial port use within programs and otherwise.


Quotes from newsgroup discussions...

In Visual Basic, use the MSComm control included with the Professional and Enterprise editions. Visual Basic's Learning Edition doesn't include MSComm. But you can use the freeware XMComm ActiveX control... (Once at http://ourworld.compuserve.com/homepages/richard_grier/xmcomm.htm) ...which wraps the MSComm32.ocx. From Richard Grier's Hard & Software.... but link bad 5/07


EasyIO. An Active X control for very basic serial I/O under Windows 95/NT. From Stephen Payne.... Link WAS...http://members.aol.com/easyio/easyio.html (Seems dead 1/2010)

Quotes from EasyIO site...

I/O ActiveX Control

This I/O ActiveX control allows easy reading and
writing to and from both parallel and
serial ports under Windows 95/98 and NT4.0. Use it as
a Win32 communications library.
I/O access under Windows 95/98 and Windows NT4.0 with
an easy, quick to learn interface.

I THINK the following is quotes relating to the EasyIO product.... if not, if you can find where they came from (using Google), I'd welcome the information!

There are three functions for binary data transfers.
1) WriteData(Data, Length); Writes a data buffer of
Length characters.
2) ReadData(Length); Reads binary data and returns it
in a string.
3) BytesRead(); Returns the number of bytes read by
the ReadData() function.

There is a function to check various things....
SerialStatus (Property) R

This reflects the current status of the serial port as
NewText = NewText + "RX Buffer Empty, "
NewText = NewText + "RX Buffer Not Empty, "
End If

Some of the things that can be checked. See web for details not given here.
SERIAL_TXFULL The application tried to transmit a character, but the output buffer was full.
SERIAL_TXEMPTY The transmit buffer is empty.
SERIAL_RXEMPTY The receive buffer is empty.

NumCharsInQue (Property) R

This reflects the number of bytes/ characters in the
input buffer (waiting to be read).


Dim Result as Integer
Dim DataStr as String
Dim NumBytes as Integer

Result = IO1.WriteData("String1" + Chr(00) + "String2"
+ Chr(00) + "String3" + Chr(00) +

Chr(00)) 'Sends 3 null terminated strings to the port,
with the total data being double null terminated.

DataStr = IO1.ReadData(30) 'Reads data from a port.

NumBytes = IO1.BytesRead() 'returns number of bytes

See WriteData, ReadData, and BytesRead in I/O OCX Control Functions


Recommended at groups.google:

"Unless you like digging in the dark or when you don't want to spend too much time on some buggy communication use the (Async?) Asych Pro toolbox of turbopower software. It used to be at http://www.turbopower.com"

(1/2010 update: Sadly, TurboPower closed... but first they kindly released their software into the open source world! There is a sourceforge page for Async Pro! To quote from that: "Async Professional is a comprehensive communications toolkit for Embarcadero Delphi, C++Builder, & ActiveX environments. It provides direct access to serial ports, TAPI, and the Microsoft Speech API. It supports faxing, terminal emulation, VOIP, & more."

From the same source: TurboPower Async Pro CLX: "Async Professional CLX is a comprehensive communications toolkit for Borland Kylix. It provides direct access to serial ports, and supports terminal emulation, file transfer protocols, & more.".

At least at 1/2010 there was still a TurboPower.com page, listing what the former company has given to open source. At 1/2011 I couldn't get in at TurboPower.com

Unfortunately, when I went to the TurboPower site, I found a notice that they had discontinued retail business.... but... to quote from their site....

"TurboPower announces sweeping open source initiative

Colorado Springs: TurboPower Software Company today
announces their immediate withdrawal
from the retail component and developer tools market.
As part of the move, TurboPower
announces its intention to release their award winning
component libraries as open source
to the maximum extent possible.

We've been a big part of the developer community for
nearly 18 years, said TurboPower
President Gary Frerking. Open sourcing our products
seems like an appropriate gesture of
appreciation to the community that supported us so
well over the years. We sincerely hope
these products take on a life of their own and
continue to prosper for many years to come.

TurboPower's component libraries cover a wide spectrum
of development needs including
compression, serial communication, faxing, Internet
communication, scheduling, data entry,
encryption, and XML manipulation. There are nearly
twenty commercial-quality libraries
being considered for release, containing hundreds of
components and thousands of classes
and routines | over one million lines of source code
in all!

The process of preparing the libraries for release to
open source is already underway, and
the current goal is to have the libraries released to
the maximum extent possible by the
end of January (2003?). The resulting open source projects
will be hosted on SourceForge." (end quote from TurboPower page)

However, at 16 Apr 03, I didn't find AsyncPro or TurboPower at SourceForge... :-(


http://www.arcelect.com/rs232.htm has lots of good stuff on low level electronics, cables, connectors of RS-232

http://mc-computing.com/Languages/SerialIO.htm Lots of good links

* * * *========
(Mentioned on a Delphi directory of serial port stuff):


TCommPortDriver. Freeware serial-communications component for Delphi. Includes source code that shows how to use Windows API calls to access serial ports. 16- and 32-bit versions available. From Marco Cocco. It used to be available from the Delphi Download Page., http://sdiclub.tms.ru/files_table.phtml?ipath=ACE, and looked pretty good! Seems to have been used by numerous people. But, of course, I hadn't downloaded it myself, and the link above is dead 1/2010. Anyone know of a source?? TCommPortDriver is a component for Borland Delphi 2 that lets you handle COM ports (com1-com16) and all standard communication settings (baud rate, data bits, stop bits, parity, hardware and software flow control). Supports sending data in binary blocks or text strings. Supports asynchronous and synchronous data RX.

Freeware, 55k


Dirk's TComPort (Link seems out of date 1/2010):


In a newsgroup, I saw: "the TDLPort IO 'wrapper' can be installed as a Delphi component. This allows IO under Win95/98 and (using a different file) Win NT. I know the latter normally blocks attempts to Write to/Read from specific addresses but the DLL (legally) get around the problem. I'm hoping that the Win95/98 version will do the same rather than just re-duplicate inpout32. It comes with a nice manual and is FREE!

Even though there was a lysdexic error in the above, Google found for me this, which leads to....
Name: TDLPortIO 1.3 Date: 12/7/99
Environment: Delphi 3.0, Delphi 4.0, C++ Builder 3.0, C++ Builder 4.0 Download
Type: Freeware with Source Size: 851 Kb
TDLPortIO is a wrapper for the free DriverLINX kernel mode driver (included).
It allows full port IO under Windows 95/98/NT.
Comes with a C++ Builder and Delphi components,
ActiveX control (for Visual BASIC) and DLL version.
Compatible with the shareware package TVicPort.

Return to page's Table of Contents


This isn't really the time or the place to tell you about the following, but until I can write them up properly....

Interfacing to "ports" over your LAN: There are now devices which might be called "digital ports on the LAN". And if you can access something on a LAN, you're not far off being able to access it across the internet, too, if you want to. Turn up your home's heating via the internet as you shut down your PC at work at the end of the day? Why not!! Etc.

One source of interfaces accessible across LANs is WizNet. That link will take you to the product page of their, to adapt their online text...
Webserver based IO control module

Key Features
  - Remote I/O Monitoring and Control with Ethernet
  - 8 Digital Input Ports
  - 8 Digital Output Ports
  - 2 Analog Input Ports (12 bit resolution)
  - 2 Analog Output Ports (12 bit resolution)
  - Supports Application Program
  - Supports WebServer

I found several suppliers (search with Google for "WIZ220IO") selling it for a little under $40 (6/10).

Alternatively... MicroChip, the inventors of the PIC line of microprocessors, have a good track record, and now they have a PIC with most of what you need for USB built into the chip. I haven't played with it personally, but know people who have. It looks like it shares many of the Arduino's virtues. I suspect you need a little more experience or determination to get started with it, and creating your own USB devices will never be trivial, but if you want to give it a try, you should look into the PIC 18F4550. The Sparkfun experimenter's board looks like a fine solution to the hardware issues. ($38 at 2/10)

If you are into making your own electronic devices, you might be interested in the USB modules from www.ftdichip.com's products page.

I wrote the following a while ago... and now (3/10) am not sure what device it describes! I think it is the FT2232H from FTDI, but I'm not sure, and after 15 minutes of struggling around their site, I've given up trying to find what I saw previously, somewhere. If it sounds good to you, do go to FTDI's site.... I think you will be rewarded!

For about $20, you can buy a little unit that plugs into a Win98 or higher machine via USB. On the "outside world" side, it has 8 bi-directional digital input/ outputs, and a few handshake lines. The programming isn't trivial, but there is great material about accessing the device. Illustrations in Delphi are provided. You either install a TComPort component (a freeware one, with Delphi source code is available from Dejan Crnila and then access the 8 bits as if (to Win98) they were on a COM port, OR you use a DLL (supplied royalty free from FTDI). It is not exactly a parallel port via USB, but that's roughly the idea.

If you just want a virtual serial port via USB, FTDI was the source I used to recommend. However, by 3/10, but there had been two developments. a) The FTDI device now comes in two versions, one for 5v, the other for 3.3 volts. b) Wulfden has come out with a similar USB virtual serial port called "BUB", one I like better because it is flexible and cheaper. (You can switch between the two voltages by moving a link.) It is physically a little less robust, but none of this is suitable for the use of 8 year olds, anyway. (BUB, 3/10, assembled & tested, inc P&P: $15) (There is more on serial- port- by- USB in the "Serial port hardware" section, above.)

Misc matters... contact editor, search tool, etc....

For Delphi 2 (and above) programmers: Tutorial: How To Access A Joystick.

Ad from page's editor: Yes.. I do enjoy compiling these things for you... hope they are helpful. However.. this doesn't pay my bills!!! If you find this stuff useful, (and you run an MS-DOS or Windows PC) please visit my freeware and shareware page, Sheepdog Software (tm), download something, and circulate it for me? At least (please) send an 'I liked the parallel port use page, and I'm from (country/ state)' email? (No... I don't do spam) Links on your page to this page would also be appreciated!
Click here to visit editor's freeware, shareware page.

Don't forget to check out the programs for controlling the state of the parallel port at my shareware site. There are two free programs there... one for toggling bits, the other for using the computer as a timer via the parallel port.

   Search this site                 powered by FreeFind
Site Map    What's New    Search

Here is how you can contact this page's editor.
Click here to go up to general page about electronics by editor of this page.
Click here to go up to general page about electronic projects by editor of this page.
Why does this page have a script that loads a tiny graphic? I have my web traffic monitored for me by eXTReMe tracker. They offer a free tracker. If you want to try it, check out eXTReMe's site. The Google panels and the search panel are also script based.

Valid HTML 4.01 Transitional Page tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org

....... P a g e . . . E n d s .....