Set communication parameters for CPU/SCU/MCU port
This FP instruction sends changes to communication parameters to the unit. Changes are specified by s2_dutParameter for the communication port specified by s1_Port. If the communication mode is set to PLC link, the PLC link parameters can be specified by s3_dutPlcLinkParameter.
When using this instruction, please make sure that the communication mode of the appropriate port is set to PLC link.
Input
Specifies the communication ports depending on the PLC type:
COM port e.g. SYS_COM0_PORT
Ethernet port e.g. SYS_ETHERNET_USER_CONNECTION_1
MCU/SCU e.g. 16#xx01 (xx = slot number) in COM01
Parameters to be set for CPU/SCU/MCU port
Parameters to be set for PLC link
Output
Starting address of the memory area in the master unit that stores the processing result (1 word)
Content of the processing result d_Result
FALSE: Normal completion
TRUE: Abnormal completion
FALSE: Process is completed
TRUE: Process is in progress
Before you execute the instruction, make sure that the bit 15 (process in-progress flag) of the processing result storage area specified by dResult is FALSE.
If parameter change is carried out for a COM port where sending/receiving is in progress, the sending/receiving process is cancelled and parameters are changed. At this time, received data are lost. The sending process is suspended.
While the requested change is being processed, Bit 15 of the processing result storage area d_Result turns to TRUE. When the process is completed, it turns to FALSE.
The processing result is stored in the area specified by d_Result. If an error occurs, the execution result flag (bit 14) is turned to TRUE. The error code is stored in lower bytes of d_Result.
if the area specified using the index modifier exceeds the limit.
if the communication mode of the appropriate port is not set to PLC link
if the area specified using the index modifier exceeds the limit.
if the communication mode of the appropriate port is not set to PLC link
All input and output variables used for programming this function have been declared in the POU header.The same POU header is used for all programming languages.
VAR
nPort: INT;
dutParameter: FP_COM_PARAMETER_DUT;
dutPlcLinkParameter: FP_COM_PLCLINK_PARAMETER_DUT;
wResult: WORD:=0;
bEnable: BOOL:=FALSE;
END_VAR
When the variable bEnable is set to TRUE, the function is executed.
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 7 ;
NETWORK_BODY
B(B_CONTACT,,bEnable,3,2,5,4,);
B(B_F,FP_COM_SET_PARAMETER!,,12,1,25,7,,?DEN?Ds1_Port?Ds2_dutParameter?Ds3_dutPlcLinkParameter?AENO?Ad_Result);
B(B_VARIN,,nPort,10,3,12,5,);
B(B_VAROUT,,wResult,25,3,27,5,);
B(B_VARIN,,dutParameter,10,4,12,6,);
B(B_VARIN,,dutPlcLinkParameter,10,5,12,7,);
L(1,0,1,7);
L(1,3,3,3);
L(5,3,12,3);
END_NETWORK_BODY
END_NET_WORK
END_BODY
if (bEnable) then
FP_COM_SET_PARAMETER(s1_Port := nPort,
s2_dutParameter := dutParameter,
s3_dutPlcLinkParameter := dutPlcLinkParameter,
d_Result => wResult);
end_if;