5. CONFIGURATION
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
- ILLEGAL_SERIAL_MODE
- ILLEGAL_BAUDRATE
- ILLEGAL_DATA_BITS
- ILLEGAL_PARITY
- ILLEGAL_STOP_BITS
- ILLEGAL_HANDSHAKE
- ILLEGAL_UART_RX_THRESHOLD
- PORT_BUSY
- HW_ERROR_UART
- HW_ERROR_REMOTE
- DCD_INTERRUPT_NOT_ALLOWED
- CTS_INTERRUPT_NOT_ALLOWED
- DSR_INTERRUPT_NOT_ALLOWED
Table 172: SERIAL_CFG Output Parameters
Utilization example in ST language, after the library Nexto Serial is inserted in the project:
PROGRAM UserPrg
VAR
Config: SERIAL_CFG;
Port: SERIAL_PORT := COM1;
Parameters: SERIAL_PARAMETERS := (BAUDRATE := BAUD9600,
DATABITS := DATABITS_8,
STOPBITS := STOPBITS_1,
PARITY := PARITY_NONE,
HANDSHAKE := RS232_RTS,
UART_RX_THRESHOLD := 8,
MODE :=NORMAL_MODE,
ENABLE_RX_ON_TX := FALSE,
ENABLE_DCD_EVENT := FALSE,
ENABLE_CTS_EVENT := FALSE);
Status: SERIAL_STATUS;
END_VAR
//INPUTS:
Config.REQUEST := TRUE;
Config.PORT := Port;
236