473,769 Members | 7,058 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2415
On Dec 19, 10:49 am, __zip__ <z...@got.no.ma ilwrote:
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
11038
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 creates a "normal" comm port (like COM3). There is a C++ program that has no problem talking to the equipment, but two Python programs have trouble. One is a big, scary, controller program, and the other, since that is the one I'm having trouble...
4
5075
by: Zarathustra | last post by:
Hi, where I can find the pyserial handbook?? THanks
8
9183
by: Alejandro | last post by:
Hi: I'm using pySerial to talk to a RS232 to RS485 converter. In order to control the converter, I need to control the DTR line to enable/disable de RS485 driver. In particular, I need to : write a character to the serial port set the DTR line to level 1 _after_ the last bit of the character is send
2
3741
by: Jon | last post by:
Hi, I wrote some code to read in info from a port using pyserial. the code reads info sent by a box that is connected to my computer by an rs232-to usb adapter. When I was writing the code and testing it on my computer it worked fine. I ran py2exe on the program (which uses wxpython for its gui) and sent the output from the py2exe to another computer. now when I try to run it on this other computer it fails to open the port. it gives...
15
16872
by: Lone Wolf | last post by:
I'm trying to get data through my serial port from a CMUcam. This gizmo tracks a color and returns a packet of data. The packet has nine data points (well, really eight since the first point is just a packet header) separated by spaces as follows: M xxx xxx xxx xxx xxx xxx xxx xxx Here is the code I am using (python v24): import serial
3
8159
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 soon as it hits the statement: s = serial.Serial(i) I get the error:
0
596
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 and found (to take with care!) :
0
2078
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)
3
11632
by: naveen.sabapathy | last post by:
Hi, I am trying to use virtual serial ports to develop/test my serial communication program. Running in to trouble... I am using com0com to create the virtual ports. The virtual ports seem to be working fine when I test it with Hyperterminal . I am using the example program that comes with pyserial, as below. --------------- import serial
2
4160
by: bryanleo | last post by:
We are trying to read data from a microcontroller and interface it through serial port. The output is then displayed in Python using Pyserial or the hyperterminal, the former is more important When you touch the input pins of the microcontroller the value changes real time in hyper terminal. But In the case of the pyserial module, even though you touch the input pins, the value does not change. We have actually noticed that python records and...
0
9589
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10216
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9997
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9865
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7413
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3965
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.