Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Telepathy Communications Library - <b>general information</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 General information

 A modem has two modes: command mode, and online mode.  Initially the
 modem is in command mode, where you can send the modem commands and
 it will optionally respond with result codes.  In online mode, the
 modem is connected to another system.  Characters sent to the modem
 are transmitted to the other system, and the modem returns characters
 it has received.

 The modem switches from command mode to online mode after it has
 successfully dialed and connected to another modem, after it has
 answered a call, or when told to go online after it has been
 temporarily put in command mode.  It goes from online mode to command
 mode when it receives an escape sequence.

     An escape sequence consists of a one-second pause, three "+"
     characters, and another one-second pause.  The pauses make it
     unlikely that the sequence should appear accidentally in text.

 All modem command strings (except for "A/") consist of the letters
 "AT" followed by one or more modem commands.  The command string
 should end with a carriage return, chr(13).

 The modem responds to a command by sending back a result code.  There
 are three kinds of result codes:

     In quiet mode (set by "ATQ1"), the modem sends no result codes.

     In numeric mode (set by "ATV0"), a result code consists of a
     decimal number followed by a carriage return (no line feed).

     In text mode (set by "ATV1"), a result code consists of a short
     one- or two-word message followed by a carriage return and line
     feed.

 There are a few things you should watch out for in sending commands
 to a modem:

     Most modems cannot take commands until they are completely
     finished with the previous command.  This can cause problems if
     you do not wait for the modem to send the complete result code
     before you give it a new command.  If you use tp_waitfor() to
     wait for a result code, be sure to wait for the "chr(13) +
     chr(10)" at the end (in text mode), or delay long enough before
     sending the command that the modem is quite finished.

     Some modems cannot take commands a full speed, but require a
     small delay between characters.  The sample code on your Telepathy
     disk contains this function which can be used to send modem
     commands:

         procedure SendModem(nPort, cCommand)
             local nIdx

             for nIdx := 1 to len(cCommand)
                 tp_flush(nPort, 0.05)
                 tp_delay(0.05)
                 tp_sendsub(nPort, cCommand, nIdx, 1)
             next

             return

 Some modems will accept commands at higher baud rates than they can
 communicate.  In some cases (as with MNP modems) you can leave the
 serial port set to the higher baud rate.  For most, as soon as a
 connection is established the modem will send a message such as
 "CONNECT 2400" telling you the baud rate of the connection, then switch
 speeds to that baud rate.  If you do not change the serial port's baud
 rate to the same speed, you will not be able to talk to the remote
 system.

     Watch out for modems that have been configured in strange ways.  It
     is possible to set a modem up so that it gives numeric result codes
     by default, or a strange result code set, or no result codes at
     all.  This code fragment will put most modems into a reasonable
     mode:

         * Set the modem for text result codes.

         SendModem(nPort, chr(13) + "ATQ0V1X1" + chr(13))
         tp_waitfor(nPort, 0.5, "OK" + chr(13) + chr(10))

         * Not all modems have extended result code sets, so we used
         * the default "base" set above.  Now we'll try for extended
         * codes.

         for nCodeSet := 1 to 4
             SendModem(nPort, "ATX" + str(nCodeSet, 1) + chr(13))
             if tp_waitfor(nPort, 0.5, "OK" + chr(13) + chr(10)) < 0
                 exit
             endif
         next

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson