AOH :: MPRIMER3.TXT

Modem Primer 3 of 4


                             Digital Communications
                                 by Hank Volpe
                           A Modem Primer -- Part 3

Note: This material is copyrighted 1990 by Hank Volpe. Reprints of this
      article have appeared in more than 50 newsletters around the country.
      For more information or comments, please write to;
                               Hank Volpe
                               P.O. Box 43214
                               Baltimore MD 21236

When last we recessed, we had just finished our sophomore level view of 
modems, serial ports and computers. Just like college, parts 1 and 2 are now 
required reading for the rest of this look at modems, so if you missed those 
two and need points of reference I'd suggest taking a look at what we had 
discussed earlier.

Modem 301 - Advanced Initialization Strings
-------------------------------------------
In order for something to be useful, it must be flexible. Without 
flexibility, a computer, a modem, or a person can become crystallized in 
time. Time marches on, and leaves the crystallized device or person in the 
past. A modem can become locked into an older technology overnight simply by 
the introduction of a new standard. This is an acceptable situation though, 
because an advancement will always have a drawback. What is not acceptable  
is to have a modem that is completely compatible with current standards, but 
is not flexible enough to be used with rolodex programs, BBS programs, and 
communication programs of any kind. There was a time when only certain 
programs would work with certain modems. There was also a time when speeds 
about 1200 bps were thought to be out of the reach of a casual user of modems 
because of the foreseen restrictive cost factor. Now that high speed 
communication is both reliable and relatively inexpensive, there is more of a 
demand than ever to make modems that will stay flexible enough so that a user 
can get several years of satisfactory service from them. Modem flexibility is 
primarily seen by the number of user defined parameters that can be selected. 
These parameters are accessed by the user of initialization strings and S-
registers, with initialization strings being the more powerful of the two. 
Initialization strings conceptually are nothing more than a series of 
commands that the modem understands. These can be sent at any time that the 
modem is in the command state ( any time it is not on-line to another modem), 
however these commands are usually sent "initially" when you load a 
communication program. Depending on your modem, you can have anywhere from 10 
to 100 different commands that you can send. Why so many commands? Answer, to 
be flexible! Where would you use all of these commands? Answer, who knows! In 
other words, it depends on the application, the type of modem, the type of 
computer, and the type of work you are trying to do. 

For the most part, the command set of your modem can be divided into two 
categories; connection commands and handshaking commands. Connection commands 
control the dialing, answering, connecting and disconnecting your modem. 
Handshaking commands control the flow of data to and from the computer via 
the Uart. Most modems followed Hayes in their implementation of the basic 
connection and handshaking commands, however each manufacturer can freely add 
to this list and extend more features to both the programmer and the user of 
the modem. These extended command sets vary from modem to modem, which is one 
of the reason why it can be difficult to write a software package that is 
guaranteed to work on all brands of modems. The initialization string 
approach allows a user with a little technical background to guarantee that 
his modem will work with the software package he purchased. The key words 
here are a "little technical background". It does not require a lot to pick 
the correct commands to send to the modem to customize it, once you have a 


working knowledge of what you are trying to do. The important thing here to 
grasp is this; an initialization string is a vehicle used in communication 
programs to guarantee that the program can work with any brand of modem as 
long as the user installs the correct sequence of commands in the 
initialization string. 

There are some commands that are definitely important when it comes to a 
properly working communication program. The most essential, and also the one 
that in my opinion is incorrectly implemented in Hayes and compatible modems 
is the Carrier detect handling. We discussed these in great detail last 
month. The trap in my opinion is the fact that Hayes and compatible modems 
ignore the state of the Carrier detect line (which means that your 
communication program has no way of knowing if it is connected to a remote 
modem or not. This would give you a permanent ON-LINE indication if you were 
using Procomm or Qmodem. If you are having that sort of problem, you can send 
a command (AT &C1) and that problem will go away just like that! Another 
complaint I have with the Hayes instruction set (and this is more a pet peeve 
than anything else) is the way call progression is handled. Call progression 
is a status feature. What it does is send English words to the communication 
program like RINGING, BUSY, NO CARRIER, VOICE. A communication program can 
then use these to control how dialing is handled. For example, if your modem 
detects a busy signal and returns the word BUSY, then your communication 
program can recycle the call and dial again instead of wasting time 
monitoring a busy signal. Nice and simple isn't it? So then why isn't this  
implemented as a standard feature. Instead, you must program your modem to 
return this very helpful and time-saving information to you. To do this, send 
the command AT X4 to the modem. 

Another useful idea to play with involves regulating the volume of your 
speaker. Isn't it amazing that a $5 radio has a volume control for the 
speaker but most $300 modems do not? I can understand why internal modems do 
not have a control, but externals? I'd go so far as to say that an external 
modem without a volume control should be a punishable crime in most states 
(of course, that's because I have small children who wake up to the sound of 
loud carriers). However you can do several things in your initialization 
string to handle this. AT M controls the way the speaker is used. The default 
is AT M1 which keeps the speaker on until a connection is made. AT M0 turns 
off the speaker at all times and AT M3 turns on the speaker at all times. To 
regulate the volume, you use AT L with AT L1 selecting the lowest level and 
AT L3 the highest (some manufacturers go up to AT L9, so you might want to 
experiment). 

Finally, there are several commands that control the way data flows between 
the modem and the Uart. There are several handshaking signals that can be 
used by your modem and your computer. The DTR/DSR pair and the RTS/CTS pair 
are essential for correct high speed communications. You can program your 
modem to use these signals in several ways. Hayes modems can be programmed to 
reset the modem every time the DTR signal is dropped by your computer. Why 
would you want to use such a feature? Well, there are some poorly written 
computer programs that quite frankly leave your modem in a mess! They do not 
clean up properly after you use them, and then when you go to use another 
communication program, you find out your modem isn't responding properly. For 
external modem users, turning the modem on and off clears the problem, but 
what about internal users? AT &D can be used to perform this task. AT &D0 is 


the default, and the modem does nothing. AT &D1  and AT &D2 will disconnect a 
call that is in progress if the DTR signal drops (in other words, if you turn 
off the computer or disconnect the cable while still connected to a BBS, the 
modem will disconnect on its own. I personally know of one fellow who would 
have saved a 40 hour long distance phone call if he had used this feature. 
Seems he was connected to a long distance BBS, and exited his communication 
program. Since this was an office machine and never turned off, the modem was 
still connected to the remote BBS. Furthermore, the remote service did not 
have a "dead-key" feature and kept its connection to the modem up for an 
entire weekend. When the bill arrived next month, I was summoned to reprogram 
his modem to use this feature. Granted this does not happen every day, but if 
it just happens once to you, you will regret not taking a simple precaution. 
Finally AT &D3 disconnects and resets the modem back to its stored 
parameters. If you are having problems with intermittent lock-ups of your 
modem after use by certain programs, you might want to set your modem to use 
AT &D3, otherwise you have to look for either a program to do this for you, 
or you have to turn off the modem to clear it.

There are many more commands to experiment with, however before you do, make 
sure you check your user's manual. All of the commands above work on Hayes 
2400 compatible modems, (but as you should remember, not all modems are 100% 
Hayes compatible). Select the most useful one's and place these in your 
initialization string that you use with your communication program. 


Modem 302 - Memorization 
-------------------------
A problem to ponder. What if you wish to set your modem up to work a certain 
way, however the program you are using does not accept or use initialization 
strings? There are programs such as Fasthst and Comset that will do the work 
for you each time you boot your computer up. However, it would make more 
sense and add a great degree of flexibility if your modem just remembered by 
itself how you wished it to work. Then all you would need to do is reset it 
with an ATZ or turn it on and the modem would load up all the parameters you 
wish to use. Well again, depending on your modem, it might already have that 
feature installed. This is called non-volatile memory. It's a cross between 
RAM and ROM. RAM memory is memory that can be changed but is erased whenever 
you turn off or reboot your computer. ROM is memory that is permanent and 
stored on a chip and cannot easily be changed. Non-volatile memory is memory 
that can be changed, but remembers what was placed in it between periods of 
loss of power. This memory can be held on by a battery or by a charge on a 
capacitor (an electronic device that stores charges) or it can be an EEROM (a 
rom that can be reprogrammed by a user under certain conditions). If your 
modem has this feature, you will be able to send commands to it and store 
these commands permanently in its memory to be used over and over again.

To store these commands, you have to load a communication program and place 
the modem in the command state (in other words, it is not on-line to another 
modem). Then you type the commands from the keyboard; ie AT L3 M1 X4 &C1 &D3.
When you have entered these commands, you can either add one more command &W 
or type AT &W from a new line. In any case, the &W command saves this setup, 
plus the current contents of your S-registers to the modem's memory. You can 
still change these commands at anytime, however whenever you reset the modem, 
you will reload these settings you placed in the modem instead of the factory 


defaults.  Some modems have multiple areas of setups for you to use. In this 
case, you would use AT &W0 or AT &W1 etc to make multiple setups available. 
The last used setup is the one that is recalled when the modem is reset. What 
if you goof up? Well, you can always get back to square-one by type AT &F, 
which reloads the factory default settings. You can then save those for use 
by typing AT &W.  Non-volatile memory is a nice feature, but not all modems 
have it. If yours does not, you can download several programs that can reset 
and send initialization strings to your modem at boot-time. Or, you could use 
any communication program and its initialization string to perform the same 
task. In any case, check out your modem to see if it has non-volatile memory. 
It is much easier to store these features in your modem for use by all 
programs than to use initialization strings.


Modem 303 - Less filling or Tastes Great?
-----------------------------------------
Every field of human endeavor has its controversy. With modems, the question 
comes down to internal modems vs. external modems. Which is better? Well, as 
much as I always say "it depends on the application", in this case I do feel 
there is a clear cut winner, and that is the external modem.

Internal modems are nice because you don't need a serial port or a cable in 
order to use them. You just find an empty slot in your PC, plug it in, and 
away you go. External modems require external power supplies, a cable and a 
serial port in order to work. External modems take up space (some like mine 
at home are nearly 10 inches deep and 6 inches across). Also, external modems 
always cost more money than internals because you need a case, lights, 
switches, power supplies (and don't forget, volume controls). Performance 
wise, they work the same with no difference at all. So why do I recommend an 
external modem? For convenience of course!
 
By now you are convinced that the author of this document has a problem, for 
he just told you all of the reasons why internals are better and then said 
externals have more convenience. Well, it is true. Externals have front-panel 
lights to monitor the condition of your modem. Externals can be used with any 
type of computer (past or future) and shared easily with an A/B switch 
between computers. Externals do not conflict with any built-in serial ports 
in your machine because they need to use a built-in serial port in order to 
work in the first place. Finally, externals are better because there 
appearance can really impress your non-computer friends and make them believe 
that your hobby is just short of "star-trek".


Recess time
-----------
That's about it for this month. Next month, we'll be ready to graduate. Did
you realize the similarities between data exchange and making love?  Well
next time we'll explore the fascinating world of handshaking and transfer
protocols and try to tie up any loose ends in our discussion of Modems.