5. CONFIGURATION
Input parameters Type Description
CLEAR_RX_
BEFORE_TX
BOOL
When true, the RX queue and the UART
FIFO RX are erased before the transmis-
sion beginning. This behavior is typical in
half-duplex master/slave protocols.
Table 187: SERIAL_TX Input Parameters
Output parameters Type Description
DONE BOOL
This variable is true when the block is com-
pletely executed. It is false otherwise.
EXEC BOOL
This variable is true while the block is be-
ing executed. It is false otherwise.
ERROR BOOL
This variable is true when the block con-
cludes the execution with an error. It is
false otherwise. It is connected to the vari-
able DONE, as its status is showed after the
block conclusion.
STATUS SERIAL_STATUS
In case the ERROR variable is true, the
STATUS structure will show the error
found during the block execution. The
possible states, already described in the
SERIAL_STATUS data type, are:
- NO_ERROR
- ILLEGAL_SERIAL_PORT
- PORT_BUSY
- HW_ERROR_UART
- HW_ERROR_REMOTE
- ILLEGAL_TX_BUFF_LENGTH
- ILLEGAL_TIMEOUT
- CTS_TIMEOUT_ON
- CTS_TIMEOUT_OFF
- TX_TIMEOUT_ERROR
- NOT_CONFIGURED
TX_TRANSMITTED UINT
Returns the transmitted byte number which
must be equal to TX_BUFFER_LENGTH,
but can be smaller in case some error has
occurred during transmission.
Table 188: SERIAL_TX Output Parameters
Utilization example in ST language, after the library is inserted in the project and the serial port configured:
PROGRAM UserPrg
VAR
Transmit: SERIAL_TX;
Port: SERIAL_PORT := COM1;
Buffer_Pointer: ARRAY [0..9] OF BYTE := [0,1,2,3,4,5,6,7,8,9];
Status: SERIAL_STATUS;
END_VAR
//INPUTS:
250