hey does anyone have any sample code for using the comport extension to read serial data coming in?
i'm using a bx-24 to send in adc values off a variable resistor.
thanks for the help, paul
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
I grabbed Winfried Ritsch's comport object and code from
http://iem.kug.ac.at/ritsch/programmier/pd_externals/
... 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], rw, 0, 0, OPEN_EXISTING, /* FILE_FLAG_OVERLAPPED */ 0, // changed to non-overlapped --mwn 0);
... 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.
Unfortunately I can't provide an example patch offhand that uses the fixed comport since for performance reasons I had to further modify the object to work with the A/D converter I was talking to--so it's not really the same object anymore.
I hope this helps.
--mark
-----Original Message----- From: Floppo : [mailto:cityidiot@hotmail.com] Sent: Sunday, December 09, 2001 7:58 PM To: pd-list@iem.kug.ac.at Subject: [PD] comport code
hey does anyone have any sample code for using the comport extension to read serial data coming in?
i'm using a bx-24 to send in adc values off a variable resistor.
thanks for the help, paul
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp