4. Configuration
205
This variable, when true, enables the function
block use.
Select the serial port, as described in the
SERIAL_PORT data type.
Value to be written on RTS signal.
Enables the RTS_VALUE parameter writing.
Value to be written on DTR signal.
Enables the DTS_VALUE parameter writing.
In case it’s true, enables logic 0 (busy) in the
transmission line.
Table 4-143. SERIAL_SET_CTRL Input Parameters
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
- FB_SET_CTRL_NOT_ALLOWED
- NOT_CONFIGURED
Table 4-144. SERIAL_SET_CTRL Output Parameters
Utilization example in ST language, after the library is inserted in the project and the serial port
configured:
PROGRAM MainPrg
VAR
Set_Control: SERIAL_SET_CTRL;
Port: SERIAL_PORT := COM1;
Status: SERIAL_STATUS;
END_VAR
//INPUTS:
Set_Control.REQUEST := TRUE;
Set_Control.PORT := Port;
Set_Control.RTS_VALUE := FALSE;
Set_Control.RTS_EN := FALSE;
Set_Control.DTR_VALUE := FALSE;
Set_Control.DTR_EN := FALSE;
Set_Control.BREAK := FALSE;
//FUNCTION:
Set_Control();
//OUTPUTS:
Set_Control.DONE;
Set_Control.EXEC;
Set_Control.ERROR;
Status := Set_Control.STATUS; // If it’s necessary to treat the error.