Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucsd!ogccse!blake!milton!max!scott From: scott@max.u.washington.edu Newsgroups: comp.sys.cbm Subject: (Re: AT cmds 4 1670) + How to write a Terminal Prg!!! Message-ID: <7467@max.u.washington.edu> Date: 27 Sep 89 07:32:14 GMT References: <8916@batcomputer.tn.cornell.edu> Distribution: usa,world Organization: University of Washington, Seattle WA Lines: 354 In article <8916@batcomputer.tn.cornell.edu>, cloos@batcomputer.tn.cornell.edu (James H. Cloos Jr.) writes: > Hello. Can anyone mail me either the subset of the AT commands for > Commodore's 1670 modem that change bps, parity settings, or perhaps the > whole list? I'd appreciate such info very much. > > I just set up my 128 to call into the computers at CU, but can't find the > manual for the modem, which defaults to 300 bps rather than 1200. > > Any help is greatly appreciated! > Following is a short, but VERY informative documentation of most of the important modem commands for the 1670.....AND ALSO a tutorial on how to go about in programming a terminal program for the modem. The sample BASIC programs are fully and clearly explained line by line. Oh ya, this documentation was not written by me. The original author of this documentation is give below. I hope this is what you were looking for.... Sincerely, Scott K. Stephen ALL ABOUT THE 1670 By Brian R. Berman AT COMMAND SET The following is a listing of the 'AT' commands that the 1670 uses. The reason the set is called AT is beacuse exept where noted, all the commands are preceded by the char- acters 'AT', followed by an ASCII carriage return. -------------------------------------- A Answer Mode. The 1670 will go into answer mode without having recieved a ring. A/ This will re-executed the last command entered. You don't need to use AT before this command. D Dial a number, then go into originate mode. The D command may be followed by the number to dial, or by P to dial dial using pulse (rotary) dialing, or D to dial using TouchTone (DTMF)dialing. , This will insert a two second pause in the dialstream. A comma may be inserted anywhere in a number. E0 Don't echo back command char- acters to the screen. E1 Echo command characters to the screen. F0 Half Duplex operation. F1 Full duplex operation. M0 Modem speaker OFF at ALL times. M1 Activate speaker during dialing and silence when carrier is de- tected. M2 Modem speaker ON for entire communications session. Q0 Send response codes to screen. Q1 Don't send response codes to the screen. S Set register commands. The com- mands are of the form 'Sx=n' where 'x' is the S-register and n is a number between 0 and 255. S0=n Answer calls on the 'n'th ring. S0=0 will disable auto-answer op- eration. S2=n Set the character for the escape code sequence to the ASCII char. # represented by 'n'. See +++. S7=n Set the length of time (in sec- onds) the modem will wait for detection of carrier when originating a call. The 'n' should be set higher than 30 when calling long distance. V0 Make the modem messages appear in Terse (i.e. numeric) form. Terse messgaes are followed by a RETURN. V1 Make modem messages appear in Verbose form. Verbose messages are followed by a RETURN/line- feed. X0 Use the Standard Response Code Set. X1 This will use the Extended Res- ponse Code Set. If ATX1 is enter- ed, the 1670 will respond with 'CONNECT' for 300-baud calls, & 'CONNECT 1200' for 1200 baud calls. Z This will reset the 1670 as if it were just turned-on. It also sets all modem controls back to de- fault. +++ Escape code sequence. If you type this during a transmission, the modem will disconnect and go back to it's command state. -------------------------------------- CONTROLLING YOUR 1670 FROM BASIC Controlling the 1670 from BASIC is very easy. In fact, the 1670 is even easier than the 1650, and 1660. You see, the 1650 and 1660 both need long and complicated dialing routines. The 1670 doesn't. In fact, it doesn't need ANY! Even programs that came out BE- FORE the 1670 was introduced work with it. You can do the following with ANY terminal program: type ATE1 (must be capitals!!!) then type any of the AT commands. NOTE: All letters in an AT command MUST be capital. It's that easy!!! Even the smallest, dumbest, simplest terminals can accept AT commands. So really, even though a program says it won't work with the 1670, it will (as long as you use the AT commands). If you want to have a program that will ask for a number, and then dial it, the following program will do that. 10 OPEN 5,2,3,CHR$(6) 20 INPUT"NUMBER";N$ 30 PRINT#5,"ATDT ";N$ 40 REM Terminal goes here NOTE: The 'ATDT' in line 30 must be capitals, so if you're in upper case/ graphics mode, the 'ATDT' will look like a bunch of symbols. The following is an explanation of the program above: Line 10 Opens the modem channel, and sets it to 300 baud. Line 20 Asks user to enter the phone number to dial. The number is assigned N$. Line 30 Send the command ATDT to the modem followed by the number which is N$. Line 40 Here you would put a term- inal program. There are terminal programs listed elsewhere in this article. --------------------------------------- GET# and PRINT# The two commands, GET# and PRINT#, are almost like the regular GET and PRINT, but are sent to a specified device. For instance, if you were writing a BBS, and wanted to print out something when someone logged-on, you would set the 1670 to autoanswer and when a call comes, branch to terminal. Then use a PRINT# statement followed by a message. An example of a PRINT# statement would be: PRINT#5,"Welcome to the John Doe BBS" That would send 'Welcome to the John Doe BBS' to the caller's screen. You could easily make a routine that would open a SEQ file, and send it to the screen using the PRINT# statement. The GET# statement is helpful when you are using online menus. Here is an example of the GET# statement: 10 OPEN 5,2,3,CHR$(6) 20 PRINT#5,"A. Choice #1" 30 PRINT#5,"B. Choice #2" 40 PRINT#5,"C. Choice #3" 50 PRINT#5,"Select One." 60 GET#5,A$ 70 IF A$="a" then xxx 80 IF A$="b" then xxx 90 IF A$="c" then xxx 100 GOTO 60 This program prints this on the caller's screen: A. Choice #1 B. Choice #2 C. Choice #3 Select One. The person then selects either A, B, or C. If they press A, then goto a certain line number (xxx). The same goes with B and C. The routine below will read a SEQ file, and print it out to the modem. 10 OPEN 5,2,3,CHR$(6) 20 OPEN 4,8,4,"filename,s" 30 GET#4,SC$:IF ST<>0 THEN GOTO 60 40 PRINT#5,SC$;:GOTO 30 60 CLOSE4:END Now you should just about know how to write your own BBS program. There is another command not mentioned in this article, INPUT#. This is what you would use if you set-up an EMAIL system on your BBS. I didn't do any- thing on the INPUT# because it isn't very reliable. --------------------------------------- TERMINAL PROGRAMS Almost all the routines and examples above need a terminal program some- where in them. Here are two programs that you can use. One is a Pet ASCII (Color/Graphics) terminal, and one is a true ASCII terminal. 10 REM -- Color/Graphics Terminal -- 20 PRINT CHR$(147):PRINTCHR$(14) 30 POKE 53281,0:POKE 53280,0 40 PRINT"Color/Graphics Terminal" 50 OPEN 5,2,3,CHR$(6) 60 GET#5,A$ 70 IF A$=""THEN 150 80 PRINTA$ CHR$(29) CHR$(157); 150 GET A$ 160 IF A$=""THEN 60 170 PRINT#5,A$; 180 GOTO 60 10 REM -- True ASCII Terminal -- 100 OPEN 5,2,3,CHR$(6):PRINTCHR$(14) 110 DIM F%(255),T%(255) 200 FOR J=32 TO 64:T%(J)=J:NEXT 210 T%(13)=13:T%(20)=8:RV=18:CT=0 220 FOR J=65 TO 90:K=J+32:T%(J)=K:NEXT 230 FOR J=91 TO 95:T%(J)=J:NEXT 240 FOR J=193 TO 218:K=J-128:T%(J)=K :NEXT 250 T%(146)=16:T%(133)=16 260 FOR J=0 TO 255 270 K=T%(J) 280 IF K<>0 THEN F%(K)=J:F%(K+128)=J 290 NEXT 300 PRINT" "CHR$(147) 310 GET#5,A$ 320 IF A$=""OR ST<>0 THEN 360 330 PRINT" "CHR$(157);CHR$(F%(ASC(A$))); 340 IF F%(ASC(A$))=34 THEN POKE 212,0 350 GOTO 310 360 PRINTCHR$(RV)" "CHR$(157);CHR$(146) ;:GET A$ 370 IF A$<>""THENPRINT#5,CHR$(T%(ASC(A$ ))); 380 CT=CT+1 390 IF CT=8 THEN CT=0:RV=164-RV 410 GOTO 310 Both of these terminals accept the AT command set. Nothing should appear on the screen when you run the term- inals until you type ATE1. --------------------------------------- OPENING MODEM CHANNELS To open a 300-baud modem channel, use OPEN 5,2,3,CHR$(6). To open a 1200 baud channel, use OPEN 5,2,2,CHR$ (0)+CHR$(0)+CHR$(61)+CHR$(1). You can also use OPEN 5,2,2,CHR$(6). --------------------------------------- USING 'AT' COMMANDS FROM BASIC To use an AT command from BASIC is VERY easy. Just open the modem channel (see Opening Modem Channels), and type: PRINT#5,"AT command goes here" It's that simple! Well, I guess this concludes the article. ---------------------------------------