serial port - SerialPort data loss - C# -


I am working on a serial port app and a very simple part of it is giving me issues. Want to read a continuous stream of data and it comes as soon as typing it into a binary file. The speed of the problem looks like: My code worked fine on 9600 baud test devices, but when it was taken 115200bps live device, I think what happens after a variable period of data loss, I miss 1 byte I have tried a few things:

  Private Zero Serial Port 1_DataReceived (Object Sender, SerialDataReceivedEventArgs E) {bwLogger.Write (byte) serialPort1.ReadByte ( )); }  

or

  Private Zero Serial Port1_DataReceived (Object Sender, SerialDataReceivedEventArgs E) {Byte [] inc = New Byte [serialPort1.BytesToRead]; SerialPort1 Read (inc, 0, inc.Length); BwLogger.Write (Inc.); }  

And some differences I can not use ReadLine () because I'm working with a continuous stream data (right?). I have tried negligible with buffer size (both serialPort1.ReadBufferSize and hardware FIFO buffer). Ideally, for the purposes of usability, I handle it on behalf of the software and it does not have to change the user in the driver settings of Windows.

Any thoughts?

You can try to enable hands using serial port objects handshake properties .

You have to set it on the sender or both receivers. However: If you uncover the UERT buffer (very small, 16 bytes IIRC) of the receiver, then there is probably no other way. If you can not enable handshaking on the sender, then you probably have to stay at 9600 or less.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -