                  INTERFACING MODEMS TO VAX COMPUTERS
                              David Deley
                            February, 1986

The following is a discussion on interfacing modems to VAX RS-232 
computer ports when the port is set to MODEM/HANGUP.

Pin 7 is signal ground and is always connected.  Pins 2 and 3 are 
transmit and receive and are always connected.  Pin 20 (DTR) is 
controlled by the computer and monitored by the modem.  This pin is used 
by the computer to control the modem.  When Pin 20 is high the modem 
should be ready to answer any incoming calls.  When pin 20 goes low the 
modem should hang up and not answer anymore incoming calls.

The  computer will pulse pin 20 low when it wants the modem to hang 
up.  There are two cases when the computer will do this.  The first is 
when a user logs out.  When a user logs out the computer will pulse pin 
20 low telling the modem to hang up because the user is through.  The 
second is when someone calls in and then doesn't log on.  When the modem 
answers an incoming call, the computer starts a 30 second timer.  If no 
one has logged in after 30 seconds, the computer will pulse pin 20 low 
telling the modem to hang up because no one has logged in.

Pins 5, 6, and 8 are controlled by the modem and monitored by the 
computer.  The computer uses these pins to determine what the modem is 
doing.	In order for the computer to successfully control the modem, it 
must be able to distinguish between four possible states:

1.  The modem is on hook and no one is logged in.  The computer holds 
pin 20 high telling the modem that it is ready to receive any incoming 
calls.

2.  The modem is off hook but no one is logged in.  The computer starts 
a timer and pulses pin 20 low after 30 seconds, telling the modem to 
hang up because no one has logged in. 

3.  The modem is off hook and a user is logged in.  The computer holds 
pin 20 high and talks to the user.

4.  A user is logged in and the modem goes on hook.  The computer 
politely logs out the user so the next person who dials in won't get 
connected to his process.  The computer also goes through the formality 
of pulsing pin 20 low.

Problems arise when the computer thinks the modem is in one state when 
it really is in another.  For instance, the modem may be on hook waiting 
for an incoming call, while the computer thinks the modem is off hook 
answering a call.  In this case, the computer will continually cycle its 
30 second timer, and pulse pin 20 low every thirty seconds.  If a user 
calls in and the modem answers, the computer may tell the modem to hang 
up before the user has a chance to log in.

Floating lines can also cause intermittent problems.  If a pin is left 
disconnected so that it is neither high nor low, then the computer may 
think it is high one day and low the next, creating problems which seem 
to come and go without explanation.

It is unknown exactly what causes the computer to think one thing and 
not another, and this is where the fun comes in.  Luckily, there do seem 
to be some conditions under which the computer appears to behave in a 
consistent manor.

If pins 5, 6, and 8 are all low the computer thinks the modem is on 
hook.  In this case the computer will hold pin 20 (DTR) high telling the 
modem that it should answer any incoming calls.

Various combinations of pins 5, 6, and 8 going high make the computer 
think that the modem has answered an incoming call.  If pins 5, 6, and 8 
all go high the computer definitely thinks this, and it starts its 30 
second timer.  If at the end of 30 seconds no one has logged in, then 
the computer pulses pin 20 low telling the modem to hang up.

With a user logged in and pins 5, 6, and 8 all high, the computer 
behaves properly and does not tell the modem to hang up until the user 
has logged out.

If a user is logged in and pins 5, 6, and 8 are all high, then various 
combinations of pins 5, 6, and 8 going low will cause the computer to 
think the modem has gone on hook and the computer will abruptly log the 
user out.  Various other combinations of pins 5, 6, and 8 going low will 
cause the computer to log the user out after a short delay.  If pins 5, 6, 
and 8 all go low, then the computer definitely thinks the modem has gone 
on hook and immediately logs the user out.


INTERFACING WITH THE RACAL-VADIC 2400PA AUTO-DIAL MODEM

     We connected pins 7(GND), 2(transmit), 3(receive), and 20 (DTR) 
