counter.ReadLine()
will only return when a newline character is read, which according to the specifications given by you will never happen.
After the first input, you expect one byte of output back, so you should read one byte. Then you need to send a c
, after which you'll have to read until you encounter an <
.
So something like this should work:
SerialPort serialPort = new SerialPort("COM5", 9600, Parity.None, 8, StopBits.One);
var esc = new byte { 27 };
var c = new byte { 99 };
serialPort.Write(esc, 0, 1);
serialPort.ReadTo(">"); // Or ReadByte() and check if the byte read has a value of 62
serialPort.Write(c, 0, 1);
string data = serialPort.ReadTo("<");
Then you can parse the data string to whatever format you expect it to be.