To: djgpp AT delorie DOT com Subject: Re: modem Questions Message-ID: <19971224.112801.4967.1.Praxis_Beta@juno.com> References: <9612241402 DOT AA24727 AT quasar DOT bloomberg DOT com > From: praxis_beta AT juno DOT com (Bruce A. Locke) Date: Tue, 24 Dec 1996 11:30:56 EST On Tue, 24 Dec 1996 09:02:26 -0500 kagel AT quasar DOT bloomberg DOT com writes: >> how do I set a modem to anwser in DJGPP, so that I can dial into it >> and have it recieve the data? >> > >Try: > FILE *modem; > char resp[10]; > > modem = fopen( "COM1", "rw" ); /* Assuming your modem is at COM1: */ > fprintf( modem, "ATS0=1\n" ); /* This may be \r rather than \n. */ > fread( resp, 3, 1, modem ); > if (strncmp( resp, "AT", 2 ) == 0) > fprintf( stderr, "Modem ready to answer!\n" ); > ::: > >-- >Art S. Kagel, kagel AT quasar DOT bloomberg DOT com > I'm sorry but I lost the original posters e-mail address, so here goes..... If you are talking about just normal modem stuff (ie: dialing into a BBS) then this might be handy: I grabbed this from the handy HelpPC 2.10 reference for DOS that you can download from SimTel. The following is a partial list of the various modem "codes" and the such. You should be able to copy them into the COM port for them to work (or you could use a more appropriate method as shown up above... *8-) *** START *** HelpPC 2.10 Quick Reference Utility Copyright 1991 David Jurgens Hayes Command Set / Register Formats +++ standard escape sequence (see S2 below) Comma standard pause character (see S8 below) AT standard attention sequence ATA force immediate answer ATC0 transmitter off ATC1 transmitter on ATD dial (ATD number) ATDP pulse dial (ATDP number) ATDT tone dial (ATDT number) ATE0 disable local character echo ATE1 enable local character echo ATF0 Half Duplex (modem echoes characters) ATF1 Full Duplex (modem does not echo characters) ATH0 force line on hook ATH1 force line off hook ATH2 force line special off hook (used for HAM radio) ATI0 request product code, formatted PPR, PP=prod., R=rev. ATI1 request ROM check sum ATL1 speaker volume low (modem specific) ATL2 speaker volume medium (modem specific) ATL3 speaker volume high (modem specific) ATM0 speaker always off ATM1 speaker on except while carrier present ATM2 speaker always on ATM3 speaker on except while dialing and carrier present ATO force modem into on-line state ATP sets modem to default pulse dial ATQ0 modem returns result codes ATQ1 modem does not return result codes ATR sets modem to answer mode after dialing out ATSn where Sn is S register number 'n' (see registers below) ATT sets modem to default tone dial ATV0 send numeric codes ATV1 send word result codes ATX0 basic result code set "CONNECT", no dial tone detect ATX1 extended result code set "CONNECT 1200", no dialtone detect ATX2 wait for dial tone, extended result codes ATX3 detect busy signal, extended result codes ATX4 wait for dial tone, detect busy, extended result codes ATZ reset to power up condition Hayes 2400 Compatible Modem Commands ATB0 CCITT V.22 at 1200 bps ATB1 BELL 212A at 1200 bps AT&C DCD always on AT&C1 DCD on while carrier present AT&D DTR ignored AT&D1 DTR fail disconnect enabled AT&D2 DTR fail disconnect enabled (auto answer off) AT&D3 DTR fail disconnect enabled (reset modem) AT&F restore to factory configuration AT&G no guard tone AT&G1 550 Hz guard tone AT&G2 1800 Hz guard tone AT&J RJ11/RJ41S/RJ45 jack AT&J2 RJ12/RJ13 jack AT&L regular phone line AT&L1 leased line AT&M async operation AT&M1 async/sync operation AT&M2 sync auto dial AT&M3 sync manual dial AT&P 39/61 pulse make/break ratio AT&P1 33/67 pulse make/break ratio AT&T4 grant RDL test request AT&T5 deny RDL test request AT&W write current registers to non-volatile memory AT&X sync clock internal AT&X1 sync clock external AT&X2 sync clock slaved AT&Z store dial command line Hayes Compatible Modem Registers Not all modems support all of these registers and some modems have registers other than those listed here. Also note, some are read only. to set a register use: AT Sr=## (cr) to read the register: AT Sr? (cr) Where "r" is the register and (cr) is a carriage return The following represent conventions used in the tables below: () indicates defaults for Smartmodem 1200 ** indicates possible inconsistencies across modems Reg Values Register function S0 0-255 ring to answer on (0=don't answer) S1 0-255 ring count (clear after 8 sec) (read only) S2 0-255 escape char, normally "+", 128-255 disable escape S3 0-127 end of line character (0x0D/CR) S4 0-127 line feed character (0x0A/LF) S5 0-32,127 backspace character (0x08/BS) S6 2-255 pause before dialing in seconds (2) S7 1-255 wait for carrier in seconds (30) S8 0-255 pause for comma in dial string in seconds (2) S9 1-255 carrier detect response time in 1/10 second (6) S10 1-255 carrier loss delay in 1/10 second, 255=ignore CD (7) S11 50-255 touch tone dial speed, in milliseconds (70) S12 20-255 escape guard time, in 1/50 second,0=no delay (50) ¦7¦6¦5¦4¦3¦2¦1¦0¦ S13 power up async data format ¦ ¦ ¦ ¦ ¦ ¦ ¦ +---- unused ¦ ¦ ¦ ¦ ¦ ¦ +----- result code, 0=basic, 1=extended ¦ ¦ ¦ ¦ ¦ +------ parity, 0=disabled, 1=enabled ¦ ¦ ¦ ¦ +------- parity, 0=odd ,1=even ¦ ¦ ¦ +-------- data bits, 0=7 bits, 1=8 bits ¦ ¦ +--------- undefined ¦ +---------- buffer ovfw flag, 0=disabled,1=enabled +----------- 8th bit, 0=space,1=mark (8 bit only) **** END ***** Please note that I have cut off this list at its half way point. The rest of the document is setup like the diagram above. If anyone wants the complete version, feel free to e-mail me privetaly for it. Hope this helps.... ======================================================================= Bruce Locke Praxis_Beta AT Juno DOT Com http://www.nyx.net/~blocke