with out problem.  Pin 20 worked in hanging up the modem when it went 
low.  We then connected pins 5, 6, and 8 straight through.  This didn't 
work because when the modem was on hook it held pin 5 low and pins 6 and 
8 high.  This caused the computer to continually cycle through its 30 
second timer routine and there were problems dialing in.  We then 
connected pin 5 from the modem to pins 5, 6, and 8 at the computer.  
This seemed to work.  Pin 5 was low when the modem was on hook, and it 
went high after the modem had answered an incoming call and made 
connection with the remote modem.  Then the next day it didn't work 
anymore.  We discovered from reading the modem manual that the modem 
doesn't assert pin 5 until it sees pin 4 as high, and we weren't 
connecting pin 4.  There was an optional setting in the modem's menu 
that would have cured this problem, but in order to make a cable that 
would be independent of this menu setting, we decided to also pass pin 
4.  The final cable passed pins 2,3,4,5,7,20 with pins 5,6,8 bridged at 
the computer end.  (This turned out to be incorrect).

     It turned out that passing pin 4 did not make operation of the 
modem independent of it's menu settings.  With pin 4 passed the modem
always held pin 5 high which caused the computer to continually cycle
through its 30 second timeout sequence.  The 2400PA modem MUST have
option 21 (CTS control) set to 2 (CTS follows CXR) in order for the
above cable to work properly.  But since we are now setting modem
options, we might as well set option 2 (DSR control) to 3 (DSR normal),
and option 3 (CXR control) to 1 (CXR normal).  With these settings the
modem can usually be connected with a straight cable passing pins
2,3,5,6,7,8, and 20. 

The recommended menu settings for RACAL VADIC 2400PA modems connected to
computer ports is:

RACAL-VADIC 2400PA MODEM OPTIONS MENU

01*2  STANDARD OPTION       02*3  DSR CONTROL
03*1  CXR CONTROL           04*1  AUTO ANSWER
05*1  LOCAL COPY            06*1  DIAL MODE
07*1  BLIND DIAL            08*1  CALL PROGRESS
09*1  RESPONSE MODE         10*1  CHARACTER LENGTH
11*1  DISCONNECT CONTROL    12*1  OVERSPEED CONTROL
13*1  SLAVE CLOCK           14*1  ASYNC/SYNC
15*1  AUTO REDIAL           16*1  SPEED SELECT
17*2  FLOW CONTROL MODE     18*1  SPEED CONVERSION
19*1  ERROR CONTROL MODE    20*1  ERROR CONTROL PROTOCOL
21*2  CTS CONTROL

Important settings are:
01*2  STANDARD OPTIONS must be off.  We are not using all default settings
02*3  DSR CONTROL must be normal
03*1  CXR CONTROL must be normal
17*2  FLOW CONTROL MODE should be XON/XOFF
21*2  CTS CONTROL must follow CXR

