473,749 Members | 2,626 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

serial ports, threads and windows

Hey people,

I've written a python app that r/w eight serial ports to control eight devices
using eight threads. This all works very nicely in Linux. I even put a GUI on
it using PyQt4. Still works nicely.

Then I put the app on on a virtual Windows machine running inside of vmware on
the same Linux box. Vmware only lets me have four serial ports so I run the
app against four serial ports using four threads. The app did not respond
quick enough to data from the serial ports and eventually hung.

So, I tried one serial port and the app still did not respond quick enough to
the single serial port. It eventually hangs.

When the app hung, in each case, it was not hogging the cpu nor reading any
data off the serial ports. The task manager didn't show it was doing anything
at all.

When it runs on Windows, could it be:

1) Just struggling to run inside of VMware?

2) Using threads with Qt on Windows is a problem?

3) Threads in python on Windows is a problem?

Any ideas?

Thanks,
Tom
Aug 2 '06 #1
3 2993

Tom Brown wrote:
When it runs on Windows, could it be:

1) Just struggling to run inside of VMware?
i have gut feeling that it could be that this is the problem.

Aug 3 '06 #2
On 2006-08-02, Tom Brown <br***@esteem.c omwrote:
When it runs on Windows, could it be:

1) Just struggling to run inside of VMware?
Could be.

Virtual machines are rather tricky things on broken
architectures that don't really permit true virtualization.
2) Using threads with Qt on Windows is a problem?
Doubt it.
3) Threads in python on Windows is a problem?
No.

--
Grant Edwards grante Yow! I'LL get it!! It's
at probably a FEW of my
visi.com ITALIAN GIRL-FRIENDS!!
Aug 3 '06 #3
Tom Brown wrote:
Hey people,

I've written a python app that r/w eight serial ports to control eight devices
using eight threads. This all works very nicely in Linux. I even put a GUI on
it using PyQt4. Still works nicely.

Then I put the app on on a virtual Windows machine running inside of vmware on
the same Linux box. Vmware only lets me have four serial ports so I run the
app against four serial ports using four threads. The app did not respond
quick enough to data from the serial ports and eventually hung.

So, I tried one serial port and the app still did not respond quick enough to
the single serial port. It eventually hangs.

When the app hung, in each case, it was not hogging the cpu nor reading any
data off the serial ports. The task manager didn't show it was doing anything
at all.

When it runs on Windows, could it be:

1) Just struggling to run inside of VMware?

2) Using threads with Qt on Windows is a problem?

3) Threads in python on Windows is a problem?

Any ideas?

Thanks,
Tom
Hi,

I have been using wxpython myself with pyserial in Windows 2000/XP.
No problems. Below are (edited) code segments. The "self.jam" is
used for stopping serial port processing without stopping the thread.

-------- thread example starts --------------------

class T1Thread(Thread ):
def __init__(self, inport):
Thread.__init__ (self)
self._want_abor t = 0
self.inprt = inport # COMx
self.inprt.flus hInput()
self.run_count = 0
#
self.jam = false
#
self.start()

def run(self):
while self._want_abor t == 0:
if not self.jam:
self.read_simul ations()
sleep(1)

def abort(self):
self._want_abor t = 1 # Stop from GUI
def read_simulation s(self):
..blah..blah..
self.inprt.flus hInput()
sleep(5)

-------- thread example ends --------------------

-------- Wxpython code starts --------------------

def OnRun(self, event):
if self.in_port != "No" and not self.T1worker:
self.T1worker = T1Thread(self.i nprt)
if self.out_port != "No" and not self.T2worker:
self.T2worker = T2Thread(self.o utprt)
if self.in2_port != "No" and not self.T3worker:
self.T3worker = T3Thread(self.i n2prt)
def OnStop(self, event):
if self.T1worker:
self.T1worker.a bort()
if self.T2worker:
self.T2worker.a bort()
if self.T3worker:
self.T3worker.a bort()
sleep(3)
self.T1worker= None
self.T2worker= None
self.T3worker= None
print "\nSTOPPED\ n"

-------- Wxpython code ends --------------------

-pekka-
Aug 3 '06 #4

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

Similar topics

13
4833
by: Al the programmer | last post by:
I need to access the serial ports on my webserver from an asp.net page. I have no problem accessing the serial ports from a windows form application, but the code doesn't work in asp.net. I have been told it is not possible to access the serial ports from asp.net. The application is used to control custom hardware. The hardware is connected to a PC through serial ports. Our customer wants to control the hardware from a remote...
1
1764
by: David | last post by:
I have written an application in VB.NET 2003 that uses the SAX serial component for RS232 communications with hardware. The program sets up 2 serial ports so that it can talk to 2 different hardware devices simultaneaously. When I run the program on a desktop running Windows 2000 it works fine. When I run it on a Laptop using XP I start having problems. It seems that when the ports are initiated, either one will work but not the
1
10919
by: henrycortezwu | last post by:
Hi All, I'm trying to connect to a virtual port (COM19, OUTGOING, "Bluetooth Serial Port") using VS2005 System.IO.Ports. When I ran the ff code below here's what happens. 1) VS2005 Compiles w/o errors 2) My Nokia 6600 prompted me the message "Accept Connection request from DEMON?" note: DEMON is my computers name. 3) Using my Nokia 6600, I hit the button that refers to the "Yes"
0
9811
by: pandi | last post by:
Hi, I am using a check scanner.It has functions which gives output like image ,checknumber. i am using serial port to get this output in my coding. My problem is i am not able to read the display image ( which i scanned using scanner ). I used serail port as well as MSCOMM control.but i couldn't get the output. Can anybody knows this and help me to sort out my problem -- it is very urgent here i am using windows 2000 professional OS and i...
5
9497
by: LongBow | last post by:
Hello, Is there a way, in .NET, to determine what are the avialable Serial (Communications) Ports on a Windows OS and is there a way to determine that port isn't being use other than attempting to opening the Serial Port and catching the associated exception? Thanks If there isn't a way to determine the Serial Port within .NET I would be willing, I guess, to use a WinAPI is that was the only way.
2
3959
by: joaquimfpinto | last post by:
Dear All, I made an app in c# that uses several serial ports. For the serial ports I use a pnp Sunix board, some with 8 serial ports other with 4 or even 2 serial ports. Whenever I use the development computer I don't have ay problem with my application.
3
11628
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
7846
by: Nasif | last post by:
Currently I am writing a program which sends and receives messages through serial port to a device. I am using C# and Microsoft Visual studio 2005 for windows program. But my problem is when i try to write in serial port from my windows a Timeoutexception is thrown. I use SerialPort class in System.IO.Ports and for writing port i used write() function under the built in class SerialPort. But when i use hyperterminal , everything goes fine....
3
1490
by: cmdolcet69 | last post by:
I have these two subs that are being called on two different timers threads. It seems that when I get to the DoDualDSIWorkCOM2 that it keeps passing in the sender and the e as the first serial com and not the second serial com? How can I fix this? Public Sub StartWorkerThreadDualDSI1(ByVal gageType As String, ByVal comPort As Integer) Dim expectedBaudRate As String = "57600" Select Case gageType
0
8833
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
9568
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...
0
9389
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9256
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...
0
8257
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6801
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
6079
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4881
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2218
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.