Using SerialPort.BytesToWrite

If SerialPort.Write () is a blocking operation (or it is not) what will the BytesToWrite () method need. He would always evaluate to zero, forcing the last write operation either to succeed in writing all the data, or otherwise, in any case, the bytes to be written would be zero.

Perhaps this is more than what I described.

+3
source share
3 answers

SerialPort.Write- blocking operation, yes. However, two buffers must be considered: a serial device and buffers SerialPort.

SerialPort , , . , , . .

SerialPort , , . (*), , , .

SerialPort.BytesToWrite , SerialPort.

(*) UART , .

+4

- /, . 9600 . , 60 000 000 . , 125 000 000 .

, , , , , UART. Write(). , , , , Write(). WriteBufferSize - BytesToWrite , .

+2

SerialPort BytesToWrite .

On the other hand, the SerialPort Write method (line text) Writes the specified line to the serial port.

Do you know how the serial port works? The sequence sends a certain number of bytes every second, depending on the bot used.

+1
source

All Articles