Other settings should usually be:
05*1  LOCAL COPY should be enabled
07*1  BLIND DIAL should be disabled
08*1  CALL PROGRESS detection should be enabled
09*1  RESPONSE MODE should be full words
10*1  CHARACTER LENGTH default setting of 10 bits
12*1  OVERSPEED CONTROL disabled
13*1  SLAVE CLOCK disabled
14*1  ASYNC/SYNC set to asyncronous
16*1  SPEED SELECT should be disabled.  (Don't confuse with speed conversion)

Settings you may choose accordingly:
04*1  AUTO ANSWER.  1=Answer incoming call on first ring.
                    2=Don't answer.
                    3=Answer incoming call on third ring.
06*2  DIAL MODE     1=Automatic selection
                    2=Tone dial
                    3=Pulse dial
11*1  DISCONNECT    1=Disconnect command Ctrl-C D enabled
                    2=Disconnect command Ctrl-C D disabled
15*1  AUTO REDIAL   1=No auto redial when auto-dialed call fails
                    2=Redial 3 times when auto-dialed call fails
                    3=Redial 8 times when auto-dialed call fails
18*1  SPEED CONV    1=Disabled
                    2=Attempt speed conversion  (Note: this can sometimes
                      fail if the modem chooses the wrong speed to convert
                      too.  It depends upon the remote modem's settings.)
19*1  ERROR CONTROL 1=Automatic.  Attempt error control handshake.
                    2=Hangup if attempted error control handshake fails.
                    3=Disabled.  Don't use error control.  This will 
                      speed up terminal response time.
20*1  ERROR CONTROL 1=Originate side initiates
                    2=Forced initiation
                    3=Respond only


INTERFACING THE RACAL-VADIC 2400PA MODEM TO DECSA

     The cable used passes pins 2,3,5,7,20 with 5,6,8 bridged at the 
DECSA end.  The modem option settings are as above.  Specifically, 
option 21 MUST be set to 2 (CTS follows CXR) or the modem will not 
answer properly, and option 18 MUST be set to 1 (speed conversion
disabled) or the modem will not pass the break character to the DECSA at 
1200 baud.


CHAPTER TWO:  INTERFACING A RIXON MODEM

Rixon modems could be connected directly to the computer port with a
straight through ribbon cable if options 4 and 5 in the modem menu are
disabled.  Option 4 asks if DSR pin 6 should always be on, and option
5 asks if CTS pin 5 should always be on.  If these options are enabled
then the computer will never know when a person hangs up the phone
without logging out because the modem will never drop these pins low. 
By disabling these options the modem then works correctly, and the
computer is happy.  Unfortunately, whenever the modem looses power it
always resets these two options.  Thus the straight forward method of 
interfacing the rixon to the computer is unacceptable.

It was then discovered that the rixon asserted pin 12 whenever a
connection was made, and pulled pin 12 low whenever the connection was
lost.  This was exactly what we were looking for.  We connected pin 12
from the rixon modem to pins 5, 6, and 8 on the computer port, and the
modem worked perfectly.  The final cable passed pins 2, 3, 7, and 20
straight and pin 12 from the modem to pins 5, 6, and 8 on the computer. 
According to the RS-232 standard, pin 12 is the high speed indicator and
is asserted whenever a 1200 bps connection is established.  This means
that this cable probably won't work at 300 baud.

GETTING A RIXON MODEM'S ATTENTION:

Rixon modems can sometimes be a real pain when they refuse to wake up, 
so here are some methods that have had some success in the past:

1. Try unplugging the power cord to the rixon for a moment.  This should
   put the modem to sleep.  Then try to wake it up by hitting the return 
   key several times.

2. Try entering three ``` quickly in succession.  This is the modem
   attention prompt.

3. Try entering three DDD quickly in succession.  Make sure the caps lock 
   key is down.  This is the end test command in case the modem is in 
   its self test mode.

4. Try entering the four letters ATNU.  Make sure the caps lock key is 
   down.  This tells the modem to exit from Hayes mode.  This is your 
   best bet if the modem echoes everything you type but doesn't do 
   anything.  If the modem responds by saying OK, then hit the return 
   key several times to wake it up.

Connect a breakout box between the modem and a terminal.  If the
breakout box indicates that the rixon is transmitting data but nothing
is appearing on the screen, it may be that the rixon has decided to
change its parity setting.  Try setting the terminal to different data
bits and parities.  Seven data bits with even parity, no check is a
popular one, but if that doesn't work try odd parity, mark parity,
space parity, and any other settings the terminal might have.  The
terminal should not generate an automatic line feed after every return. 
Turn this feature off if possible.  If at any time you get any kind of
garbled response from the modem, type the word PARITY.  The rixon should
set itself to the characteristics of your terminal and you should be
able to talk to it then.  After establishing a working connection with
the rixon, set your terminal back to its default setting and type the
word PARITY again.  The rixon is now ready for use.  (The default setting 
we normally use is eight bits, no parity.  The rixon should respond to
the PARITY command by saying ZERO.)

If at any time you get any response at all and are unable to establish a 
good connection with the rixon by typing PARITY, unplug the rixon's 
power for a moment and then resume trying.  Trying various combinations 
of data bits, parity, and unplugging should eventually result in 
success.

CHAPTER THREE:  DIAL OUT MODEMS

     All dial out modems connected to the computer should pass pin 20 so
the computer can hang up the modem.  Also the modem port should be set
to MODEM/HANGUP.  With this configuration, the computer will
automatically go through its hangup cycle whenever the port is
deallocated.  This prevents people from connecting to the modem, dialing
out to a remote computer, breaking back to the local prompt and logging
out leaving the modem connected and logged in to a remote process. 


CHAPTER FOUR:  KILLING THE CYCLIC <LOGON>

     Some modems connected to computer ports can get into a situation 
where the port is always in a <logon> state.  The scenario goes 
something like this.  First a broadcasted message is sent to all the 
ports by the system manager with a REPLY/ALL.  This wakes up the modem 
and it says "HI.  HERE I AM".  The computer then says, "Oh, someone's 
there.  I'll send him a USERNAME prompt."  The modem responds saying
"WHAT?", and the computer says, "Good, now what's your password?" The
modem says "WHAT?" and the computer says "Sorry, logon failure." to
which the modem responds "WHAT?" and the computer says "Oh, someone's 
there.  I'll send him a USERNAME prompt..."  and the cycle repeats
indefinitely. 
     For dial-out only ports this problem can be solved by setting the 
port to NOTYPE_AHEAD.  This disables all logins on that port.  It is 
also recommended that the port be set to NOBROADCAST so that the modem 
never gets broadcasted messages which can start the cycle or upset the
modem.  For dial-in modems the problem can be solved by setting the port 
to SYSPASSWORD.  This disables all responses from the computer until the 
SYSTEM_PASSWORD is entered.  (Note that the SYSTEM_PASSWORD is not the 
same as the password for the username SYSTEM).  It is also possible that
simply setting the port to NOBROADCAST might be enough to prevent the
cycle from happening.


CHAPTER 5:  INTERFACING SCN node SB3 port TXG15 with SPG port TTH12

     Our port TXG15 is set to NOMODEM/NOBROADCAST/SYSPASSWORD and the 
SPG VAX port TTH12 is set to NOMODEM/NOBROADCAST/NOSYSPASSWORD.  The 
nobroadcast is intended to prevent the cyclic <logon> from starting, and 
setting one node to SYSPASSWORD is intended to break the cyclic <logon> 
cycle if it does get started.  The ports are set to NOMODEM since we are 
not making any use of modem protocol.  Also the protection on these 
port devices is set to WORLD:RWLP so that users may access the port 
using KERMIT.


EPILOGUE:  OTHER GOOD BOOKS

A good book which further describes RS-232 interfacing techniques is
THE RS-232 SOLUTION  by Joe Campbell.


APPENDIX:  RS-232 SIGNALS

Pin  Signal  Computer <-> Modem  Description
---  ------  ------------------  -----------
 1    FG              <->        Frame ground
 2    TD (or TXD)      ->        Transmitted Data
 3    RD (or RXD)     <-         Received data
 4    RTS              ->        Request to send
 5    CTS             <-         Clear to send
 6    DSR             <-         Data set ready
 7    SG              <->        Signal ground
 8    DCD (or CXR)    <-         Data carrier detect
 9    reserved                   (In some modems, +V testing voltage)
10    reserved                   (In some modems, -V testing voltage)
11    unassigned
12    HS              <-         High speed
   or CI              <-         Speed mode indication
   or SDCD            <-         Secondary data carrier detect
13    SCTS            <-         Secondary clear to send
14    STD             <-         Secondary transmitted data
   or NS               ->        New sync
15    TC              <-         Transmit clock
   or SCT             <-         Secondary clock transmit
16    SRD             <-         Secondary received data
   or DCT             <-         Divided clock transmitter
17    RC              <-         Receive clock
18    DCR             <-         Divided clock
19    SRTS             ->        Secondary request to send
20    DTR              ->        Data terminal ready
21    SQ              <-         Signal quality
22    RI              <-         Ring indicator
23    HS               ->        High speed.  (Make a high speed connection)
   or HS              <-         High speed.  (High speed connection made)
24    TC              <-         Transmit clock
25    unassigned
