[PythonCE] Accessing serial port with PythonCE 2.5

Luke Dunstan coder_infidel at hotmail.com
Wed Jan 3 14:37:23 CET 2007


----- Original Message ----- 
From: "David Goncalves" <pythonce-ml at lestat.st>
To: <pythonce at python.org>
Sent: Wednesday, January 03, 2007 3:09 AM
Subject: [PythonCE] Accessing serial port with PythonCE 2.5


> Hi,
>
> Everything is in the subject ;)
>
> Is there any way to access the serial port with that build of PythonCE ?
> I've not found any 'serial' module to import.
>
> Regards.

Well there is no "serial" module included with PythonCE, but Python on my PC 
doesn't have such a module either. I haven't done it myself on PythonCE but 
I think the best way would be to use ctypes to access the Win32 serial 
communications APIs. I have written some code to do this on the PC, so I 
have attached it.

This code is not intended to be particularly efficient because I only used 
it to write a serial protocol simulator, but hopefully it is fairly simple 
to use. Again, I haven't tried it on Windows CE but I think it should work 
with minor changes. For example, I can see that SerialPort.__init__() would 
have to be modified slightly to open e.g. "COM1:" instead of "\\.\COM1".

Luke
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: winserial.py
Url: http://mail.python.org/pipermail/pythonce/attachments/20070103/90337155/attachment.asc 


More information about the PythonCE mailing list