Dialing out on MODEM

Peter Hansen peter at engcorp.com
Fri Jun 28 18:45:56 EDT 2002


Chris Liechti wrote:
> 
> "David McInnis" <david at dataovation.com> wrote in
> news:mailman.1025270142.10532.python-list at python.org:
> 
> > This is my object
> >
> >>>> import serial
> >>>> modem = serial.Serial
> >>>> modem = serial.Serial(2)
> >>>> modem.write("atdt3120992\n")
> 
> somtimes it it's a '\r\n' and maybe you need to send the escape sequence
> first, to enter the command mode. if i remember correctly thats 3 times ESC
> and then wait 100ms or so. either google or your modem manual should help.
> i had to do somthing like that to dial with pyserial, but unfortunately the
> code is on an other machine...

Most often, it's three plusses "+++" preceded and followed by a one-second
delay (if I recall correctly... I'm amazed I know longer know this with
certainty, given the number of times I've had to do it).

In addition, it's always a wise thing to write an empty line (just
the terminate, whether it's \n or \r\n or \r) before doing anything
after you open the serial port a modem, since a previous application
could have sent a few characters without a terminator and they're still
sitting in the modem's buffer.  It might look to your modem as though
you had actually sent "ATDT31ATDT3120992\n" for example, which wouldn't
help much.

By the way, the need for \r\n has nothing to do with Windows.  It's
entirely up to your modem what termination strings it wants.  Some
can handle just \n I think, and I'm pretty sure others will automatically
adapt to \r\n as well, even if they don't normally take it.  Check
the manual for the modem.

-Peter



More information about the Python-list mailing list