Send Data Request as String in C# to comms port

c#, communication

Solution

You need to use escape codes;

serialPort1.Write("\x02TY000D\x03");

Problem

I need to send a write method as a string in C# to a com port. It should be enclosed btween stx and etx. e.g. serialPort1.write("02TY000D03") - where the 02 and 03 are stx and etx. Could someone provide a quick example please as I don't think the code above is correct? Many thanks Darren.

Original source