4. Configuration
197
This variable is true when the block is completely executed. It is false
otherwise.
This variable is true while the block is being executed. It is false otherwise.
This variable is true when the block concludes the execution with an error. It
is false otherwise. It is connected to the variable DONE, as its status is
showed after the block conclusion.
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
- NOT_CONFIGURED
This structure receives the serial port configuration parameters, as described
in the SERIAL_PARAMETERS data type.
Table 4-132. SERIAL_GET_CFG Output Parameters
Utilization example in ST language, after the library is inserted in the project:
PROGRAM MainPrg
VAR
GetConfig: SERIAL_GET_CFG;
Port: SERIAL_PORT := COM1;
Parameters: SERIAL_PARAMETERS;
Status: SERIAL_STATUS;
END_VAR
//INPUTS:
GetConfig.REQUEST := TRUE;
GetConfig.PORT := Port;
//FUNCTION:
GetConfig();
//OUTPUTS:
GetConfig.DONE;
GetConfig.EXEC;
GetConfig.ERROR;
Status := GetConfig.STATUS; // If it’s necessary to treat the error.
Parameters := GetConfig.PARAMETERS; //Receive the parameters of desired serial port.
SERIAL_GET_CTRL
This function block is used to read the CTS, DSR and DCD control signals, in case they are available
in the serial port. A false value will be returned when there are not control signals.
Figure 4-95. Block Used to Visualize the Control Signals