z Windows serial communication 
Author Message
 z Windows serial communication

Hello,

Many thanks and kudos to Issac Barona for his serial communications python
enhancements, which I downloaded from
http://www.*-*-*.com/

From this collection, which I have been using and studying, I have been
examining SerialPort_win.py, and I cannot find where there is an input
buffer that I can access after calling self.read(n). I do not know Python
well enough yet to modify SerialPort_win.py, but I will try to learn now.

Of course, I will welcome any help from anyone willing to save me a little
time. I have emailed to Mr. Barona, but he has not replied.

I notice that self.read(n) generates an exception when Win32 API's
ReadFile(...) times out. For my own purposes, I prefer not to generate an
exception unless ReadFile() returns FALSE, denoting a communication error
such as a framing error or parity error. In particular, my understanding of
ReadFile(..) is that it treats a timeout as a normal event and returns TRUE
when there is a timeout, even if lnNumberOfBytesToRead points to a different
value than lpNumberOfBytesRead. I can detect a failed receive operation this
way:

if (lnNumberOfBytesToRead != *lpNumberOfBytesRead){
// protocol error: did not receive expected number of bytes

Quote:
}

When I am receiving a packet, I decide that the sender is finished sending
when I have waited long enough after the last received character, that is,
when ReadIntervalTimeout as set in SetCommTimeouts(..) is allowed by the
sender to expire. It is after that event that I parse the received message.

I have modified SerialPort_win.py accordingly.
I will be glad to share my work with anyone interested, and I will gladly
accept anyone's help.

I have written TP3, a small multithreaded Win32 API app (VC++ project) that
sends and receives, via the serial port, binary data translated from ASCII
entered on the keyboard. If you have a 2nd PC and a null-modem cable to
connect your two PCs, this makes a nice way to test Mr. Barona's software.
Since the app is changing from day to day, I will wait for someone to
express an interest before posting the source somewhere.

Spencer Doidge



Thu, 22 Jul 2004 10:40:26 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Serial communication under Windows

2. Serial Communications in MS Windows

3. Clipper Serial Communications under Windows NT 4.0

4. Serial communication, Windows GetCommError

5. RXCOMM.DLL for windows, provides access to serial communications devices

6. Serial communication with GNAT on a Windows-PC

7. help with serial port communication from Windows

8. trouble with serial communication (serial port init.vi)

9. Serial Port Communication

10. Serial communication in APL2000

11. Serial Communication with Smalltalk?

12. APL+Win, NT and Serial Communications

 

 
Powered by phpBB® Forum Software