No serial port on your PC? No problem! To add a
serial port, attach a USB/serial adapter to a USB
port. This article focuses on the PC side of serial port
communications. I’ll show how to use Visual Basic .NET
to access serial ports, including USB virtual serial ports.
Serial Ports and COM Ports
A serial port is a computer interface that transmits bits
one at a time. The interface can have as few as three lines:
one to carry data in each direction plus a ground line.
Many interfaces have up to six additional lines to carry
status and control information.
Unlike some serial interfaces, the standard RS-232
serial interface on PCs doesn’t include a clock line.
Instead, the computers at both ends of the cable each
provide a clock. The computers must agree on a bit rate
for transferring data, and a Start bit synchronizes the
clocks before each transmitted byte.
RS-232 is a hardware interface that transmits 0s and
1s as positive and negative voltages. A typical RS-232
cable can be up to 100 ft long. Interface chips such
as Maxim’s MAX232 converts between 5V logic and
On a PC, serial ports appear as numbered
COM ports that applications can read and write to.
These days, most standard peripherals connect via USB,
and many PCs don’t have built-in serial ports. You
can add an RS-232 port to any recent PC, however,
by attaching a USB/RS-232 adapter module. Your
favorite PC hardware vendor likely has a selection to
For each adapter, Windows creates a USB virtual
COM port that applications can access just like built-in
serial ports. If you don’t want to use an external adapter,
you can perform the conversion inside the device by
adding a USB/serial bridge chip to your design. FTDI’s
FT232R is an example of a bridge chip.
Selecting a Port
Figure 1 shows a Windows form for an application
that uses a serial port to control an LED on a remote
device. (The full Visual Basic project is available from
www.nutsvolts.com and my website, www.Lvr.com.)
Combo boxes enable selecting a COM port and bit
rate. Clicking the ON or OFF button sends a command
to turn an LED on the remote device on or off. A label
displays a message about the state of the LED as
reported by the device.
This example can serve as a framework for
developing applications that monitor and control other
Microsoft’s Visual Basic .NET, including the free
Express edition, includes a SerialPort class for accessing
COM ports. Other .NET languages such as Visual C#
can use the class, as well.