473,412 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

Addressing the modem via pyserial

Hi!

I asked previously how to address the COM port from Python and I was
directed to pyserial. It is very elegant and I guess it works very well.

However, it seems that what I try to do is more complicated than I first
thought. I want to make my modem place a call using the number '1234'. The
modem is connected to COM3 on my computer. So I tried the following:

-------------------------------
import serial

ser = serial.Serial(2) # COM3
ser.timeout = 2 # otherwise the read(2) which follows blocks for ever
ser.write("atdt1234")
reply = ser.read(2)
print reply
ser.close()
print "ok"
-------------------------------

In the HyperTerminal which comes with Win XP Pro, I can set up a
connection to COM3 and there type the 'atdt1234' command. It works (I get
a call since I have the modem connected to a device with a phone on it).

My question is actually: will an at-command like 'atdt1234' translate to
ser.write('atdt1234')?

Secondly, a modem question: I have found a lot of web pages about
at-commands listing the hayes command set. Still many of them do not seem
to work on two different modems I have tried. Like '&$' should display an
overview of the commands supported by the modem. Ii tried this in the
HyperTerminal where I can place the above mentioned call, and I get
'ERROR'. I also get 'ERROR' for most other commands I try.

Any ideas?

Thanks,
Catalin

--

<<<< ================================== >>>>
<< We are what we repeatedly do. >>
<< Excellence, therefore, is not an act >>
<< but a habit. >>
<<<< ================================== >>>>
Jan 18 '06 #1
2 3784
Doru-Catalin Togea wrote:
In the HyperTerminal which comes with Win XP Pro, I can set up a
connection to COM3 and there type the 'atdt1234' command. It works (I get
a call since I have the modem connected to a device with a phone on it).
even without pressing enter?
My question is actually: will an at-command like 'atdt1234' translate to
ser.write('atdt1234')?


try

ser.write('atdt1234\r\n')

or just

ser.write('atdt1234\n')

</F>

Jan 18 '06 #2
Doru-Catalin Togea schreef:
My question is actually: will an at-command like 'atdt1234' translate to
ser.write('atdt1234')?
You'll have to include the end-of-line; I guess 'atdt1234\n' should
work, otherwise you can try 'atdt1234\r\n' or 'atdt1234\r'.

Also, don't forget that you have to set the modem into command mode if
it was not already (using '+++' and a pause before and/or after that
IIRC), but I guess that's not the problem in this case.
Secondly, a modem question: I have found a lot of web pages about
at-commands listing the hayes command set. Still many of them do not
seem to work on two different modems I have tried. Like '&$' should
display an overview of the commands supported by the modem. Ii tried
this in the HyperTerminal where I can place the above mentioned call,
and I get 'ERROR'. I also get 'ERROR' for most other commands I try.


Unfortunately the hayes command set is not a well-defined standard
supported by all modems. There are almost as many variations as there
are modems. In the good old days the user manual that came with the
modem had an overview of the available commands for that modem.

--
If I have been able to see further, it was only because I stood
on the shoulders of giants. -- Isaac Newton

Roel Schroeven
Jan 18 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Etienne Labuschagne | last post by:
Assuming the modem is on COM5: m = open('COM5','wb+') m.write('+++\r\n') m.flush() m.write('ATQ0V1E0\r\n') m.flush() m.write('ATDT5551234;\r\n') m.flush() response = m.read()
1
by: Etienne Labuschagne | last post by:
Thanks for the responses. I will look into using PySerial for talking to the modem as suggested by Peter. The code example I gave is probably not the best way to do it, but it seemed to work ok...
1
by: Adriano Monteiro | last post by:
Hey folks, I need to talk to my modem through a terminal, so I can send commands and get the answers. Does anybody here know what can I do? I've tried to use pty.py, but I'm lost... Regards,...
13
by: Bob Greschke | last post by:
We have some equipment that communicates at 57600 baud RS232. The path from the PC is USB to a Phillips USB hub, then off of that a TUSB3410 USB/Serial converter. The driver for the 3410 chip...
3
by: Doru-Catalin Togea | last post by:
Hi! I am writing some tests and I need to place calls through the modem. Is there an API for addressing the COM ports on my machine, so that I can issue AT-commands to the modem? If this can...
4
by: Zarathustra | last post by:
Hi, where I can find the pyserial handbook?? THanks
3
by: Ron Jackson | last post by:
I am using Python 2.5 on Windows XP. I have installed Pyserial and win32all extensions. When I try to run the example program scan.py (included below), or any other program using pyserial, as...
0
by: pauland80 | last post by:
<snip> <snip> Late thanks for your both answers! (Please excuse me for that) The problem was a bug in the device firmware. But before finding this, I dugg lightly in the pyserial source...
0
by: [david] | last post by:
http://pyserial.sourceforge.net/ "port numbering starts at zero, no need to know the port name in the user program" But the implementation in SerialWin32 is just (Portnum +1)
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.