471,354 Members | 1,704 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

pySerial

Hi,

I am using pySerial for communication with modem.

Does anyone knows which values are for what in these variables?

xonxoff=0
rtscts=0
dsrdtr=0

if xonxoff=0 is it hardware control on or of (logic says it would be off
, but who knows).
Second question is: do I need to send \n or soemthing when I use write().

I would like to do:

ser.write("AT")
print ser.readline()

and get "OK".

Am I doing soemthing wrong?

tnx in advance.
Dec 18 '07 #1
3 2288
On Dec 19, 10:49 am, __zip__ <z...@got.no.mailwrote:
Hi,

I am using pySerial for communication with modem.

Does anyone knows which values are for what in these variables?

xonxoff=0
rtscts=0
dsrdtr=0

if xonxoff=0 is it hardware control on or of (logic says it would be off
, but who knows).
Disclaimer: It's a long time since I bit-bashed a UART ...

Where those relate to bits in the control registers, I'd expect 1 maps
to 1 and 0 maps to 0. Where they relate to functionality provided by
the software, I'd expect 1 to mean "do it" and 0 to mean "don't do
it". Do you have any reason for assuming otherwise?
>
Second question is: do I need to send \n or soemthing when I use write().
That depends on what the modem is expecting.
>
I would like to do:

ser.write("AT")
print ser.readline()

and get "OK".
And what did you get"?
>
Am I doing soemthing wrong?
Probably what you are doing wrong is not reading the docs.
http://pyserial.sourceforge.net/
"""Be carefully when using "readline". Do specify a timeout when
opening the serial port otherwise it could block forever if no newline
character is received. Also note that "readlines" only works with a
timeout. "readlines" depends on having a timeout and interprets that
as EOF (end of file). It raises an exception if the port is not opened
correctly.
"""

When you have a problem, show all the code (including the opening and
configuring of the port) and tell us what did happen with that code.
Dec 19 '07 #2
Tnx for help. Done it.

The problem was that returning bytes were on few lines and I
didn't look after first \n :(

tnx.
Dec 19 '07 #3
__zip__ wrote:
Hi,

I am using pySerial for communication with modem.

Does anyone knows which values are for what in these variables?

xonxoff=0
rtscts=0
dsrdtr=0

if xonxoff=0 is it hardware control on or of (logic says it would be off
, but who knows).
Second question is: do I need to send \n or soemthing when I use write().

I would like to do:

ser.write("AT")
print ser.readline()

and get "OK".

Am I doing soemthing wrong?

tnx in advance.
Just a note:
Most modems expect CR (\r), rather than \n.

Dec 20 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by Bob Greschke | last post: by
4 posts views Thread by Zarathustra | last post: by
8 posts views Thread by Alejandro | last post: by
2 posts views Thread by Jon | last post: by
15 posts views Thread by Lone Wolf | last post: by
reply views Thread by [david] | last post: by
3 posts views Thread by naveen.sabapathy | last post: by
reply views Thread by XIAOLAOHU | last post: by

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.