pySerial

Z

__zip__

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.
 
J

John Machin

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.
 
Z

__zip__

Tnx for help. Done it.

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

tnx.
 
D

[david]

__zip__ said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,128
Latest member
ElwoodPhil
Top