Question regarding win32comport_demo.py

MDK mdk at mdk.com
Fri Feb 1 09:26:32 EST 2002


Actually, yes, that does help.

The reason behind this is I am trying to uderstand where I am getting the
data from as the example uses a continusly looping thread to get the data
which, in light of what you are saying, is not necessary.  Once the
CreateFile() is done then I can just access the memory buffer.

Thanks.

"Peter Hansen" <peter at engcorp.com> wrote in message
news:3C59CC8E.8AC2E485 at engcorp.com...
> MDK wrote:
> >
> > Does this program read from the Serial Port's Memory Buffer, the UART
> > Buffer, or something else?
>
> It does a ReadFile() in only one place, where it uses the handle which
> was returned from a previous call to CreateFile().  The way serial
> i/o works on most machines is that the UART generates a hardware
> interrupt when new data is received.  That interrupt triggers execution
> of an interrupt service routine (ISR), usually (and in the case of Win32)
> provided by the OS or in a driver.  The ISR adds the data into a
> memory buffer the size of which might be controllable via an API call
> (and again, in the case of Win32, I believe it is).  The file object
> which wraps the serial port is connected to this memory buffer so
> that reads come from there.
>
> Does that help?  You didn't describe the reason behind your question,
> which might be more helpful in soliciting a useful reply.  Why
> do you think you need to know this type of detail?
>
> -Peter





More information about the Python-list mailing list