What
is Null Modem?
Customers will ask what it means when they hear the term
"null modem" in conjunction with connecting their host
serial device to one of our serial RS-232 devices. In this setting
it simply means the two serial devices are interconnected without
interposing modems. That is, each device's serial port transmit
line is connected to the corresponding device's serial port receive
line and the signal ground is interconnected. The concept of "null
modem" actually originates from the earliest days of computers
talking to one another using modems over phone lines. Specifically,
North American Air Defense, or NORAD, needed a technology for their
computers to communicate over phone lines in the 1950s and the modem
was invented. In 1962, the first commercial modem came to be, the
Bell 103 from AT&T labs, with a maximum communication rate of
300 baud. These early modems were external hardware connected to
the computer through a serial interface, typically RS-232. The modem
was called DCE, or Data Communication Equipment. The computer was
called DTE, or Data Terminal Equipment. When the first IBM PCs began
to appear on the market in 1980, the standard RS-232 serial ports
were 25-pin D-sub shell connectors. The serial ports of DCE modems
and DTE PCs were frequently designed with pin assignments such that
a straight through cable could be used to interconnect them. In
those days this simple cable was frequently called a 'Modem Cable.'
Since these
modem cables were typically 25-pin D-sub shell ended straight through,
the TD, Transmit Data, line on the DTE PC was pin 2 and the RD,
Receive Data, line on the DCE modem was also pin 2. And, conversely,
the DTE RD line is pin 3 and the TD line on DCE is pin 3. So, the
transmit lines for each device were connected to the corresponding
receive lines of the other device. The SG, Signal Ground, was pin
7 on both DCE and DTE devices and was connected straight through.
Connection between the DTE PC and the DTE modem was further complicated
by the flow control of data. Early serial devices had small buffers
and often could not keep up with a long stream of data. So, the
receiving device had to be able to tell the transmitting device
when it was ready to receive data and to stop transmitting data
when it could not take anymore into the buffer. This type of flow
control is commonly called 'Hardware handshaking.' There were several
schemes used for hardware handshaking, so I will describe the most
common scheme which was first developed for simple modem interface.
The DTE PC sets
RTS, Request To Send, high when it is ready to receive data. The
DCE modem sets CTS, Clear To Send, high to indicate it is ready
to receive data. The DTE PC sets DTR, Data Terminal Ready, high
when it has power, meaning its serial device is present. Similarly,
the DCE modem sets DSR, Data Set Ready, available when it has power.
The DCE modem sets the CD, Carrier Detect, high when the modem senses
a telephone line signal connected to a remote modem, and the DCE
modem also set the RI, Ring Indicator, high when the modem detects
a ring signal on the telephone line.
The null modem
challenge is to interconnect to serial devices without interposing
modems, that is, to interconnect the serial ports in such a way
that devices communicate reliably. Most frequently the two devices
connected with a null modem cable are PCs which would both be DTE,
so their transmit and receive lines would be on the same pins. The
hardware handshaking lines also would not correspond. A straight
through cable, or 'Modem Cable,' could not be used. The TD and RD
lines would have to be crossed. The hardware handshaking lines would
also have to be cross connected as if a modem were present. So,
opposing DTR lines would have to be cross connected to the corresponding
DSR lines, and the opposing CTS lines would have to be cross connected
to the corresponding RTS lines. Of course the serial port would
also have to be fooled into thinking there was a telephone line
signal on the modem, so CD would have to be held high as well. The
cable that accomplished this cross over interconnection of computers
without the presence of modems became known as 'Null Modem' and
simply meant the need for the modem was nullified or eliminated
by the cable. But there was really no standard for this cable, and
the objective was accomplished using a variety of wiring schemes.
Today handshaking can be turned off easily on most PCs through the
operating system or under program control. So 'Null Modem' is often
accomplished by simply crossing TD and RD and taking the SG line
straight through. Another change from earlier days is that the common
PC RS-232 port is a 9 pin D-sub shell connector which incorporates
an altogether different pin assignment than the 25 pin connector.
The commercial world is rapidly shifting away from common serial
communication such as RS-232 to USB and Ethernet, and many computers
no longer have serial ports at all. But, many industrial devices
still employ RS-232 serial communication. There are several important
considerations. First, the connection can be anything from screw
terminals to a variety of connector types. If the connector is a
9 pin D-sub shell connector, it does not mean the pin-out is the
same as a standard PC serial port. Finally, the device may use hardware
handshaking and sometimes this handshaking cannot be disabled. Further,
it is not uncommon that PC-based HMI software will also use hardware
handshaking that cannot be disabled within the software. 'Null Modem'
cables can be constructed that will either employ the hardware handshaking
or jumper it in such that it is disabled and allows uncontrolled
communication. It may seem unwise to jumper around hardware handshaking,
but most PC hardware today has such large serial buffers and the
computers are so fast that overrunning the buffer is not an issue.
This may not be the case in proprietary industrial hardware. Using
the pin assignment for the 9 pin D-sub shell connector on a standard
consumer PC, the following are the pin-outs for 'Null Modem' cables
where hardware handshaking is in force between the two devices and
a second where handshaking is defeated.
Hardware
Handshaking:
2
RD --\/-- RD 2
3 TD --/\-- TD 3
5 SG ------ SG 5
1
CD -| |- CD 1
4 DTR --\/-- DTR 4
6 DSR --/\-- DSR 6
7
RTS --\/-- RTS 7
8 CTS --/\-- CTS 8
|
No
Handshaking:
2
RD --\/-- RD 2
3 TD --/\-- TD 3
5 SG ------ SG 5
1
CD -| |- CD 1
4 DTR -| |- DTR 4
6 DSR -| |- DSR 6
7
RTS -| |- RTS 7
8 CTS -| |- CTS 8
|
Pin 9 is RI,
but is not necessary in 'Null Modem' where ring detection will not
occur and constant connection is assumed.
Note that 9
pin connection does not typically accommodate a chassis ground.
This is normally done with the cable shield connected to the metal
rim of the D-sub connector. Signal ground should never be connected
to chassis ground and only one of the devices should be connected
to the shield to avoid ground loops through the shield between devices.
Many Advantech
devices that employ RS-232, but are not standard PC serial ports,
have only TD, RD, and SG, or 3 wire RS-232. In this case null modem
is accomplished by crossing the TD and RD and taking the SG straight
through. Make sure you determine where TD, RD, and SG are connected
on the field device. Do not assume a connector type such as 9 pin
D-sub shell implies a standard pin assignment. Also determine if
hardware handshaking is in force on the field device. If it is,
since hardware handshaking is not available in 3 wire RS-232, use
the scheme above to jumper CTS to RTS, and CD, DTR, and DSR together
on the field side as illustrated. If you are using shielded communication
cable, make sure you chassis ground only one side of the cable and
do not connect SG to chassis ground. Ground loops can yield symptoms
that are very difficult to troubleshoot. Finally, if your connection
still does not communicate and you have rechecked pin-outs, baud
rate, number of data bits, parity, and stop bits; Advantech's Technical
Support Engineers are always readily available and willing to help.
|
|
 |