Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

pySerial

13 views
Skip to first unread message

__zip__

unread,
Dec 18, 2007, 6:49:27 PM12/18/07
to
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.

John Machin

unread,
Dec 18, 2007, 7:28:21 PM12/18/07
to
On Dec 19, 10:49 am, __zip__ <z...@got.no.mail> 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).

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.

__zip__

unread,
Dec 18, 2007, 8:38:59 PM12/18/07
to
Tnx for help. Done it.

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

tnx.

[david]

unread,
Dec 19, 2007, 8:26:03 PM12/19/07
to

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

0 new messages