Re: Non-Standard baudrates opening COM ports by Paul
Paul
Thu Mar 02 10:21:28 CST 2006
Shouldn't there be a colon at the end of "COM2"?
I haven't had occasion to use the serial classes much, but my guess is that
you'd use things in the .Serial namespace with other things in the .Serial
namespace, so OpenNETCF.IO.Serial.BAUD.BAUD_USER would logically go with
OpenNETCF.IO.Serial.Port.
Again, if you really want to know if the driver support random baud rates,
write a simple C++ program to open and configure the port and see if you get
an error. If not, then it's possible. If so, then any screwing around with
managed code is irrelevant.
Paul T.
"minimega" <minimega@libero.it> wrote in message
news:1141291840.572702.71720@z34g2000cwc.googlegroups.com...
> Hi Paul, thanks for the reply.
>
> 1) Can you explain me why in this simple code the
> OpenNETCF.IO.Ports.SerialPort class raises a 53-Create file error and
> OpenNETCF.IO.Serial.Port class is able to open and close COM2?
>
> // CLASS OpenNETCF.IO.Ports.SerialPort
> OpenNETCF.IO.Ports.SerialPort serialPort = new
> OpenNETCF.IO.Ports.SerialPort("COM2", 19200,
> OpenNETCF.IO.Ports.Parity.None, 8, OpenNETCF.IO.Ports.StopBits.One);
>
> serialPort.Open();
> serialPort.Close();
>
> // CLASS OpenNETCF.IO.Serial.Port
> OpenNETCF.IO.Serial.BasicPortSettings settings = new
> OpenNETCF.IO.Serial.BasicPortSettings();
> settings.BaudRate = OpenNETCF.IO.Serial.BaudRates.CBR_19200;
> settings.ByteSize = 1;
> settings.Parity = OpenNETCF.IO.Serial.Parity.none;
> settings.StopBits = OpenNETCF.IO.Serial.StopBits.one;
>
> OpenNETCF.IO.Serial.Port port = new
> OpenNETCF.IO.Serial.Port("COM2", settings);
> port.Open();
> if (port.IsOpen)
> port.Close();
>
> 2) The OpenNETCF.IO.Serial.BAUD.BAUD_USER enumarator can be used to set
> non-standard baudrates? How can be used? With wich class must I use it:
> OpenNETCF.IO.Serial.Port or OpenNETCF.IO.Ports.SerialPort?
>
> thanks,
> Massimo
>