serial port


Hi,

Im trying to make a program to communicate with something that is connected with the serial port.

The device i wanna connect to the serial port knows several commands.

So basically there needs to be a simple connection with the port so that i can put commands in the console and the device reply's me and sets its output on the console.

So far i got this:

static SerialPort serialPort;


public static void Main()
{
serialPort = new SerialPort("COM1", 19200, Parity.None, 8, StopBits.One);
}


I hope someone could help me a bit.

Thanks in advance!


Answer this question

serial port

  • YMaod

    You should configure serial port as needed, Open() it and then call Read*() methods to receive and Write*() methods to send data. You can also subscribe to DataReceived event for receiving data. MSDN has samples on how to do that, please look up SerialPort class.



  • MJAnderson

    You need to ask specific question. Please see this, items 7 and 15:

    http://www.danielmoth.com/Blog/2005/03/please-read-before-posting-to-ng.html



  • tradle

    How do i send and receive data to the device which is connected to the serial port.

  • serial port