[Mono-list] Problem with using opening serial port
Mtx
info at mtx-electronics.com
Thu Jun 12 06:22:49 EDT 2008
I'm developing a program in mono v1.9.1 which accesses the serial port & get
a strange I/O exception, this is my test code:
using System;
using System.IO.Ports;
namespace Rs232
{
class MainClass
{
public static void Main(string[] args)
{
SerialPort mySerial;
mySerial = new SerialPort("/dev/ttyUSB0");
try {
mySerial.Open();
} catch (Exception e){
Console.WriteLine(e);
}
}
}
}
If I compile & run this on my laptop it works perfectly, but when I run it
on my desktop i get the following error:
System.IO.IOException: I/O Error
at System.IO.Ports.SerialPortStream.SetSignal (SerialSignal signal,
Boolean value) [0x00000]
at (wrapper remoting-invoke-with-check)
System.IO.Ports.SerialPortStream:SetSignal
(System.IO.Ports.SerialSignal,bool)
at System.IO.Ports.SerialPortStream..ctor (System.String portName, Int32
baudRate, Int32 dataBits, Parity parity, StopBits stopBits, Boolean
dtrEnable, Boolean rtsEnable, Handshake handshake, Int32 readTimeout, Int32
writeTimeout, Int32 readBufferSize, Int32 writeBufferSize) [0x00000]
at (wrapper remoting-invoke-with-check)
System.IO.Ports.SerialPortStream:.ctor
(string,int,int,System.IO.Ports.Parity,System.IO.Ports.StopBits,bool,bool,System.IO.Ports.Handshake,int,int,int,int)
at System.IO.Ports.SerialPort.Open () [0x00000]
at (wrapper remoting-invoke-with-check) System.IO.Ports.SerialPort:Open ()
at Rs232.MainClass.Main (System.String[] args) [0x0000b] in
/home/mtx/workspace/Mono/RS232/Rs232/Main.cs:19
No matter what port I use (ttyS0,ttyUSB0) I always get this same error...
--
View this message in context: http://www.nabble.com/Problem-with-using-opening-serial-port-tp17796781p17796781.html
Sent from the Mono - General mailing list archive at Nabble.com.
More information about the Mono-list
mailing list