[Mono-dev] [System.IO.Ports] How to configure the serial port?

Paolo Molaro lupus at ximian.com
Thu Aug 30 07:25:28 EDT 2007


On 08/28/07 David Arnaud-Goddet wrote:
> I find that :http://www.mono-project.com/HowToSystemIOPorts
> But it doesn't explain how to configure the serial port (baudrate, Data
> bits, Parity, Stop bits and Flow control).
> I try to use this peice of code but I obtain a TimeoutException.
> My application works on Windows but it will be able to work on Unix too!
> I'm not sure of this line code :
> 
> mySerial = new SerialPort("/dev/ttyS0", 38400);
> 
> I change "/dev/ttyS0" by "COM7" (the oxymeter is detected on this port in
> Windows) and I don't know what is the number 38400...

Run setserial -g /dev/ttyS* on your system and see which serial ports
are present (usually /dev/ttyS0 is the equivalent of COM1, IIRC).
As for the configuration, there is a proper ctor that takes all the
needed arguments:
	public SerialPort (string portName, int baudRate, Parity parity, int dataBits, StopBits stopBits) 

lupus

-- 
-----------------------------------------------------------------
lupus at debian.org                                     debian/rules
lupus at ximian.com                             Monkeys do it better



More information about the Mono-devel-list mailing list