0

I open 2 serial port monitors which can send and receive data.

Also I have 2 virtual com ports, com3 and com4.

When I press for example "test" on the one and send it, the other receives it.
If I try to send an other text for example test2 then the other one receives it on a new line.

Example:

test

test2

I wrote a small vb.net program to send and receive data.

My vb.net program on com3 and the other monitor program on com4. I have a button and inside the button the code:

SerialPort1.Write("test")

If I press the button 1 time the other program shows: test If I press it again the other program shows: testtest

So why with my program the other monitor just merges the text and doesn't add a new line?

I tried

SerialPort1.WriteLine("test")

But that will only print if i press the button twice: testtest

I even tried + Chr(13) but that will only print <cr> on the other monitor and not a new line..

what is all the others programs doing that my little program is not doing?

djv
  • 15,168
  • 7
  • 48
  • 72
Christ
  • 9
  • 2
  • 1
    The receiving monitor, how exactly is that printing what it is receiving? Is this actually a problem with the sending end of things? – Hursey Dec 09 '21 at 21:24
  • 2
    In the protocol you're using is there a termination character/s? What is `SerialPort1.NewLine`? If you don't set it, the default is Chr(10) or NewLine. You may want to test others such as Environment.NewLine which is Chr(13) & Chr(10) (or just build different combinations). Btw Chr(13) is a carriage return only – djv Dec 09 '21 at 21:49
  • I highly doubt this is the issue, but sometimes flushing the serialport buffer can be helpful. `.Flush();` – MRxParkour Dec 09 '21 at 23:18
  • The following may be helpful: https://stackoverflow.com/questions/65957066/serial-to-usb-cable-from-a-scale-to-pc-some-values-are-just-question-marks/65971845#65971845 – Tu deschizi eu inchid Dec 10 '21 at 03:46

0 Answers0