[PD] pd and serial object

rat at telecoma.net rat at telecoma.net
Thu Apr 25 09:51:20 CEST 2002

On Thu, 25 Apr 2002, Winfried Ritsch wrote:

> Hello,
>  > 
>  > has there been any development on a serial object for win2k in pd.  i'm 
>  > interested in using it an installation and am dissatisfied withe the 
>  > results i get from the serial object in max.
>  > 
> there is a external comport (windows and unix) which works under some
> W95/98, but was never finished stable for windows, since I didnt
> manage all the win$ -stuff, even if I used the examples of the
> msn-library ???
> Maybe some Window guru can fix this simple... and send me the
> corrections:
> see http://iem.kug.ac.at/pdwiki/index.php?ComPort
> mfg winfried ritsch


in mail http://iem.kug.ac.at/mailinglists/pd-list/2001-12/0159.html
from mark newman seems to be a solution for the win2k comport
 I grabbed Winfried Ritsch's comport object and code from

 ... as I assume you have already done, and I was able to get it to work
on Win2K for reading data, though I had to make one minor adjustment. I
changed the arguments to CreateFile inside the open_serial method so that
it uses non-overlapped (i.e., blocking) reads.
Here's the actual call, with my changes:

    fd = CreateFile( sys_com_port[com_nr],

             /* FILE_FLAG_OVERLAPPED */ 0, // changed to non-overlapped

  ... and now it works. I believe this is the correct way to open the
port, since the code is in fact polling (every millisecond, by default)
and not in fact using asynchronous reads. Changing the object to use
overlapped/asynchronous reads would probably be an even better fix, but
that'll have to be for another time.



More information about the Pd-list mailing list