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

Kamil Skalski kamil.skalski at gmail.com
Tue Aug 28 11:12:58 EDT 2007


2007/8/28, David Arnaud-Goddet <david.goddet at gmail.com>:
> Hi all,
>
> I use the System.IO.Ports class to configure a RS232 connection.
> In fact my program must open a serial port and read information send by a
> medical device (an oxymeter).
>  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).

Usually it is good to look at Microsoft's documentation for framework classes:
http://msdn2.microsoft.com/en-us/library/system.io.ports.serialport.aspx

> I try to use this peice of code but I obtain a TimeoutException.

So you are probably not receiving any data, but there might be several reasons.

> 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...

This number is baud rate. See docs:
http://msdn2.microsoft.com/en-us/library/8bt1b81c.aspx

>
> Moreover I don't find the System.IO.Ports documentation in the mono doc :
> http://www.go-mono.com/docs!
> I suppose that this documentation class has not yet been entered...
>
> Thanks in advance.
>
> --
> David ARNAUD-GODDET
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>


-- 
Kamil Skalski
http://nazgul.omega.pl



More information about the Mono-devel-list mailing list