TCnSerialPort.Write(String) Method

Writes the specified string to the serial port.

Namespace: CNClrLib.Component.SerialPort
public
 procedure Write(text: String); overload;

Parameters

text
Type: String

The string for output.

Use this method when you want to write a string as output to a serial port.

If there are too many bytes in the output buffer and Handshake is set to XOnXOff then the SerialPort object may raise a TimeoutException while it waits for the device to be ready to accept more data.

By default, SerialPort uses ASCIIEncoding to encode the characters. ASCIIEncoding encodes all characters greater than 127 as (char)63 or '?'. To support additional characters in that range, set Encoding to UTF8Encoding, UTF32Encoding, or UnicodeEncoding.