[PD] writing to the serial port with [comport]

Hans-Christoph Steiner hans at eds.org
Tue Apr 25 20:11:08 CEST 2006


On Apr 25, 2006, at 5:54 PM, Hans-Christoph Steiner wrote:

>
> On Apr 25, 2006, at 4:23 PM, Mathieu Bouchard wrote:
>
>> On Mon, 24 Apr 2006, Hans-Christoph Steiner wrote:
>>
>>> I am trying to write data from Pd to Arduino.  Has anyone used  
>>> [comport]
>>> to write out serial data before?  Any example patches?  I can  
>>> only get
>>> TX_OVERRUNS errors.
>>
>> If CTS/RTS pins aren't connected properly then the computer's UART  
>> might
>> be supposing that the device is not there and so it will  
>> accumulate data
>> until the buffer overflows, a situation which gets trapped and  
>> becomes a
>> TX_OVERRUNS.
>
> No data ever gets thru when writing to the serial port, and on  
> reading works fine as it is.  So I don't think CTS/RTS is  
> required.  Its not used on GNU/Linux or Mac OS X.

I am pretty sure I have found the problem:

#ifdef WIN2000
		   0,
#else
		   FILE_FLAG_OVERLAPPED,
#endif

By default, this object is compiled with the FILE_FLAG_OVERLAPPED  
mode, which enables asynchronous writing to the serial port.  But  
none of the Windows code is written to use the OVERLAPPED struct,  
which is required when in async mode.  Therefore, no data gets written.

But there is a exceedingly simple solution: remove the WIN2000 hack  
all together and just use with sync mode, which is what the code is  
doing anyway.  But I don't have a Windows machine to test this on  
right now, any volunteers?

.hc

________________________________________________________________________ 
____

"Computer science is no more related to the computer than astronomy  
is related to the telescope."
                                                           -Edsger  
Dykstra





More information about the Pd-list mailing list