home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / dcom / modems / 18916 < prev    next >
Encoding:
Internet Message Format  |  1993-01-05  |  82.9 KB

  1. Path: sparky!uunet!spool.mu.edu!yale.edu!jvnc.net!rutgers!cmcl2!panix!oppedahl
  2. From: oppedahl@panix.com (Carl Oppedahl)
  3. Newsgroups: comp.dcom.modems
  4. Subject: Neat stuff about modems
  5. Message-ID: <C0Cytu.Etn@panix.com>
  6. Date: 5 Jan 93 01:58:41 GMT
  7. Organization: Panix Public Access Internet & Unix, NYC
  8. Lines: 1836
  9.  
  10.  
  11. Recently a kind soul on panix directed me to a file called TRM20.TXT 
  12. available from Hayes at 1-800-874-2937.  It has all sorts of neat stuff
  13. about the Hayes command set that I have never seen anywhere else.
  14.  
  15. Among the neatest things I learned are:
  16.  
  17.  - if you send a command line such as ATZ followed by other things, the 
  18. other things are likely to be lost, because most Hayes-compatible modems 
  19. ignore everything after the Z.
  20.  
  21.  - how to interpret the strings you get when you send ATI4.
  22.  
  23.  - how to interpret the string you get when you send ATI0.
  24.  
  25.  - how to test to be sure you have a cable that does hardware handshaking.
  26.  
  27. Excerpts follow.
  28.  
  29. --------------------------------------------------------------------------
  30.  
  31. TECHNICAL REFERENCE FOR HAYES (TM) MODEM USERS
  32.  
  33. 15 Sept 1992
  34. Version P2.0
  35.  
  36. Hayes Microcomputer Products, Inc.
  37. P.O. Box 105203
  38. Atlanta, Georgia 30348 U.S.A.
  39.  
  40. (c) 1990, 1992 Hayes Microcomputer Products, Inc.
  41. All rights reserved.
  42.  
  43. 44-00012 AA H32 (BBS Version)
  44. Note: This version of the "Technical Reference for Hayes Modem Users" is a 
  45. special version edited for bulletin-board downloading. As a plain ASCII 
  46. character file, it therefore cannot contain any of the illustrations and 
  47. graphic elements provided in the printed version.
  48.  
  49. ------------------------------------------------------------------------
  50.  
  51. I - Internal Memory Tests
  52.  
  53. The various forms of the I command instruct the modem to query its 
  54. memory for information about itself. The results of these tests are 
  55. frequently used by programmers to determine compatibility with software. 
  56. Because these commands request information about the modem's firmware, 
  57. they are not run when a connection has been established with a remote 
  58. modem.
  59.  
  60. I0 - Display Product Code
  61.  
  62. This option reports the product code of the modem to the DTE. The modem 
  63. produces information text dependent upon its highest DCE line speed. The 
  64. responses below are examples:
  65.  
  66. Result Codes     Description
  67. ------------------------------------------------------------------------
  68. 300              Smartmodem 300.
  69. 120              Smartmodem 1200, Smartmodem 1200B, Smartmodem 1200C, 
  70.                  Smartmodem 1200A.
  71. 240              Smartmodem 2400, Smartmodem 2400B, Smartmodem 2400P, 
  72.                  Smartmodem 2400Q, Smartmodem 2400M, V-series Smartmodem 
  73.                  2400, V-series Smartmodem 2400B, V-series Smartmodem 
  74.                  2400 Quad, V-series Smartmodem 2400M, Smartmodem OPTIMA 
  75.                  (TM) 24, Smartmodem OPTIMA 24 + FAX96, 
  76.                  ACCURA (TM) 2400 EC/FAX96.
  77. 960              Smartmodem 9600, V-series Smartmodem 9600, V-series 
  78.                  Smartmodem 9600B, V-series ULTRA (TM) Smartmodem 2400, 
  79.                  V-series ULTRA Smartmodem 9600, V-series ULTRA 24 with 
  80.                  Express 96, Smartmodem OPTIMA 9600, Smartmodem 
  81.                  OPTIMA 96 + FAX96, ACCURA 9600 EC/FAX96.  
  82. 14400            V-series ULTRA Smartmodem 14400, Smartmodem OPTIMA 144, 
  83.                  Smartmodem OPTIMA 144 + FAX144, ACCURA 14400 EC/FAX144. 
  84. ------------------------------------------------------------------------
  85.  
  86. I1- Display ROM Checksum
  87.  
  88. The I1 command instructs the modem to calculate the value of the ROM 
  89. checksum. The response is a number, the sum of all of the bytes in ROM.
  90.  
  91. I2 - Perform ROM Checksum
  92.  
  93. This command instructs the modem to verify the ROM checksum. Depending 
  94. on whether the ROM checksum has been found to be correct, the modem 
  95. produces text that resembles a result code. The modem memory test 
  96. compares the ROM checksum and tests it against the correct sum, also 
  97. stored in ROM. Rather than returning a numeric value as in I1, the I2 
  98. command generates a result code. When the checksum is valid, the 
  99. response is: OK. When the ROM checksum fails, the modem responds with 
  100. ERROR.
  101.  
  102. I4 -  Identify Product Features
  103.  
  104. The capabilities and features of the modem are encoded into a string of 
  105. text that consists of several strings that are ASCII character 
  106. representations of hex numerals which are bit-mapped. The first 
  107. character of each string identifies which bit maps are in that string. 
  108. For example, the "a-string" starts with a lower case "a" and identifies 
  109. most of the basic modem capabilities such as modulation standards 
  110. supported and support for AutoSync.
  111.  
  112. Since the following tables identify features for Hayes modem products, 
  113. the values included here and the number of strings are subject to change 
  114. and expansion. The maximum length per string is 40 characters.
  115.  
  116. The I4 text is displayed in the following form:
  117.  
  118.      a097800C204C264
  119.      bF60410000
  120.      r1031111111010000
  121.      r3000111010000000
  122.  
  123. surrounded by additional <CR> and <LF> characters as are required by the 
  124. V command option in effect. According to convention, all <CR> and <LF> 
  125. characters are defined by S3 and S4, respectively. The meanings of the 
  126. a, b, r1, and r3 strings currently defined are described below.
  127.  
  128. I4 "a" String
  129. The first string, the a-string, is composed of the ASCII character "a" 
  130. followed by a series of hexadecimal characters (D1-D16 in this example). 
  131. The bit map for each byte is defined below.
  132.  
  133. a D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12 D13 D14 D15 D16 D17 D18....
  134.  
  135. ------------------------------------------------------------------------
  136. D1, D2     Reserved
  137. D3         Bit 3: Indicates modem based on SM1200FE commands 
  138.            Bit 2: Indicates modem based on SM2400 commands 
  139.            Bit 1: Indicates that modem supports &J commands
  140.            Bit 0: Indicates that modem supports &L commands 
  141. D4         Bit 3: Indicates that modem supports AutoSync (&Q4)
  142. D5         Bit 3: Plug-in board modem product
  143.            Bit 2: Standalone modem product
  144.            Bit 1: Supports &H0 through &H4
  145.            Bit 0: Supports &I0 through &I4 
  146. D6         Bit 3: Reserved
  147.            Bit 2: Supports M4 command
  148.            Bit 1: Supports 32-bit FCS (frame check sequence 
  149.            for AutoSync)
  150.            Bit 0: Supports AutoSync II
  151. D7         Bit 3: Supports V.22 at 1200 bps (B0)
  152.            Bit 2: Supports 212A (B1)
  153.            Bit 1: Supports ASB in V.23 75 bps xmt/1200 bps rcv (B2)
  154.            Bit 0: Supports ASB in V.23 1200 bps xmt/75rcv (B3)
  155. D8         Bit 3: Supports V.23 1200 bps xmt/75 bps rcv (B4)
  156.            Bit 2: Supports V.23 1200 half duplex (B5)
  157.            Bit 1: Supports V.23 75 bps xmt/1200 bps rcv (B10)
  158.            Bit 0: Supports V.23 75 bps xmt/600 bps rcv  (B11)
  159. D9         Bit 3: Supports V.21 100/300 bps (B15)
  160.            Bit 2: Supports ASB in V.23 75 bps xmt/600 bps rcv (B20)
  161.            Bit 1: Supports ASB in V.23 600 bps xmt/75 bps rcv (B21)
  162.            Bit 0: Supports V.23 600 bps xmt/75 bps rcv  (B22)
  163. D10        Bit 3: Supports V.23 600 bps half-duplex (B23)
  164.            Bit 2: Supports V.22bis at 2400 bps (B30)
  165.            Bit 1: Supports V.27ter at 2400 bps (B31)
  166.            Bit 0: Supports V.27ter at 4800 bps  (B40)
  167. D11        Bit 3: Supports V.32 full duplex at 4800 bps (B41)
  168.            Bit 2: Supports Express 96 at 4800 bps (B42)
  169.            Bit 1: Reserved
  170.            Bit 0: Supports V.29 half duplex at 4800 bps (B44)
  171. D12        Bit 3: Supports V.29 half duplex at 7200 bps (B50)
  172.            Bit 2: Supports V.32 full duplex at 9600 bps (B60)
  173.            Bit 1: Supports Express 96 at 9600 bps (B61)
  174.            Bit 0: Reserved
  175. D13        Bit 3: Supports V.29 half duplex at 9600 bps (B63)
  176.            Bit 2: Supports 103 110/300 bps (B16)
  177.            Bit 1: Supports V.32bis (7200/12000/14400 bps)
  178.            Bit 0: Reserved
  179. ------------------------------------------------------------------------
  180.  
  181. ------------------------------------------------------------------------
  182. D1, D2      Reserved
  183. D14         0: Reserved
  184.             1: Personal Modem 1200
  185.             2: Personal Modem 2400
  186.             3: Personal Modem 1200 Plus
  187.             4: Personal Modem 2400 Plus
  188.             5: Pocket Edition
  189. D15         Bit 3: Reserved
  190.             Bit 2: Supports $ dial modifier and NO DIALTONE result code.
  191.             Bit 1: Supports S95 Bit 5 for COMPRESSION: result code
  192.             Bit 0: Supports S95 Bit 4 for AUTOSTREAM: result code 
  193. D16         Bit 3: Supports S95 Bit 3 PROTOCOL: result code
  194.             Bit 2: Supports S95 Bit 2 CARRIER result code
  195.             Bit 1: Supports S95 Bit 1 CONNECT/ARQ result code
  196.             Bit 0: Supports S95 Bit 0 CONNECT XXXX (for DCE rate) 
  197. ------------------------------------------------------------------------
  198.  
  199. I4 "b" String
  200.  
  201. The second string, the b-string, is composed of the ASCII character "b" 
  202. followed by a series of hexadecimal characters (D1-D9). The bit map for 
  203. each character is defined as follows:
  204.  
  205. b D1 D2 D3 D4 D5 D6 D7 D8 D9....
  206.  
  207. ------------------------------------------------------------------------
  208. D1          Bit 3: V.42 Alternate Protocol Supported
  209.             Bit 2: V.42 LAPM Protocol Supported
  210.             Bit 1: X.25 Protocol Supported
  211.             Bit 0: LAPB (Point-to-point error control) protocol supported
  212. D2          Bit 3: Reserved (should be set to zero)
  213.             Bit 2 MNP (TM) Class 5 supported
  214.             Bit 1: V.42bis supported
  215.             Bit 0: Compression through the X.25 network supported
  216. D3/D4       These combine to indicate the number of AutoStream 
  217.             Type A channels which are supported. The formula 
  218.             (D3*16 + D4) is used. Zero means AutoStream is not supported
  219. D5          Bit 3: Reserved
  220.             Bit 2: Reserved
  221.             Bit 1: Adjustable startup (ASU) is supported
  222.             Bit 0: Negotiates adjustable startup
  223. D6          Bit 3: &K5 not supported
  224.             Bit 2: &K5 supported
  225.             Bit 1: Unidirectional flow control
  226.             Bit 0: S105 N104 parameter supported
  227. ------------------------------------------------------------------------
  228.  
  229. I4 "r1, r2" and "r3" strings
  230.  
  231. These ID strings allow software to determine the available speeds that 
  232. may be used to send AT commands. The r1-string contains a bit map that 
  233. indicates at which DTE rates the autobaud process is supported.
  234.  
  235. The presence of the r2-string in the I4 result infers that S87 is 
  236. supported and is required for autobauding at the higher speeds. To 
  237. autobaud at one of the speeds indicated in the r2-string requires that 
  238. S87 be set to match that speed. 
  239.  
  240. The r3-string is issued if synchronous DTE speeds are supported. The map 
  241. indicates which DTE rates are supported in synchronous modes. Each r-
  242. string begins with the lower case letter "r" and may be followed by as 
  243. many as 39 additional characters, not counting <CR><LF>'s that will be 
  244. used to separate them from other strings. Those 39 additional characters 
  245. are limited to the ASCII-HEX alphabet 0-9 and A-F.
  246.  
  247. After the two lead-in characters (i.e., r<n>), all subsequent characters 
  248. contain the DTE rate maps. All maps have the same mapping for 
  249. convenience to software. (Refer to the following chart.) Not all bit 
  250. assignments are possible: for example, the split speeds have no meaning 
  251. in the r3 synchronous map and are always filled with zeros.
  252.  
  253. In r1, if the bit is filled with a 1, the corresponding DTE rate is 
  254. supported for sending AT commands to the device. A zero indicates that 
  255. DTE rate is not supported for AT commands.
  256.  
  257. In the r3 map, the bits simply indicate which DTE rates are supported 
  258. for synchronous operation on-line. This does not indicate, however, the 
  259. supported rates for synchronous V.25bis commands.
  260.  
  261. Split speeds if available are marked in the r1 string only when the 
  262. appropriate B command option has been selected. Future expansion of 
  263. these strings may include new speeds that are not in strict ascending 
  264. order.
  265.  
  266. DTE Rate Bit Map for r1, r2 and r3 Strings
  267.  
  268. Character    Bit #       DTE Rate
  269. ------------------------------------------------------------------------
  270.  3:  1       bit 0       45.45 bps
  271.      2       bit 1       50
  272.      4       bit 2       75
  273.      8       bit 3       75/600 (xmt is 75, rcv is 600) 
  274.  4:  1       bit 4       75/1200
  275.      2       bit 5       110
  276.      4       bit 6       134.5
  277.      8       bit 7       50
  278.  5:  1       bit 8       300
  279.      2       bit 9       450
  280.      4       bit 10      600
  281.      8       bit 11      600/75
  282.  6:  1       bit 12      1200
  283.      2       bit 13      1200/75
  284.      4       bit 14      1800
  285.      8       bit 15      2000
  286.  7:  1       bit 16      2400
  287.      2       bit 17      3000
  288.      4       bit 18      3600
  289.      8       bit 19      4200
  290.  8:  1       bit 20      4800
  291.      2       bit 21      5400
  292.      4       bit 22      6000
  293.      8       bit 23      6600
  294.  9:  1       bit 24      7200
  295.      2       bit 25      7800
  296.      4       bit 26      8400
  297.      8       bit 27      9000
  298. 10:  1       bit 28      9600
  299.      2       bit 29      12000
  300.      4       bit 30      14400
  301.      8       bit 31      16800
  302. 11:  1       bit 32      19200
  303.      2       bit 33      21600
  304.      4       bit 34      24000
  305.      8       bit 35      26400
  306. 12:  1       bit 36      28800
  307.      2       bit 37      31200
  308.      4       bit 38      33600
  309.      8       bit 39      36000
  310. 13:  1       bit 40      38400
  311.      2       bit 41      43200
  312.      4       bit 42      48000
  313.      8       bit 43      52800
  314. 14:  1       bit 44      56000
  315.      2       bit 45      57600
  316.      4       bit 46      62400
  317.      8       bit 47      64000
  318. 15:  1       bit 48      67200
  319.      2       bit 49      72000
  320.      4       bit 50      76800
  321.      8       bit 51      81600
  322. 16:  1       bit 52      86400
  323.      2       bit 53      91200
  324.      4       bit 54      96000
  325.      8       bit 55      100800
  326. 17:  1       bit 56      105600
  327.      2       bit 57      110400
  328.      4       bit 58      115200
  329.      8       bit 59      reserved ("0")
  330. ------------------------------------------------------------------------
  331.  
  332. W - Negotiation Progress Message Selection
  333.  
  334. The W command works in conjunction with S95 (where supported) to 
  335. determine which result codes will be used to describe the type of 
  336. connection and protocol, etc., that resulted from handshaking and 
  337. negotiation. 
  338.  
  339. The W command supports extended result codes in addition to 
  340. the CONNECT result code. When the modem is operated in error-control 
  341. mode (&Q5 is in effect), the W command and S95 together allow the user 
  342. to select these additional result codes:
  343.  
  344. CARRIER
  345. PROTOCOL
  346. AUTOSTREAM
  347. COMPRESSION
  348. CONNECT
  349.  
  350. Any result codes enabled by the W command and S95 will be generated in 
  351. the order indicated above. If AutoStream is not being used, no 
  352. AUTOSTREAM result code is returned. Result codes not enabled when the W 
  353. command option is in effect may be turned on by setting certain bits in 
  354. S95. The W command options below are available when S95 is configured 
  355. for any setting other than the factory-setting of 0.
  356.  
  357. ------------------------------------------------------------------------
  358. W0     CONNECT result code reports DTE speed, and if S95=0, then disable
  359.        all extended result codes.
  360. W1     CONNECT result code reports DTE speed, and if S95=0, then enable
  361.        the CARRIER and PROTOCOL extended result codes.
  362. W2     CONNECT result code reports DCE speed, and if S95=0, then disable
  363.        all extended result codes.
  364. ------------------------------------------------------------------------
  365.  
  366. Refer to the S95 bit map description in the next section. Note that 
  367. selecting W0 and setting S95=12 is the same as selecting W1; and that 
  368. selecting W0 and setting S95=1 is the same as selecting W2. S95 cannot 
  369. be configured to force W2 to report DTE speed in the CONNECT result 
  370. code; there is no setting of S95 that will force W1 not to produce the 
  371. CARRIER and PROTOCOL result codes. S95 extends the functionality of the 
  372. W command. The W command with S95=0 (factory setting) maintains 
  373. backwards compatibility with previous Hayes Products. However, 
  374. selecting W0 and setting S95 as required allows you to tailor result 
  375. code characteristics to your own requirements.
  376.  
  377. ------------------------------------------------------------------------
  378.  
  379. Z - Soft Reset Command
  380.  
  381. The modem can be reset by issuing the Z command. The command tells the 
  382. modem to go on hook and restore the selected stored profile. Any non-
  383. storable parameters previously set by commands are returned to their 
  384. factory settings. The modem aborts execution of all commands following 
  385. the Z command on the same command line. Subsequent commands on the same 
  386. line are ignored. Refer to the &W command for description of which modem 
  387. parameters are included in a stored profile. Z0 recalls stored user 
  388. profile 0, stored with &W0; Z1 recalls stored user profile 1, stored 
  389. with &W1.
  390.  
  391. ------------------------------------------------------------------------
  392. Z0     Recall stored profile 0
  393. Z1     Recall stored profile 1
  394. ------------------------------------------------------------------------
  395.  
  396. &T19 - Perform RTS/CTS Cable Test
  397.  
  398. Software can use &T19 to help determine whether the DTE-to-Modem cable 
  399. supports the RTS and CTS signals necessary for hardware flow control, 
  400. which is selected by the &K3 command.
  401.  
  402. &T19 in the modem works interactively with the DTE to confirm the RTS 
  403. and CTS signal. Only the DTE can detect CTS, and only the modem can 
  404. detect RTS. The modem cannot verify both signals without the active 
  405. involvement of the DTE software.
  406.  
  407. The modem performs the following algorithm in response to the AT&T19<CR> 
  408. command:
  409.  
  410. 1.  Turns OFF CTS (normally ON).
  411. 2.  Starts a 500 millisecond timer.
  412. 3.  Monitors RTS for ON and OFF states.
  413. 4.  If both states of RTS are detected before the 500ms timer 
  414.     expires then:
  415.       a. Restore CTS to the ON state.
  416.       b. End the test (stop the timer).
  417.       c. Return the OK result code (meaning the modem has 
  418.       verified RTS).
  419. 5.  If the timer expires before both states of RTS are detected then:
  420.       a. Restore CTS to the ON state.
  421.       b. Return the ERROR result code (meaning the modem has not 
  422.       verified RTS).
  423.  
  424. Note: By itself, the modem cannot verify either signal. The DTE must 
  425. toggle RTS during the test in order for the modem to be able to detect a 
  426. change. Also, the DTE should look for CTS to drop during the test to 
  427. verify it is connected.
  428.  
  429. The following algorithm is used by Hayes Smartcom software in its use of 
  430. the &T19 test:
  431.  
  432. 1.  Issue AT&T19 <CR>
  433.  
  434. Note: For more predictable timing, do not combine other commands on the 
  435. same command line with &T19. Also, higher DTE port speeds improve the 
  436. timing resolution.
  437.  
  438. 2.  Wait 500ms for CTS to drop. If CTS does not drop in that time, then 
  439. the test fails.
  440.  
  441. 3.  If CTS drop is detected, then:
  442.       a. Drop RTS, wait 50ms, raise RTS, wait 50ms, repeat up to 6 
  443.       times, or until CTS is  detected high.
  444.       b. If CTS is detected returning high before 6 iterations, then the
  445.       test is passing (and an OK result code may be expected soon), or 
  446.       if all 6 iterations did not result in CTS being raised, then the 
  447.       RTS part of the test is failing (and an ERROR result code may be 
  448.       expected after the 500ms timer expires).
  449.  
  450. 4.  Process the result code from the modem. Success during Step 3 above 
  451.     and an OK result code implies that RTS and CTS are both wired 
  452.     correctly. Failure during Step 3 or an ERROR result code implies 
  453.     that either RTS or CTS is not wired in the cable.
  454.  
  455. Note: Keep in mind that the result code may arrive while you are still 
  456. in Steps 2 and 3 above.
  457.  
  458. A modification to the software algorithm could be made to permit 
  459. software to detect which signal is missing from the cable. After issuing 
  460. the AT&T19 <CR> command, give the modem about 100ms to drop CTS. Then, 
  461. even if the CTS drop is not detected, proceed to toggle RTS anyway, 
  462. keeping in mind that the CTS part of the test has failed.
  463.  
  464. RTS/CTS flow control is preferred because it is "out of band", that is, 
  465. it does not consume any of the 256 serial codes from the user data. 
  466. XON/XOFF flow control uses DC1 (ASCII 17) and DC3 (ASCII 19). If RTS/CTS 
  467. is not supported, then Transparent Flow Control (&K5) is the next best 
  468. option (IF the software supports it) because it accomplishes Xon/Xoff 
  469. flow control without interfering with the user data (e.g. during binary 
  470. file transfers).
  471.  
  472. ************************************************************************
  473. 1.2     Result Code Listing
  474.  
  475. This section defines the result codes returned by Hayes modems in 
  476. response to commands.
  477.  
  478. The table below shows the various formats in which modem responses can 
  479. be presented. Note that the "text" of the info-text may consist of 
  480. multiple lines of text. The formats depicted here only refer to the 
  481. <CR><LF> characters between info-texts and not within them.
  482.  
  483. ------------------------------------------------------------------------
  484.                   V0            V1
  485. Information Text  text          <CR><LF>
  486.                   <CR><LF>      text
  487.                                 <CR><LF>
  488. Result Codes      numeric code  <CR><LF>
  489.                   <CR>          verbose code
  490.                                 <CR><LF>
  491. ------------------------------------------------------------------------
  492.  
  493. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  494. 1.2.1     Command Response and Call Progress Monitoring
  495. This set of result codes includes responses to commands and call 
  496. progress monitoring responses. They are available to all modems within 
  497. the capabilities of the modem. For example, the result code CONNECT 9600 
  498. is not available to Smartmodem 2400. The factory setting for all high-
  499. speed modems enables the extended set of call progress monitoring (X4). 
  500. When set up in this way, the modem performs and reports full call 
  501. progress monitoring (RING, NO CARRIER, NO DIALTONE, and BUSY). It also 
  502. indicates the speed of the connection (CONNECT 1200 as opposed to simply 
  503. CONNECT). The factory setting for Smartmodem 300, Smartmodem 1200, and 
  504. all others whose highest speed is 1200 bps is basic call progress 
  505. monitoring (X0).
  506.  
  507. The command response and call progress monitoring result codes are 
  508. defined below:
  509.  
  510. 0 - OK
  511. This result code indicates that a command or command string was 
  512. executed. Note that if more than one command were included on a line and 
  513. an ERROR result code received, this means that one or more of the 
  514. commands was not processed. If one or more were executed properly, but 
  515. even one was invalid, no OK will be issued, only the ERROR.
  516.  
  517. 1 - CONNECT
  518. This result code indicates a connection was made between the DTE and the 
  519. modem. If X4 (extended set of call progress monitoring) were selected, 
  520. the code indicates that a connection from at 0 to 300 bps was made. 
  521. However, if X0 (basic set of call progress monitoring) were selected, 
  522. the connection could be 0-300, 1200, 1200/75, 75/1200, 2400, 4800, 7200, 
  523. 9600, 14400, 19200, or 38400 bps. If the modem is not operating in 
  524. error-control or ASB mode, this is the same as the line speed. See other 
  525. CONNECT messages and CARRIER messages.
  526.  
  527. 2 - RING
  528. This result code indicates the modem has detected a ring signal. No 
  529. distinction can be made as to whether this is a voice call, a modem 
  530. call, a fax call, or other type.
  531.  
  532. 3 - NO CARRIER
  533. This result code indicates that no carrier signal was detected, or that 
  534. the signal was lost. This is the response the modem will give when no 
  535. connection is made; see CONNECT result code. The modem will also return 
  536. this message when the connection is broken, either intentionally as when 
  537. the hangup process completes, or if line difficulties break the 
  538. connection.
  539.  
  540. 4 - ERROR
  541. This result code indicates that an invalid command was issued, or that 
  542. there was an error in the command line. For example, if the command line 
  543. exceeds the character limit for your modem, this result code will be 
  544. returned. See your user documentation to determine the character limit for 
  545. your modem. This result code is also returned in response to the I1 command 
  546. requesting a ROM checksum, if the modem detects an error in the computation.
  547.  
  548. 5 - CONNECT 1200
  549. This result code indicates a connection has been established at 1200, 
  550. 1200/75 or 75/1200 bps between the modem and the DTE. If the modem is 
  551. not operating in error-control mode, this is the same as the line speed. 
  552. This result code is disabled by X0. Only CONNECT is reported.
  553.  
  554. 6 - NO DIALTONE
  555. This result code indicates that no dial tone was detected when the modem 
  556. went off hook. Dial tone detection and this result code are enabled by 
  557. X2 or X4, or the W dial modifier.
  558.  
  559. 7 - BUSY
  560. This result code indicates that the modem detected a busy signal when it 
  561. attempted to connect with the modem at the number dialed. Busy signal 
  562. detection and this result code are enabled by X3 or X4.
  563.  
  564. 8 - NO ANSWER
  565. This result code indicates no silence was detected when dialing a system 
  566. not providing a dial tone. Enabled by the @ dial modifier.
  567.  
  568. 10 - CONNECT 2400
  569. This result code indicates a connection has been established at 2400 bps 
  570. between the modem and the DTE. If the modem is not operating in error-
  571. control mode, this is the same as the line speed. This result code is 
  572. disabled by X0. Only CONNECT is reported.
  573.  
  574. 11 - CONNECT 4800
  575. This result code indicates a connection has been established at 4800 bps 
  576. between the modem and the DTE. This result code is disabled by X0.
  577.  
  578. 12 - CONNECT 9600
  579. This result code indicates a connection has been established at 9600 bps 
  580. between the modem and the DTE. This result code is disabled by X0.
  581.  
  582. 13 - CONNECT 14400
  583. This result code indicates a connection has been established at 14400 
  584. bps between the modem and the DTE. This result code is disabled by X0.
  585.  
  586. 14 - CONNECT 19200
  587. This result code indicates a connection has been established at 19200 
  588. bps between the modem and the DTE. This result code is disabled by X0.
  589.  
  590. 22 - CONNECT 1200/75
  591. This result code indicates a connection has been established at 1200 bps 
  592. when transmitting data and 75 bps when receiving data between the modem 
  593. and the DTE.
  594.  
  595. 23 - CONNECT 75/1200
  596. This result code indicates a connection has been established at 75 bps 
  597. when transmitting data and 1200 bps when receiving data between the 
  598. modem and the DTE.
  599.  
  600. 24 - CONNECT 7200
  601. This result code indicates a connection has been established at 7200 bps 
  602. between the modem and the DTE. This result code is disabled by X0.
  603.  
  604. 25 - CONNECT 12000
  605. This result code indicates a connection has been established at 12000 
  606. bps between the modem and the DTE. This result code is disabled by X0.
  607.  
  608. 28 - CONNECT 38400
  609. This result code indicates a connection has been established at 38400 
  610. bps between the modem and the DTE. This result code is disabled by X0.
  611.  
  612. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  613. 1.2.2     Negotiation Progress Messages
  614.  
  615. Hayes products report special result codes during error-control 
  616. negotiation. Whether or not these messages are displayed is selected 
  617. with the W command (not to be confused with the W dial modifier). The 
  618. factory setting is messages disabled (W0) to avoid conflict with 
  619. software programs that do not support this additional level of call 
  620. progress monitoring.
  621.  
  622. Negotiation progress messages are reported in the following order:
  623.  
  624. CARRIER
  625. PROTOCOL
  626. AUTOSTREAM
  627. COMPRESSION
  628. CONNECT
  629.  
  630. If AutoStream is not used, no message is reported.
  631.  
  632. 40 - CARRIER 300
  633. This message indicates that a carrier signal has been detected at 300 
  634. bps (modem-to-modem line speed).
  635.  
  636. 44 - CARRIER 1200/75
  637. This message indicates that a carrier signal has been detected at 1200 
  638. bps when transmitting and at 75 when receiving (modem-to-modem line 
  639. speed).
  640.  
  641. 45 - CARRIER 75/1200
  642. This message indicates that a carrier signal has been detected at 75 bps 
  643. when transmitting and at 1200 bps when receiving (modem-to-modem line 
  644. speed).
  645.  
  646. 46 - CARRIER 1200
  647. This message indicates that a carrier signal has been detected at 1200 
  648. bps (modem-to-modem line speed).
  649.  
  650. 47 - CARRIER 2400
  651. This message indicates that a carrier signal has been detected at 2400 
  652. bps (modem-to-modem line speed).
  653.  
  654. 48 - CARRIER 4800
  655. This message indicates that a carrier signal has been detected at 4800 
  656. bps (modem-to-modem line speed).
  657.  
  658. 49 - CARRIER 7200
  659. This message indicates that a carrier signal has been detected at 7200 
  660. bps (modem-to-modem line speed).
  661.  
  662. 50 - CARRIER 9600
  663. This message indicates that a carrier signal has been detected at 9600 
  664. bps (modem-to-modem line speed).
  665.  
  666. 51 - CARRIER 12000
  667. This message indicates that a carrier signal has been detected at 12000 
  668. bps (modem-to-modem line speed).
  669.  
  670. 52 - CARRIER 14400
  671. This message indicates that a carrier signal has been detected at 14400 
  672. bps (modem-to-modem line speed).
  673.  
  674. 66 - COMPRESSION: CLASS 5
  675. This message indicates that data compression using MNP Class 5 has been 
  676. negotiated for the connection.
  677.  
  678. 67 - COMPRESSION: V.42BIS
  679. This message indicates that data compression using CCITT V.42bis has 
  680. been negotiated for the connection.
  681.  
  682. 68 - COMPRESSION: ADC
  683. This message indicates that data compression using Hayes Adaptive Data 
  684. Compression has been negotiated for the connection.
  685.  
  686. 69 - COMPRESSION: NONE
  687. This message indicates that data compression was not negotiated for the 
  688. connection.
  689.  
  690. 70 - PROTOCOL: NONE
  691. This message indicates that no protocol was negotiated for the 
  692. connection. A standard asynchronous connection was made.
  693.  
  694. 71 - PROTOCOL: ERROR-CONTROL/ LAPB
  695. This message indicates that an error-control connection was negotiated 
  696. with LAPB protocol. 
  697.  
  698. 72 - PROTOCOL: ERROR-CONTROL/ LAPB/HDX
  699. This message indicates that a half-duplex error-control connection was 
  700. negotiated with LAPB protocol. 
  701.  
  702. 73 - PROTOCOL: ERROR-CONTROL/LAPB/AFT
  703. This message indicates that an error-control connection was negotiated 
  704. using the Hayes Asynchronous Framing Technique. This protocol is used 
  705. for connections between modems such as Smartmodem 1200 that do not 
  706. communicate synchronously across the telephone line. AFT enables an 
  707. error-control protocol to be used.
  708.  
  709. 74 - PROTOCOL: X.25/LAPB
  710. This message indicates that an error-control connection using the X.25 
  711. protocol was established with a carrier speed of 1200, 2400, 4800, or 
  712. 9600 bps.
  713.  
  714. 75 - PROTOCOL: X.25/LAPB/HDX
  715. This message indicates that a half-duplex error-control connection using 
  716. the X.25 protocol was established with a carrier speed of 4800 or 9600 
  717. bps.
  718.  
  719. 76 - PROTOCOL: X.25/LAPB/AFT
  720. This message indicates that an asynchronous error-control connection 
  721. using the X.25 protocol was established with a carrier speed of 1200 
  722. bps. The Hayes Asynchronous Framing Technique was used.
  723.  
  724. 77 - PROTOCOL: LAP-M
  725. This message indicates that an error-control connection using the V.42 
  726. LAPM protocol was established. 
  727.  
  728. 78 - PROTOCOL: LAP-M/HDX
  729. This message indicates that a half-duplex error-control connection using 
  730. the V.42 LAPM protocol was established. 
  731.  
  732. 79 - PROTOCOL:  LAP-M/AFT
  733. This message indicates that an asynchronous error-control connection 
  734. using the V.42 LAPM protocol was established with a carrier speed of 
  735. 1200 bps. The Hayes Asynchronous Framing Technique was used.
  736.  
  737. 80 - PROTOCOL:  ALT
  738. This message indicates that an errorge indicates that an error-control 
  739. connection using the V.42 LAPM alternative protocol was established.  
  740. This protocol is MNP Classes 2, 3, and 4 compatible.
  741.  
  742. 91 - AUTOSTREAM:        LEVEL 1
  743. This message indicates that Hayes AutoStream Level 1 has been negotiated 
  744. for the connection. This technique provides for multiplexing of multiple 
  745. virtual channels.
  746.  
  747. 92 - AUTOSTREAM:        LEVEL 2
  748. This message indicates that Hayes AutoStream Level 2 has been negotiated 
  749. for the connectionsage indicates that Hayes AutoStream Level 2 has been 
  750. negotiated for the connection. This technique provides for multiplexing 
  751. of multiple virtual channels, with transparent control of one PAD (non-
  752. simultaneous). Level 3 has been negotiated for the connection. This 
  753. technique provides for multiplexing of multiple virtual channels, with 
  754. transparent control of all PADs (simultaneous).
  755.  
  756. 93 - AUTOSREAM          LEVEL 3
  757. This message indicates that Hayes Autostream Level 3 has been negoitiated 
  758. for the connection. This technique provides for multiplexing of multiple 
  759. virtual channels, with transparent control of all PADs (simultaneous). 
  760.  
  761. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  762.  
  763. S95     Negotiation Message Options
  764.  
  765. S95 enables various result codes that indicate the sequence of events in 
  766. the establishment of an error-control connection. This register does not 
  767. affect the way in which the modem negotiates the connection; it merely 
  768. enables message options. The factory setting for this register is value 
  769. 0, no bits selected. To enable any combination of the bits, add the 
  770. value(s) to the right of the bit number and set the register to this 
  771. sum.
  772.  
  773. Note: The bit values of S95 may be set to override some of the 
  774. characteristics of the Wn command. Setting any of the S95 bits to "1" 
  775. enables the corresponding result codes regardless of the Wn command in 
  776. effect. Changing the Wn command setting does not affect the value set 
  777. for this register.
  778.  
  779. Bit   Value    Explanation
  780. ------------------------------------------------------------------------
  781. 0     1        Verbose CONNECT result code indicates the DCE speed 
  782.                (rather than DTE speed). Numeric result codes are also 
  783.                different when CONNECT reports DCE speed.
  784. 1     2        Append "/ARQ" to CONNECT result code when an 
  785.                error-control connection is made.
  786. 2     4        Add CARRIER messages
  787. 3     8        Add PROTOCOL messages
  788. 4     16       Add AUTOSTREAM messages
  789. 5     32       Add COMPRESSION messages
  790. ------------------------------------------------------------------------
  791.  
  792. For example, if you want to add the compression result code (with W1 
  793. selected), you would select bit 5 (value of 32). The command line 
  794. ATS95=32J<CR> will then enable the COMPRESSION negotiation messages.
  795.  
  796. Refer to the Wn and Xn commands for additional and related information. 
  797.  
  798.  
  799. ========================================================================
  800. APPENDIX D:  APPLICATION SUGGESTIONS
  801.  
  802. This appendix offers suggestions for developing applications software 
  803. using the Hayes Standard AT Command Set. The techniques described apply 
  804. to Hayes modems in general except where specifically indicated. Although 
  805. provided here, this information is intended for experienced programmers 
  806. who want assistance in modem application development.
  807.  
  808. ************************************************************************
  809. D.1  Modem Identification
  810.  
  811. The initial concern for most communications software is modem 
  812. identification. Before the software determines the type of modem (e.g., 
  813. is it a Hayes modem, a high-speed modem, what features does it support -
  814. error-control or compression?). By limiting the AT command controller 
  815. portion of the software to work with a known set of modems, you can 
  816. limit the complexity of your software.
  817.  
  818. Because the type of modem that will be present, certain assumptions can 
  819. be made regarding modem characteristics, such as maximum transmission 
  820. rate, support of AT commands or specific commands such as L or 
  821. X. If a more general application is being designed for an environment 
  822. about which assumptions cannot be made regarding type or brand of modem 
  823. that might be used, the software's first task should be to identify the 
  824. modem.
  825.  
  826. The I0 and I4 command options make this process simple. In the initial 
  827. versions of Smartmodem 1200, I0 returned the three digit response: 120. 
  828. Since then, responses have been extended for several groups identifying 
  829. modem supporting 2400 bps, 9600 bps, and other products. The I0 response 
  830. simply indicates the speed category of the modem.
  831.  
  832. The result of the I0 command is a number which identifies the category 
  833. of modem product. Some unique I0 values can be used to identify a unique 
  834. product which has specific behaviors. 960, for example, identifies a 
  835. Hayes product capable of 9600 bps, which has additional commands and 
  836. behaviors.
  837.  
  838. The I4 command provides a reliable means of communicating 
  839. specific features and modulation protocols to software. The responses to 
  840. the I4 command are strings delimited by <CR> and beginning with a 
  841. lowercase letter and typically followed by a hex-character bit-map. The 
  842. I0 and I4 responses currently defined are detailed in the description of 
  843. the I4 command in Chapter 1.  The tables show the decoding of the hex-
  844. map returned in the "a", and "b" bit-mapped strings. If I4 is used to 
  845. identify features of the modem, consider that new result strings are 
  846. periodically defined that may be returned in addition to those expected. 
  847. Fields once designated as "reserved" that held a zero may now have values 
  848. assigned. The strings themselves may also be of different lengths than 
  849. previously implemented.
  850.  
  851. In spite of the modifications to this command necessary to be current 
  852. with new modems, the I4 command is the best way for software to 
  853. determine the modem type and capability, if the guidelines below are 
  854. considered:
  855.  
  856. *  I0 or I4 commands should be issued at 1200 bps. All Hayes products 
  857. (including the Smartmodem 300) respond to AT commands at 1200 bps. Most 
  858. other brands also respond at 1200 bps. You can switch to a higher 
  859. transmission rate once the modem has been identified.
  860.  
  861. *  Result codes should be parsed as strings surrounded by <CR><LF>. The 
  862. string will begin with a lower-case letter followed by up to 39 
  863. additional characters.
  864.  
  865. *  After all result strings have been sent, an OK result is returned 
  866. that obeys the V and Q command settings.
  867.  
  868. *  ERROR, OK, or a numeric result in response to the I4 command should 
  869. be expected. These results may be returned by products shipped before 
  870. the I4 command was introduced, or by non-Hayes products.
  871.  
  872. *  The length of the strings may be different than anticipated. If 
  873. shorter than expected, empty positions should be presumed zeros. If 
  874. longer than expected, extra characters should be ignored.
  875.  
  876. *  Some non-Hayes brand modems return unpredictable results in response 
  877. to I0 or I4 commands. One brand of modem actually responds with its 
  878. configuration when the I4 command is sent.
  879.  
  880. An example I4 command and response is shown below:
  881.  
  882.                      AT E0 V1 Q0 S0=0 I4 <CR>
  883. response:
  884.  
  885.      <CR><LF>a087840C004424<CR><LF> 
  886.      <CR><LF>bF60410000<CR><LF> 
  887.      <CR><LF>cUS<CR><LF> J
  888.      <CR><LF>m0000000001001FFFF<CR><LF> 
  889.      <CR><LF>OK<CR><LF> 
  890.  
  891. Note: Each I4 result is surrounded by <CR><LF>; not all responses are 
  892. hex-strings; and some responses may not be expected at all.
  893.  
  894. ************************************************************************
  895. D.2  Result Code Recognition
  896.  
  897. Modems that are equivalent to Hayes modems support verbose and numeric 
  898. forms of result codes. Unless echo may be a problem and you will be 
  899. installing the controller in a limited-growth environment, verbose 
  900. results rather than numeric results are preferred. Numeric result codes 
  901. were originally intended to make it easier for software to control the 
  902. modem, but there are two primary reasons they should not be used:
  903.  
  904. Software can be confused by a command echo. For example, if the 
  905. following command were sent with echo on (E1) and numeric results (V0) 
  906. on:
  907.  
  908.                        AT ... S9=20 <CR>
  909.  
  910. The resulting data, echoed by the modem, would be followed by the 
  911. numeric result code zero, meaning OK:
  912.  
  913.                       AT ... S9=20<CR>0 <CR>
  914.  
  915. Software may become confused by seeing a 0<CR> result which is actually 
  916. part of the command echo, then another 0<CR> which is the numeric 
  917. result. A program can become unsynchronized with the command processor 
  918. in the modem.
  919.  
  920. Turning off echo mode (E0) in the initial setup string would solve this 
  921. problem; however, do not end that command with any digits (simply E).
  922.  
  923. Another shortcoming of numeric results is that the software must 
  924. anticipate all possible responses. This requires updating controller 
  925. software whenever new result codes are added. For example, suppose a 
  926. CONNECT 115200 result were added with a numeric value of 31. If verbose 
  927. results were used instead, and the controller directed to interpret the 
  928. number after the CONNECT result as simply the connection speed in bits 
  929. per second, no changes to the driver are necessitated by the new result 
  930. code. If, however, numeric result codes were used, the result code 31 
  931. must be added to the table, and the controller modified to interpret it 
  932. appropriately.
  933.  
  934. As characters are received, they should be processed through a state 
  935. machine providing the functionality of the following one. This state 
  936. machine recognizes strings surrounded by <CR><LF> characters and stores 
  937. the string in a character array. <CR><LF> are defined by S3 and S4.
  938.  
  939. Sample State Machine
  940. Initialize with: state = 1 ;
  941.  
  942. ch = <next character from the input>
  943. switch( state )
  944. {
  945.      case 1:     /*-- Scanning for leading CR --*/
  946.                if( ch == CR ) state = 2 ;
  947.                i = 0 ;
  948.                break ;
  949.      case 2:     /*-- Scanning for leading LF --*/
  950.                if( ch == LF ) state = 3 ;
  951.                else if( ch == CR ) state = 2 ;
  952.                else state = 1 ;
  953.                break ;
  954.      case 3:     /*-- Buffer result, watch for trailing CR --*/
  955.                if( ch == CR ) state = 4 ;
  956.                else buf[ i++ ] = ch ;
  957.                if( i > LIMIT ) state = 1 ;
  958.                break ;
  959.      case 4:     /*-- Scanning for trailing LF --*/
  960.                if( ch == LF ) state = 5 ;
  961.                else if( ch == CR ) state = 2 ;
  962.                else state = 1 ;
  963.                break ;
  964. }
  965. if( state == 5 )
  966. {
  967.      buf[ i ] = 0 ; /* Null terminate buffer */
  968.      <process result in 'buf'>
  969.      state = 1 ;
  970. }
  971.  
  972. This state machine can be imbedded within a loop that reads all received 
  973. data one character at a time, checks for a timeout, and also checks for 
  974. user abort. Once a result is recognized, that loop can be exited or 
  975. continued if additional results are expected.
  976.  
  977. Once a result code string is returned, it can be compared against the 
  978. known result code strings. Some strings may incorporate wild-card 
  979. suffixes. For example CONNECT followed by any numeric value indicates a 
  980. successful connection at the indicated transmission rate. Even if a 
  981. result such as CONNECT 38400 is not anticipated, if the controller has 
  982. been coded for wild-card recognition, the controller will be capable of 
  983. interpreting such responses correctly. This practice also facilitates 
  984. interpretation of connection failed messages that are preceded by NO 
  985. followed by any other character string such as DIALTONE, CARRIER, or 
  986. ANSWER.
  987.  
  988. ************************************************************************
  989. D.3  Modem Preparation
  990.  
  991. Once the modem has been identified, the controller can continue to 
  992. program any registers or user-defined values into the modem necessary 
  993. prior to initiating the connection process. Typically, the setup 
  994. operation is separated from the connection processing because it is 
  995. performed independently of whether the call establishment will be in the 
  996. originating or answering mode.
  997.  
  998. Setup commands can be issued at the highest transmission rate the modem 
  999. supports as determined from the identification process or it may be 
  1000. fixed at a certain value if the modem is not identified.
  1001.  
  1002. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1003. D.3.1  Reset
  1004.  
  1005. Before issuing any other commands to the modem, it is advisable to issue 
  1006. a Z or &F command to the modem before the identification or setup 
  1007. process. No specific response should be anticipated. The modem may be 
  1008. set up to return numeric, or no result codes. If a reset will be used, 
  1009. the following points should be considered:
  1010.  
  1011. *  Even if a recognizable result within 2.6 seconds, the program should 
  1012. continue. (Some modems do a lengthy reset process before responding with 
  1013. a result; others may be in Q1 or V0 mode.)
  1014.  
  1015. *  Following an OK result, an additional 600ms delay should be imposed. 
  1016. Some modems will respond with an OK then do lengthy reset processing, in 
  1017. which case they are unable to accept additional commands.
  1018.  
  1019. After the modem is reset, the first setup string (e.g., verbose rather 
  1020. than numeric result codes) should be issued, then the identification 
  1021. command.
  1022.  
  1023. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1024. D.3.2  Setup
  1025.  
  1026. Software should generally provide some modem setup. However, the 
  1027. software can be written to rely on modem configuration via a stored 
  1028. profile recalled on reset, or  by DIP switches set depending on the 
  1029. product. In this case, any unique settings must have been set up prior 
  1030. to running the software, and all the program does is send the Z command 
  1031. to recall the desired profile. Even more basically, software can assume 
  1032. the modem is in the power-up state. However, unless the software will be 
  1033. used within a very predictable environment, these assumptions may result 
  1034. in failures with the controller software.
  1035.  
  1036. Some commands will always be overridden by the controller in order to 
  1037. ensure its proper functioning. Other command options should either 
  1038. default to the factory setting, or simply act as the "transfer agent" 
  1039. for the commands specified by the user. Menus and dialogs can be 
  1040. provided to prompt the user for specific activities; the program can 
  1041. then interpret these requests and configure the modem accordingly, as 
  1042. Hayes Smartcom products do, or provide the user opportunity to enter AT 
  1043. command strings.
  1044.  
  1045. Commands frequently set by a modem controller:
  1046.  
  1047. E0         Turn off echo mode to avoid having command echoes pass 
  1048.            through the result code scanner.
  1049.  
  1050. &F         Recall the factory profile.
  1051.  
  1052. Q1         Enable result codes to ensure that commands are being 
  1053.            processed, and to synchronize with the modem command 
  1054.            processor (except for synchronous communications where result 
  1055.            codes may cause the DTE confusion).
  1056.  
  1057. V0 or V1   Use either numeric result codes or verbose (recommended) 
  1058.            result codes.
  1059.  
  1060. S0=0       Disable auto-answer during the setup process to avoid 
  1061.            inadvertent disruption by an incoming call.
  1062.  
  1063. H0         Ensure modem is on hook before continuing to the answer or 
  1064.            originate process.
  1065.  
  1066. S12=10     Set the escape sequence guard time to 200ms to hasten the 
  1067.            escape for hang-up process. Also reduces the probability of 
  1068.            inadvertent user escapes.
  1069.  
  1070. S2=*       Change the escape sequence character for two reasons: To 
  1071.            avoid inadvertent user escapes, and to provide different 
  1072.            escape sequence characters for answer and originate ends. 
  1073.            This prevents inadvertent escaping when data is echoed.
  1074.  
  1075. S4=*       Modify the linefeed character to make the <CR><LF>NO 
  1076.            CARRIER<CR><LF> result code more unique if you scan for it
  1077.            to detect carrier loss.
  1078.  
  1079. S95=60     Enables the result codes which will provide the maximum 
  1080.            amount of information about the connection when it is 
  1081.            established.
  1082.  
  1083. Two typical setup sequences using these recommendations are shown below:
  1084.  
  1085. Recommendation for software design based on using pre-existing user 
  1086. settings:
  1087.               AT E Q V S0=0 H S12=10 S2=28 S4=31 S95=60 <CR>
  1088.  
  1089. Recommendation for software design based on starting from a known 
  1090. factory setting: 
  1091.               AT &F S2=28 S4=31 S12=10 S95=60
  1092.  
  1093. Note: Where the zero suffix is used, it may be omitted from a command. 
  1094. Spaces are shown above for readability, but the use of spaces between 
  1095. commands is not recommended. 
  1096.  
  1097. Once this setup command has been sent, and the OK response returned, the 
  1098. controller can continue to the originate or answer processing.
  1099.  
  1100. If user-programmed settings are included in additional setup strings, or 
  1101. the user is permitted to enter AT setup strings, the software should 
  1102. anticipate ERROR result codes. If an ERROR is returned in response to 
  1103. such a command, the result does not have to be reported to the user, but 
  1104. the controller should not be prevented from continuing in either case. 
  1105. Many times a connection can be made even though some setting is in error 
  1106. or is inappropriate for the class of modem being addressed.
  1107.  
  1108. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1109. D.3.3  Establishing the Desired Connection and Fallback Strategy 
  1110.        (S36 Developers' Tips)
  1111.  
  1112. S36 determines which fallback action will occur if the protocols and 
  1113. procedures set by S46 and S48 do not produce a LAP-based (LAPB) error-
  1114. controlled connection.
  1115.  
  1116. The optimum fallback control strategy depends on which Hayes error-
  1117. control modem you have. The fallback behavior is determined by S36, S46, 
  1118. S48, and &Q5.
  1119.  
  1120. There have been two improvements in the V-series, OPTIMA and ACCURA EC 
  1121. modems that affect S36: The first added &Q6 Asynchronous Speed Buffering
  1122. (ASB); ASB provides the same fixed speed DTE interface and local flow control 
  1123. as in the error control mode but without the error control or remote 
  1124. flow control. The second improvement added V.42 with its Alternate 
  1125. Protocol (MNP).
  1126.  
  1127. Previously, S36 only consisted of one bit, Bit 0, 
  1128. which permitted the user to decide whether the modem would hang up or 
  1129. not if it did not succeed in negotiating an error-controlled connection. 
  1130. The factory default for S36 was 1, which meant fall back to direct async 
  1131. rather than hang up if an error control protocol is not established in 
  1132. &Q5 mode.
  1133.  
  1134. When &Q6 (ASB) was added, a fall back option for &Q5 mode, which can be 
  1135. controlled with S36, was also added. If S36 Bit 1 is set, and bit 0 is 
  1136. also set, the modem will fall back to ASB instead of direct async if no 
  1137. error control protocol is established in &Q5 mode. The factory default 
  1138. for S36 remained 1.
  1139.  
  1140. When V.42 was added, it added another fall back option, MNP, to S36. If 
  1141. S36 Bit 2 is set, then MNP will be attempted if the primary protocol 
  1142. selected in S48 is not established. Bit 2 is evaluated before Bits 0, 
  1143. then Bit 1. If MNP is established as the protocol, then Bits 0 and 1 are 
  1144. ignored. The factory default became 5 and later was changed to 7 to take 
  1145. more advantage of ASB.
  1146.  
  1147. Now that we know that there are three versions of S36, we may need a way 
  1148. to tell which version our software is controlling. First, verify that it 
  1149. is a Hayes error-control modem. This is done by issuing an I4 command 
  1150. and looking for the existence of a "b-string". A b-string begins with a 
  1151. lower case letter "b" and is followed by several upper case letters or 
  1152. numbers forming a hex value.
  1153.  
  1154. The easiest way for software to identify whether a Hayes modem 
  1155. supports Asynchronous Speed Buffering (also known as ASB, Buffered 
  1156. Async, or Normal) is to issue the following AT command,  AT &Q6 &Q5 
  1157. <CR>. If the result code is OK then &Q6 is supported, and ASB is also 
  1158. supported as a fall back. If the result code is ERROR, then &Q6 is not 
  1159. supported. If this is the case, then software should be prepared to fall 
  1160. back to a direct async connection.
  1161.  
  1162. The easiest way for software to identify whether a Hayes modem 
  1163. supports V.42 (and MNP) is to decode the first character after the 
  1164. leading "b" in the b-string of the I4 ID command response. The 
  1165. characters following the "b" in that line are "ASCII-hex" (0-9, A-F), 
  1166. which decode into 4 bits of ID code (3-0).  If Bit 3 is set, then MNP is 
  1167. supported; Bit 2 is V.42.
  1168.  
  1169. Armed with the knowledge of which S36 bits are supported, the software 
  1170. may now safely configure the modem and properly anticipate the fall-back 
  1171. action.
  1172.  
  1173. It should be safe to set S36 bit 2 to enable V.42 (and MNP) even if 
  1174. those protocols are not supported in the modem.
  1175.  
  1176. If the modem does not support ASB, then software should be prepared to 
  1177. follow the CONNECT XXXXX speed result code and change the DTE port speed 
  1178. to match the indicated line speed of the direct connection when no error 
  1179. controlled connection was negotiated.
  1180.  
  1181. If software will not change port speeds in response to the CONNECT 
  1182. message, then when software has identified a 'pre-ASB' modem, 
  1183. it should set S36 to 0 or 4 so that if no protocol is negotiated, the 
  1184. modem will hang up.
  1185.  
  1186. The following table shows the order in which the bits of S36 are 
  1187. evaluated: (Remember, these steps only occur after the S46/S48 
  1188. selections have failed to make a LAPBased error controlled connection in 
  1189. &Q5 mode.)
  1190.  
  1191. ------------------------------------------------------------------------
  1192. S36      Bit 7-3=0       reserved 
  1193. First    Bit 2 (4)       If set, means try MNP protocol; reset means 
  1194.                          don't use MNP. 
  1195. Third    Bit 1 (2)       If set, means fall back to ASB; reset means 
  1196.                          direct async. 
  1197. Second   Bit 0 (1)       If set, means fall back based on Bit 1;
  1198.                          reset means hang up.
  1199. ------------------------------------------------------------------------
  1200.          
  1201. The following table shows the meaning of each setting:
  1202.  
  1203. ------------------------------------------------------------------------
  1204. S36=7   Try MNP, then fall back to ASB. 
  1205. S36=6   Try MNP, then hang up. 
  1206. S36=5   Try MNP, then fall back to direct async. 
  1207. S36=4   Try MNP, then hang up. 
  1208. S36=3   Don't try MNP; fall back to ASB. 
  1209. S36=2   Don't try MNP; hang up. 
  1210. S36=1   Don't try MNP; fall back to direct async. 
  1211. S36=0   Don't try MNP; hang up.
  1212. ------------------------------------------------------------------------
  1213.  
  1214. There are three types of fallback stratagies which Hayes products use.
  1215.  
  1216. Type 1: Hayes Modem Operation in &Q5 Communications Mode
  1217. Applies to V-series Smartmodem 2400 up to and including Version 1.3 and 
  1218. V-series Smartmodem 9600 up to and including Version 1.4.
  1219.  
  1220. Type 2: Hayes Modem Operation in &Q5 Communications Mode
  1221. Applies to V-series Smartmodem 2400 Version 1.4 and V-series Smartmodem 
  1222. 9600 Versions 1.5 and 1.6.
  1223.  
  1224. Type 3: Hayes Modem Operation in &Q5 Communications Mode
  1225. Applies to all V-series products newer than Types 1 and 2 and all OPTIMA 
  1226. and ACCURA EC products.
  1227.  
  1228. ------------------------------------------------------------------------
  1229.                ATI3 Response contains...     
  1230.                V-SERIES SMARTMODEM 2400    V-SERIES SMARTMODEM 9600
  1231. Type 1         04-00005-10                 04-00015-10
  1232.                04-00005-11                 04-00015-11
  1233.                04-00005-12                 04-00015-12
  1234.                04-00005-13                 04-00015-13
  1235.                                            04-00015-14
  1236. Type 2         04-00005-14                 04-00015-15
  1237.                                            04-00015-16
  1238. Type 3         Does not contain any        Does not contain any
  1239.                of the above numbers        any of the above numbers
  1240. ------------------------------------------------------------------------
  1241.  
  1242. ************************************************************************
  1243. D.4  Connect Processing
  1244.  
  1245. Once the setup operation has been completed, the commands to establish 
  1246. the connection can be issued. The instruction can be either to originate 
  1247. (using the D command), or to answer (using the A or S0 commands).
  1248.  
  1249. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1250. D.4.1  Originating a Call
  1251.  
  1252. If the D command is issued with the desired phone number, several 
  1253. possible result codes can be returned. The list below outlines some 
  1254. results to expect:
  1255.  
  1256. Result Code        Meaning
  1257. ------------------------------------------------------------------------
  1258. NO CARRIER         Connection failed
  1259. NO ANSWER          No response to '@' dial modifier
  1260. NO DIALTONE        No dial tone in X4 mode
  1261. NO ____            Connection failed for some other reason
  1262. BUSY               Busy signal detected
  1263. CONNECT ____       Connection successful; you may need to change DTE 
  1264.                    speed to the indicated baud rate. (See Wn and S95)
  1265. CARRIER ____       * DCE carrier speed. (See Wn and S95)
  1266. PROTOCOL: ____     * Error-correction protocol being used by the modems. 
  1267.                    (See Wn and S95)
  1268. COMPRESSION:____   Compression technique in use by modems. (See Wn 
  1269.                    and S95)
  1270. AUTOSTREAM         Autostream technique in use by modems if selected by 
  1271.                    user. (See Wn and S95)
  1272. ------------------------------------------------------------------------
  1273.  
  1274. Ignore other responses, but continue to wait for CONNECT ___, BUSY, or 
  1275. NO ___ responses. The CARRIER and PROTOCOL results are intermediate 
  1276. results and precede either a CONNECT ____ or NO ____ result. These 
  1277. results are only returned by Hayes modems when configured to use an 
  1278. error-correcting protocol.
  1279.  
  1280. If you recognize any numeric value for the baud rate after the CONNECT 
  1281. result, you will have a much more robust controller able to handle many 
  1282. situations. You can use the PROTOCOL result to determine if the flow 
  1283. control requested by the &K command is in effect.
  1284.  
  1285. Note: If you want to manually dial a call and then have the modem connect, 
  1286. enter the command string ATX1D (X1 disables dial tone detection) when you 
  1287. hear the dial tone. 
  1288.  
  1289. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1290. D.4.2  Answering a Call
  1291.  
  1292. The simplest technique for answering an incoming call is to set S0 and 
  1293. wait for a CONNECT ___ result. You may get several RING results, and 
  1294. possibly a NO CARRIER result if the caller hangs up before connecting. 
  1295. These results should not cause your controller to abort. Continue to 
  1296. wait for a CONNECT result code.
  1297.  
  1298. If you set S0, you may want to set it back to zero after your controller 
  1299. finishes the call to prevent inadvertent answering when your software is 
  1300. not running. By setting S0 to the number of rings you desire before the 
  1301. modem answers, you utilize the ring detection technology already built 
  1302. into the modem.
  1303.  
  1304. You should not use the A command to answer after counting RING results 
  1305. because the command may collide with another RING result from the modem 
  1306. and be missed. The RING results may be generated in pairs depending on 
  1307. the ringing cadence of the phone system.
  1308.  
  1309. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1310. D.4.3  Using the CD Line
  1311.  
  1312. Monitoring the Carrier Detect (CD) line of the RS-232 interface is 
  1313. another technique for carrier detection in answer or originate mode. 
  1314. This assumes that &C1 or the corresponding DIP-switch has been set and 
  1315. the cable is wired properly. Both are risky assumptions. You will have a 
  1316. more robust controller if you use result code scanning rather than the 
  1317. RS-232 lines.
  1318.  
  1319. If you use CD, you do not know when the modem has given up waiting for 
  1320. the carrier, or why. If the line is busy, you may want to re-try the 
  1321. dial operation. If there is no dial tone, the user needs to know this.
  1322.  
  1323. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1324. D.4.4  Aborting a Connect Request
  1325.  
  1326. Once the D or S0 command has been issued, the modem goes off hook (or 
  1327. may be off hook for S0) and it must be put back on hook (hangPup) before 
  1328. the abort is completed. To abort an in-progress connect command, send 
  1329. any character to the modem. This will typically result in a NO CARRIER 
  1330. response. The result code scanner should be called after the abort 
  1331. character is sent to prevent additional commands from being sent before 
  1332. the controller and the modem are again in sync.
  1333.  
  1334. Smartcom products send AT<CR> to abort an in-progress connect command. 
  1335. This elicits a result code regardless of whether the modem were off-hook 
  1336. or not. If the modem was off-hook attempting to connect, this will abort 
  1337. the connect operation and return NO CARRIER. If the modem was on-hook in 
  1338. command mode, this simply returns <CR><LF>OK<CR><LF>.
  1339.  
  1340. ************************************************************************
  1341. D.5  Carrier Loss Detection
  1342.  
  1343. You want your application to be able to detect when the carrier has been 
  1344. lost so you can determine when the connection is complete. You might be 
  1345. unable to put this part of the code in your controller software, since 
  1346. the controller is typically running only during the connect or hang-up 
  1347. process. Once the application has detected the carrier loss event, it 
  1348. can call the modem controller and restore the modem settings.
  1349.  
  1350. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1351. D.5.1  Using the CD line
  1352.  
  1353. If you are confident of the communications environment and cabling 
  1354. requirements, and have access to the RS-232 signal status, then 
  1355. monitoring the CD line is the easiest carrier loss detection method to 
  1356. implement. This requires &C1 to be programmed at setup time, or be 
  1357. stored in the modem as the value recalled on reset or power-up.
  1358.  
  1359. However, this is the most restrictive and risky choice. It requires a 
  1360. properly wired cable and support of &C1 by the modem's command set or 
  1361. proper DIP-switch settings.
  1362.  
  1363. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1364. D.5.2  Scanning the Incoming Data Stream
  1365.  
  1366. In cases where you  cannot depend on 100% Hayes compatibility or want to 
  1367. be independent from the cable wiring, then scanning for the NO CARRIER 
  1368. result code is more reliable. It is also more complex to implement.
  1369.  
  1370. Typically, at the low-level of the program all received data is 
  1371. retrieved through one subroutine. This subroutine can be augmented or 
  1372. layered to provide the service needed. As data passes through, the last 
  1373. fourteen characters are buffered, typically in a circular buffer. If 
  1374. more data passes in each call, only the last fourteen need to be copied. 
  1375. At a time when the processor is free, such as after 100 ms of idle time 
  1376. or the receive routine has returned no data for 30 to 100 calls, then 
  1377. the buffer is compared against the <CR><LF>NO CARRIER<CR><LF> result 
  1378. code. If a match is found, the carrier lost event is triggered.
  1379.  
  1380. By only checking when there is idle time, or after no data has been 
  1381. received for a while, you reduce the CPU overhead and ensure that the 
  1382. modem is not falsely triggered when the string is imbedded in an actual 
  1383. data stream.
  1384.  
  1385. You can also modify the linefeed character by using S4 to a different 
  1386. value such as S4=31 to make the result code sequence more unique. This 
  1387. action, however, affects other result codes generated by the modem.
  1388.  
  1389. ************************************************************************
  1390. D.6  Escape and Hang Up
  1391.  
  1392. When your controller has been instructed to terminate the connection, 
  1393. you must put the modem back in command state and issue the hang-up (H) 
  1394. command. In addition to hanging-up, you will also want to restore 
  1395. settings you changed to their factory-set values, or issue an ATZ<CR> to 
  1396. undo the effects of your changes. In any case, restoration of the modem 
  1397. settings is necessary even if the connection was terminated due to loss 
  1398. of carrier.
  1399.  
  1400. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1401. D.6.1  Escaping the Modem to Command State
  1402.  
  1403. To escape the modem, the controller must first delay the escape sequence 
  1404. guard time (specified by S12), then issue the escape sequence character 
  1405. three times (specified by S2); then wait for an OK result. Waiting for 
  1406. the result also enforces the required guard time after the escape 
  1407. sequence. Once the OK result is received, the modem has entered command 
  1408. state. The controller can then hang up and restore the modem.
  1409.  
  1410. The controller software must be sure to wait the required guard time 
  1411. before sending the escape sequence characters. Your controller may have 
  1412. been called just after data was transmitted and, without the delay, your 
  1413. characters will just be sent without triggering the escape sequence 
  1414. recognition process. It is important that the serial transmitter be 
  1415. permitted to be idle for the escape sequence guard time, plus a few 
  1416. extra milliseconds to allow for error, before sending characters.
  1417.  
  1418. For example, if  S12=10, a delay of at least 200 milliseconds is 
  1419. required before sending the escape sequence characters. After sending 
  1420. the escape sequence characters, the OK result will be received after 
  1421. another 200 millisecond wait. This completes the escape sequence process 
  1422. in slightly over 400 milliseconds. If S12=50 (factory setting) is used, 
  1423. one full second must pass before the characters can be sent, then 
  1424. another second delay must transpire prior to the OK result. This 
  1425. completes the process in slightly over two seconds. For this reason, it 
  1426. is recommended that S12=10 be issued to speed up this process.
  1427.  
  1428. A delay slightly longer than that stored in S12 should be used to allow 
  1429. for errors in the system clock as well as in the modem clock. 100ms is 
  1430. an adequate safety margin.
  1431.  
  1432. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1433. D.6.2  Using DTR to Escape or Hang Up
  1434.  
  1435. The DTR RS-232 signal can be used to escape the modem to command state, 
  1436. or to reset the modem depending on the &D command set or DIP-switch 
  1437. settings. This also requires the cable to be properly wired. Unless the 
  1438. software will operate in a highly-controlled environment, this technique 
  1439. is discouraged over using the escape sequence process because of the 
  1440. requirements to make it function properly. Leaving a call connected 
  1441. simply because the cable was not properly wired can be potentially 
  1442. expensive. The escape sequence is reliable in all environments if it is 
  1443. properly utilized.
  1444.  
  1445. ************************************************************************
  1446. D.7  Modem Re-configuration
  1447.  
  1448. When a call has been completed, a "clean-up" command should be issued to 
  1449. return the modem a more known configuration. For example, if verbose 
  1450. result codes were selected when the modem was reset, and the controller 
  1451. selected numeric result codes, on completing the session, the controller 
  1452. should reset the modem to re-select verbose result codes. In the same 
  1453. way, if the linefeed character were changed to suit the software or 
  1454. environment, the character should be set to its former value. Any other 
  1455. command options that were modified, should be restored to their factory-
  1456. set values.
  1457.  
  1458. The minimum the controller should do when through with the modem is 
  1459. issue a Z command option to ensure the modem is restored to its power-up 
  1460. state.
  1461.  
  1462. ************************************************************************
  1463. D.8  Timing Considerations
  1464.  
  1465. A modem controller inherently has a sense of time. Usually all that is 
  1466. needed to utilize the timing part of the controller is access to a time 
  1467. reference. For example, the number of milliseconds since power-up or 
  1468. program launch, or a "system tick" value can be used. 
  1469.  
  1470. Under DOS, the INT 1C timer tick produces an interrupt every 55 
  1471. milliseconds. An ISR can be installed on this interrupt to add 55 to a 
  1472. long integer every time it is called. This will provide a millisecond 
  1473. counter.
  1474.  
  1475. On the Macintosh, the "Tick Count" function will return the number of 
  1476. vertical-retrace ticks since computer power-up. Each tick represents 
  1477. 1/60 of a second.
  1478.  
  1479. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1480. D.8.1  Programming for Time
  1481.  
  1482. The time value is used to determine relative time. For example, if a 
  1483. loop should be executed for only 2 seconds it could be coded as:
  1484.  
  1485. timeout = Tick Count( ) + 120 ; /* 60 tics per second = 2 seconds */
  1486. do
  1487. {
  1488.      got_one = Check_Result( ) ;
  1489. }
  1490. while( ( ! got_one ) && ( SystemTick( ) < timeout ) ) ;
  1491.  
  1492. This code fragment continues to call the Check_Result function until it 
  1493. returns a true value, or until two seconds have elapsed.
  1494.  
  1495. This technique is independent of processor speed. A faster processor may 
  1496. make thousands of trips through the loop, where a slower one would only 
  1497. make a few hundred. Any anticipated result code would arrive within that 
  1498. two-second real-time window.
  1499.  
  1500. Care should be given to considering when to start the timing loop. If an 
  1501. AT command string is sent, then a loop executed, the time interval may 
  1502. also include the time required to send the AT command (if data is 
  1503. buffered and sent by an interrupt service routine).
  1504.  
  1505. At 300 bps, where each character takes 33ms just to transmit (10/300), a 
  1506. 40 character AT command would take over a second to transmit. This means 
  1507. a two second loop spends more than half of its time waiting for the AT 
  1508. command process to complete, leaving only a fraction of a second for the 
  1509. modem to respond with the result (again at 33ms per character).
  1510.  
  1511. One way to avoid this is to wait until all data has been transmitted by 
  1512. an ISR before entering the result code scan loop. Alternatively, more 
  1513. time can be provided for loops to process results. Another option is to 
  1514. measure idle time rather then elapsed time.
  1515.  
  1516. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1517. D.8.2  When to Consider Time
  1518.  
  1519. The use of timing varies from command to command and operation to 
  1520. operation. Some commands take longer to execute. The guidelines below 
  1521. can be used to determine the best amount of time to wait.
  1522.  
  1523. *  For the Z command, wait two seconds for a response, then wait an 
  1524. additional 600 ms, whether a response were received or not.
  1525.  
  1526. *  For general setup commands, wait two seconds for the response.
  1527.  
  1528. *  For the hang-up command (H), wait up to 20 seconds for a response. 
  1529. Some modems may take longer to hang-up if data buffered within the 
  1530. modem is still waiting to be transmitted and acknowledged. This time is 
  1531. controlled by S38.
  1532.  
  1533. *  For dial commands (D or O) wait at least one minute or more. Values 
  1534. set for carrier detect time, tone versus pulse dialing, commas in the 
  1535. phone number, all can take additional time.
  1536.  
  1537. If the software times out, the modem may, in fact, not be connected to 
  1538. the computer, disconnected, or turned off. If this is the case, enforce 
  1539. a reasonable timeout to the first setup or identification command. That 
  1540. will determine whether a modem is attached and functioning.
  1541.  
  1542. A timeout may also occur when the software receives a result code it 
  1543. does not recognize. The software may continue to wait until it receives 
  1544. a code it does recognize. If this is the case, the controller should 
  1545. proceed as if an ERROR response were received. The only instance in 
  1546. which it is not prudent to continue is when a connect (D, A, or S0) 
  1547. command was issued.
  1548.  
  1549. Before implementing a timeout, the advantages, if any, to this level of 
  1550. program interruption should be considered. For example, if the program 
  1551. times out from a dial command in one minute when it may take two minutes 
  1552. to complete the call, the timeout defeats the purpose of the command. 
  1553. The modem always responds with a result code, whether BUSY, NO CARRIER, 
  1554. or CONNECT, after some length of time.
  1555.  
  1556. Idle time is the time since data was received. Elapsed time is the time 
  1557. since the software started looking for the result. Idle time can be 
  1558. measured by resetting the timeout clock each time the software receives 
  1559. a character. Rather than exiting the loop after two seconds of elapsed 
  1560. time, the logic changes to exit after no further data has been received 
  1561. for two seconds.
  1562.  
  1563. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1564. D.8.3   Recovering when "Out Of Sync"
  1565.  
  1566. Another disadvantage of timing out is that an early timeout can put the 
  1567. software out of sync with the modem command processor. The controller 
  1568. may be interpreting results sent in response to previous commands as the 
  1569. response to later commands. To avoid this condition, any pending receive 
  1570. data should be flushed before the next command is issued.
  1571.  
  1572. ************************************************************************
  1573. D.9  Transparent XON/XOFF Local Flow Control
  1574.  
  1575. The use of flow control during error-control modem connections is 
  1576. essential to avoid loss of data during error-control protocol 
  1577. retransmissions. Use of flow control allows the DTE-DCE interface to be 
  1578. run faster than the line speed, permitting the additional benefit of 
  1579. increased throughput due to stripping of start and stop bits by the 
  1580. error control protocol and data compression techniques such as V.42bis. 
  1581. When the interface is run at high speed, data loss due to modem buffer 
  1582. overrun is quite likely to occur if flow control is absent or not 
  1583. functioning properly.
  1584.  
  1585. Hayes modems support the industry standard "RTS/CTS" hardware 
  1586. flow control (invoked by the &K3 command) and "XON/XOFF" character-based 
  1587. flow control (&K4) schemes. However, in some situations, it is not 
  1588. possible to use either of these. For example, hardware flow control 
  1589. cannot be used if the DTE serial port does not support the RTS and/or 
  1590. CTS hardware signals, if corresponding conductors are not present in the 
  1591. interface cable, or if intermediate equipment does not properly transfer 
  1592. the RTS and CTS signals. XON/XOFF flow control cannot be used if the XON 
  1593. and XOFF characters appear in the user data or in the control 
  1594. information associated with the file transfer protocol in use, since 
  1595. this would interfere with the use of these characters for flow control, 
  1596. resulting in failure of data transfer and possibly locking up the 
  1597. interface.
  1598.  
  1599. Hayes addressed these problems in the design of V-series, OPTIMA and 
  1600. ACCURA EC modems. Desiring to provide a complete solution for all users, 
  1601. Hayes provided a third flow control scheme, which accommodates systems 
  1602. which cannot use RTS/CTS but which must transfer data containing the 
  1603. XON and XOFF characters. This scheme, known as Transparent XON/XOFF 
  1604. Local Flow Control (invoked by the &K5 command), uses only the Transmit 
  1605. Data and Receive Data circuits, yet provides for the transfer of all 
  1606. 256 possible 8-bit characters over the interface without interfering 
  1607. with the flow control scheme.
  1608.  
  1609. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1610. D.9.1  Summary
  1611.  
  1612. Transparent XON/XOFF Flow Control functions on the interface between the 
  1613. local DTE (computer or terminal) and local DCE (modem). When the data is 
  1614. placed on the link between the modems, the original characters have been 
  1615. restored. Neither the remote DTE nor DCE are aware, or need to be aware, 
  1616. of the fact that Transparent XON/XOFF Flow Control is in use.
  1617.  
  1618. Transparent flow control can be viewed as a layered process, organized 
  1619. as follows. Note that this process is duplicated in the reverse 
  1620. direction (operates in both directions simultaneously).
  1621.  
  1622. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1623. D.9.2  Transparentization
  1624.  
  1625. Transparent XON/XOFF Flow Control operates by scanning the data stream 
  1626. for XON ($11), XOFF ($13), and DLE ($10) characters ("$" indicates 
  1627. hexadecimal), with either 0 or 1 in the high-order bit position. When 
  1628. one is found, a DLE with same parity character is inserted ahead of it. 
  1629. The original character is then "transparentized" by exclusive-ORing the 
  1630. character with the value $21 (hexadecimal 21, decimal 33, binary 
  1631. 00100001), which preserves the parity bit value. XON and XOFF characters 
  1632. are thus "hidden" in the data stream. 
  1633.  
  1634. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1635. D.9.3  Flow Control
  1636.  
  1637. Once the XON and XOFF characters have been transparentized (hidden), the 
  1638. DTE and DCE are free to insert XON and XOFF characters for flow control 
  1639. purposes at any point in the data stream. This includes the possibility 
  1640. of inserting XONs and XOFFs between a DLE and the following 
  1641. transparentized character. XON and XOFF characters in the user data will 
  1642. not interfere with the flow control scheme. The operation of this 
  1643. XON/XOFF flow control process is identical to traditional XON/XOFF flow 
  1644. control.
  1645.  
  1646. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1647. D.9.4  De-Transparentization
  1648.  
  1649. In the de-transparentization process, the receiving device scans for 
  1650. DLEs. When one is found, it is discarded, and the following character is 
  1651. once again exclusive-ORed with the value $21, recovering the original 
  1652. character. Note that XONs and XOFFs that appear between the DLE and the 
  1653. following transparentized character are used for flow control purposes 
  1654. and do not affect the detransparentization process.
  1655.  
  1656. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1657. D.9.5  Examples
  1658.  
  1659. The following discussion is written in terms of the actions performed by 
  1660. the computer software. The modem performs identical actions on the 
  1661. reverse directions of transmission. This text is not meant to constrain 
  1662. implementation or to imply that better implementations are not possible, 
  1663. but serves simply as an example. 
  1664.  
  1665. ........................................................................
  1666. D.9.5.1  Transmitter Example
  1667.  
  1668. Each character in the user data stream is individual examined. It it is 
  1669. any of the six characters $10, $11, $13, $90, $91, or $93, it is 
  1670. exclusive-ORed with the value $21, and prefixed by a DLE character 
  1671. ($10). This can also be viewed as a replacement function according to 
  1672. the following table:
  1673.  
  1674. Char      Replaced By
  1675. ------------------------------------------------------------------------
  1676. $10       $10 $31
  1677. $11       $10 $30
  1678. $13       $10 $32
  1679. $90       $10 $B1
  1680. $91       $10 $B0
  1681. $93       $10 $B2
  1682. ------------------------------------------------------------------------
  1683.  
  1684. The characters are transmitted using the parity setting then in force on 
  1685. the DTE-DCE interface; the XOR with $21 preserves the correct value of 
  1686. the parity bit.
  1687.  
  1688. If the software wants the modem to suspend delivering data, it inserts 
  1689. an XOFF ($13 at current parity setting) in the transmitted data stream 
  1690. at any arbitrary point, which may be between a DLE ($10) and the 
  1691. following transparentized character. The XOFF should be issued BEFORE 
  1692. the buffer is completely full, since there may be a lag of several 
  1693. characters before the modem is able to react to the XOFF and suspend 
  1694. delivery. To resume delivery of data, the software inserts an XON ($11 
  1695. at current parity setting) at any arbitrary point. Characters inserted 
  1696. for flow control purposes are NOT passed through the transparency 
  1697. algorithm defined above. 
  1698.  
  1699. ........................................................................
  1700. D.9.5.2  Receiver Example
  1701.  
  1702. Each character received from the modem is individually examined. A 
  1703. "transparency sequence in progress" flag (TSIP-FLAG) is maintained as 
  1704. part of a simple state machine. The initial value of the TSIP-FLAG is 
  1705. OFF. The following tests and actions should be undertaken in the order 
  1706. listed.
  1707.  
  1708. If the character received is $13 or $93 (XOFF with either parity), it is 
  1709. interpreted (regardless of the setting of the TSIP-FLAG) as a request 
  1710. from the modem for the DTE to suspend transmission of data to the modem. 
  1711. The receiver portion of the software must communicate this request to 
  1712. the transmitter portion of the software in a timely manner, since the 
  1713. modem has a limited amount of buffer space to allow for additional 
  1714. characters to be received after it sends XOFF (about 64 characters 
  1715. maximum). The XOFF character is discarded from the received data stream. 
  1716. The TSIP-FLAG is not changed.
  1717.  
  1718. If the character received is $11 or $91 (XON with either parity), it is 
  1719. interpreted (regardless of the setting of the TSIP-FLAG) as a request 
  1720. from the modem for the DTE to resume transmission of data to the modem, 
  1721. if any is available. The XON character is discarded from the received 
  1722. data stream. The TSIP-FLAG is not changed.
  1723.  
  1724. If the character is neither an XON or and XOFF, the following steps are 
  1725. performed:
  1726.  
  1727. If the TSIP-FLAG is ON, the received character is exclusive-ORed with 
  1728. $21, then delivered to the higher layer for further processing (e.g., 
  1729. placed in a receive data buffer). The TSIP-FLAG is then turned OFF.
  1730.  
  1731. If the TSIP-FLAG is OFF and the character received is $10 or $90 (DLE 
  1732. with either parity), the beginning of a transparency sequence is 
  1733. indicated. The DLE is discarded from the received data stream, and the 
  1734. TSIP-FLAG is turned ON. 
  1735.  
  1736. If the TSIP-FLAG is OFF and the character received is neither a $10 nor 
  1737. $90, the character is a normal untransparentized user data character 
  1738. which should be delivered to the higher layer for further processing 
  1739. (e.g., placed in a receive data buffer). The TSIP-FLAG remains OFF 
  1740. (unchanged).
  1741.  
  1742. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1743. D.9.6  Conclusion
  1744.  
  1745. When properly implemented, Transparent XON/XOFF Local Flow Control 
  1746. permits a fully-functional flow-controlled interface even when only 
  1747. three conductors are present (Transmit Data, Receive Data, and Signal 
  1748. Ground). Versatile software may use the &T19 cable test feature of Hayes 
  1749. modems to determine whether or not RTS/CTS flow control can be 
  1750. used, and, if RTS/CTS is unavailable, automatically select &K5 operation 
  1751. to use Transparent XON/XOFF flow control, and allow the user to continue 
  1752. to transfer data using any protocol or data contents without concern for 
  1753. possible interference with the XON/XOFF flow control scheme.
  1754.  
  1755. ************************************************************************
  1756. D.10     General Tips and Techniques
  1757.  
  1758. The following are tips and techniques that may help in the exchange of 
  1759. information between the software controller and the modem command 
  1760. processor.
  1761.  
  1762. *  Commands in the command line should be ordered starting with the 
  1763. safest and ending with the most risky. Risk is defined as the potential 
  1764. to generate an ERROR, causing the remainder of the command line to be 
  1765. ignored.
  1766.  
  1767. *  Any command that may return ERROR should be anticipated. This or 
  1768. other unexpected results can be ignored unless the command is critical 
  1769. (configuration or call placement).
  1770.  
  1771. *  Send I0 or I4 at 1200 bps, which is supported by the majority of 
  1772. modem products. A modem reset (&F or Z) should be performed at 1200 bps 
  1773. before sending the identification commands.
  1774.  
  1775. *  Setup processing can be speeded by sending all but the last D or S0 
  1776. command at the highest DTE rate supported by the modem. The last command 
  1777. must be sent at the speed at which the connection should be made (except 
  1778. V-series, OPTIMA and ACCURA EC products which specify this with S37).
  1779.  
  1780. *  Any dependency on proper cabling can be eliminated by avoiding 
  1781. techniques that depend on RS-232 signals:
  1782.      Have the software scan for result codes, rather than depending 
  1783.      on the condition of the CD line.
  1784.      Transparent flow control should be used with V-series, OPTIMA and 
  1785.      ACCURA EC products rather than with RTS/CTS signals.
  1786.      The escape sequence with guard time process and H command 
  1787.      should be used to hangup instead of terminate a connection by 
  1788.      dropping DTR.
  1789.      Any unexpected RING result codes may indicate the last command 
  1790.      may not have been processed correctly. The command should be-
  1791.      issued.
  1792.  
  1793. Sample Controller/Modem Exchange
  1794.  
  1795. Clock     Controller                    Speed      Modem 
  1796.                                         (1200)
  1797.                                          bps)
  1798. ------------------------------------------------------------------------
  1799. 00000     ATZ<CR>                        
  1800. 00034                                              ATZ<CR>
  1801. 00068                                             (one second to do 
  1802.                                                    reset)
  1803. 01068                                             0<CR> (V0 stored as 
  1804.                                                    default)
  1805. 01084     (delay additional 600ms)
  1806. 01684     ATEQV1S0=0S12=10S4=3HI<CR>          
  1807. 01884                                             ATEQV1S0=0S12=10S4=3HI
  1808.                                                   <CR> (echo)
  1809. 02084                                             <CR><LF>960<CR><LF> 
  1810. 02142                                             <CR><LF>OK<CR><LF>
  1811.                                          (19200
  1812.                                           bps)     
  1813. 02192     ATM0X4L1S12=10S2=1&Q5W1S36
  1814.           =7S37=9&K5<CR>
  1815. 02206                                             <CR><LF>OK<CR><LF> 
  1816. 02209     ATDT9W14045551212<CR>
  1817. 38000                                             <CR><LF>CARRIER 
  1818.                                                   2400<CR><LF>
  1819. 45000                                             <CR><LF>PROTOCOL: 
  1820.                                                   NONE<CR><LF>
  1821. 45010                                             <CR><LF>CONNECT 
  1822.                                                   2400<CR><LF>
  1823.                                         (2400 
  1824.                                         bps)
  1825.                                         
  1826. (Connection Established)
  1827. -----------------------------------------------------------------------
  1828.                                         (2400 
  1829.                                          bps)
  1830. 00000     (delay 300ms, need 200, add 
  1831.           100 for safety)
  1832. 00300     (escape char is ^A, S2=1)
  1833. 00313                                              (waits 200ms)
  1834. 00513                                              <CR><LF>OK<CR><LF>
  1835. 00538     ATHE1S2=43S12=50W0&Q0<CR>
  1836. 00630                                              <CR><LF>OK<CR><LF> 
  1837. ------------------------------------------------------------------------
  1838.  
  1839. ========================================================================
  1840.  
  1841. -- 
  1842. Carl Oppedahl AA2KW  (intellectual property lawyer)
  1843. 30 Rockefeller Plaza
  1844. New York, NY  10112-0228
  1845. voice 212-408-2578     fax 212-765-2519
  1846.