Artem Makarov
Artem Makarov

Reputation: 874

COM device communication

I need to send commands to my COM device. When I work with HyperTerminal it works great like:

on sd 1 255 255 9 100 255 0 of

and it works great... But when I run my console C# code like this:

var port = new SerialPort(SerialPort.GetPortNames()[0], 115200);
        port.Handshake = Handshake.RequestToSendXOnXOff;
        port.Open();
        port.WriteLine("on");
        Thread.Sleep(500);
        port.WriteLine(sd 1 255 255 9 100 255 0);
        Console.ReadLine();
        port.WriteLine("of");
        port.Close();

Nothing happens :( What's the problem? I've tryed all of Handshakes - still nothing.

Upvotes: 0

Views: 628

Answers (1)

Artem Makarov
Artem Makarov

Reputation: 874

Make sure you are sending CR-LF ("\r\n"): carriage return (0x0A), line feed (0x0D) after your command

Upvotes: 2

Related Questions