Set Serial Port

Open Device Manager Double-click Ports COM LPT. Right-click the port for which you want to change settings, and then click Properties. On the Port Settings tab.

In order to set it up, first you have to find it on your computer. Long long ago, almost all computers had two serial ports, called COM1 and COM2, one a with a nine pin and the other with a 25 pin connector.

Now times have changed and the serial port has vanished.

Don t give up hope, however. The USB to serial converter has arrived, and it can be used instead. It is usually a dongle which plugs into a USB port, with a nine pin male connecter at the other end.

On my desktop computer, the motherboard has two built in serial ports. The third seial port, here labelled COM4, belongs to the USB to serial adapter I have plugged in.

So, to find the serial port on your computer, scout around its back. If you find a nine pin male connector two rows, five and four, pins sticking out inside a metal shell it has a serial port built in.

Or get a USB to serial converter and plug it in.

Open up Device Manager. Right click on My Computer and select properties at the bottom of the list that pops up. Click on the Hardware tab. Click on the Device Manager button and a something similiar to this picture should appear.

Click on the sign on the left of the Ports COM LPT to expand it. The list of printer and Serial ports available will be shown. Make a note of those, you will need them in the steps that follow.

Setting of the serial port number in the Windows XP OS Right click on desktop icon My Computer and than choose Properties At the pop-up window choose flag.

The most critical phase in serial communications programming is configuring the port settings with the DCB structure. Erroneously initializing the DCB structure is a.

.NET Framework 4.6 and 4.5Other Versions.NET Framework 4

.NET Framework 3.5

.NET Framework 3.0

.NET Framework 2.0

 

Gets or sets the serial baud rate.Namespace:   System.IO.PortsAssembly:  System in System.dll

Copy

BrowsableAttribute true

public int BaudRate get; set;

Exception

Condition

ArgumentOutOfRangeException

The baud rate specified is less than or equal to zero, or is greater than the maximum allowable baud rate for the device.

IOException

The port is in an invalid state.- or -An attempt to set the state of the underlying port failed. For example, the parameters passed from this SerialPort object were invalid.

The baud rate must be supported by the user s serial driver. The default value is 9600 bits per second bps. The following example shows how to set the BaudRate property to 9600.

SerialPort mySerialPort new SerialPort COM1 ;

mySerialPort.BaudRate 9600;

mySerialPort.Parity Parity.None;

mySerialPort.StopBits StopBits.One;

mySerialPort.DataBits 8;

mySerialPort.Handshake Handshake.None;

mySerialPort.RtsEnable true;

The following example demonstrates the use of the SerialPort class to allow two users to chat from two separate computers connected by a null modem cable. In this example, the users are prompted for the port settings and a username before chatting. This code example is part of a larger code example provided for the SerialPort class.

public static void Main

string name;

string message;

StringComparer stringComparer StringComparer.OrdinalIgnoreCase;

Thread readThread new Thread Read ;

// Create a new SerialPort object with default settings.

_serialPort new SerialPort ;

// Allow the user to set the appropriate properties.

_serialPort.PortName SetPortName _serialPort.PortName ;

_serialPort.BaudRate SetPortBaudRate _serialPort.BaudRate ;

_serialPort.Parity SetPortParity _serialPort.Parity ;

_serialPort.DataBits SetPortDataBits _serialPort.DataBits ;

_serialPort.StopBits SetPortStopBits _serialPort.StopBits ;

_serialPort.Handshake SetPortHandshake _serialPort.Handshake ;

// Set the read/write timeouts

_serialPort.ReadTimeout 500;

_serialPort.WriteTimeout 500;

_serialPort.Open ;

_continue true;

readThread.Start ;

Console.Write Name: ;

name Console.ReadLine ;

Console.WriteLine Type QUIT to exit ;

while _continue

message Console.ReadLine ;

if stringComparer.Equals quit, message

_continue false;

else

_serialPort.WriteLine

String.Format : 1, name, message ;

readThread.Join ;

_serialPort.Close ;

public static void Read

try

string message _serialPort.ReadLine ;

Console.WriteLine message ;

catch TimeoutException

.NET FrameworkAvailable since 2.0Return to top

Show: Inherited Protected.

Jan 27, 2007  In some cases, these special input devices can be connected to a computer s serial port the connector commonly used for attaching a modem or printer.

Intro: The serial port - software setup. If you are trying to control something in the real world using your computer, the serial port is perhaps the easiest means of.

This document is for the UART serial port. This port has mostly disappeared from desktops and laptops is still used elsewhere such as for embedded systems.

set serial port