I have a reference to Microsoft.SPOT.Hardware.Serial, but when I use
Intellisense, I can get as far as Microsoft.SPOT.Hardware, and after that
there are no options.
On the other hand, System.IO.Ports has a SerialPort class with constructors
but no methods, so it’s not clear how to actually do anything.
Here's an example of the 2.5 code we have now.
SerialPort.Configuration _serialConfig;
SerialPort _sp;
_serialConfig = new SerialPort.Configuration(SerialPort.Serial.COM1,
SerialPort.BaudRate.Baud115200,
false);
Ideas? Thx, Bill
2. Add a new reference to the references: Microsoft.SPOT.Hardware.SerialPort
3. Add a new using statement: using System.IO.Ports
4. The serial configuration is no longer used, so comment those statements.
The SerialPort class now has overloaded constructors that accept the
configuration arguments directly, i.e.
SerialPort mySerialPort = new SerialPort("COM2", BaudRate.Baudrate115200,
Parity.None, 8, StopBits.None);
Note that the integer values for the baudrate, parity, etc can be used. The
serial port identifier is now the string that names the serial port, "COM1",
"COM2", etc.
5. You can specify the handshake mode via SerialPort Handshake property,
i.e.
mySerialPort.Handshake = Handshake.None;
6. Before writing to or reading from the serial port, it now must be
explicitly opened, i.e.
mySerialPort.Open();
7. The Write & Read method now has 3 paramenters: pointer to the byte
buffer, the offset into the buffer to start at, and the number of bytes to
write or read, i.e.:
mySerialPort.Write(WriteBuffer, 0, 4);
mySerialPort.Read(ReadBuffer, 0, ReadBuffer.Length);
8.) If you are through with the serial port, do an explicit close, i.e.
mySerialPort.Close();
I think that should give you what you need to convert your earlier serial
applications.
Regards,
-JRMalin, SJJ Embedded Micro Solutions
"Bleary Eye" <Blea...@discussions.microsoft.com> wrote in message
news:13D6B11F-8D71-478C...@microsoft.com...
"JRMalin" wrote:
> .
>
This is valid syntax:
Microsoft.SPOT.Hardware.Cpu.Pin rx, tx, cts, rts;
Microsoft.SPOT.Hardware.HardwareProvider.HwProvider.GetSerialPins("COM1",
out rx, out tx, out cts, out rts);
after this call, the rx variable will contain number of processor pin on
which the data arrives to COM1, other signals similar.
Jan
"Dheeraj Pulluri" <Dheeraj...@discussions.microsoft.com> wrote in
message news:95177F38-D261-4B88...@microsoft.com...