C++ serial port send command

Posted by Ilyssis on Stack Overflow See other posts from Stack Overflow or by Ilyssis
Published on 2011-03-02T23:13:32Z Indexed on 2011/03/02 23:24 UTC
Read the original article Hit count: 215

Filed under:
|

Hi there,

I have a hardware here, wich communicates over serial port. I use MS Visual C++ 2010, and I want to send a command: <-S->

I am doing this:

SerialPort^ serialPort = gcnew SerialPort(portName , 9600, Parity::None, 8, StopBits::One);
serialPort->Open();
serialPort->WriteLine("<-S->");
serialPort->Close();

But the command that goes out is <-S->., and not <-S-> (please notice the point that is attached to the outgoing command). I use Free Serial Port Monitor to watch my ingoing/outcoming data.

So how can I get rid of that point in <-S->. ?

This is what is going out:

3C 2D 53 2D 3E 0A = <-S->.

This is what I want:

3C 2D 53 2D 3E = <-S->

Thanks for help.

© Stack Overflow or respective owner

Related posts about c++

Related posts about visual-studio-2010