Set communication parameters in SCU
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.
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 SCU port
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.
This instruction cannot be called by user-defined functions. Use only in programs and function blocks.
Change the communication parameters for the COM port of the CPU unit, using a user program.
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.
By reading setting parameters using the FP_COM_GET_PARAMETER instruction, and setting parameters to be changed using the FP_COM_PMSET instruction, the settings can be simplified.
if the area specified using the index modifier exceeds the limit.
if the area specified using the index modifier exceeds the limit.
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
dutComParameter: FP_COM_PARAMETER_DUT;
bChangeStationNumber: BOOL:=FALSE;
wResult: WORD:=0;
bIsChangeInProgress: BOOL:=FALSE;
bIsChangeError: BOOL:=FALSE;
END_VAR
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 5 ;
NETWORK_BODY
B(B_CONTACT,,bChangeStationNumber,5,2,7,4,);
B(B_F,E_MOVE!,,21,1,27,5,,?DEN?D?AENO?C);
B(B_VARIN,,2,19,3,21,5,);
B(B_VAROUT,,dutComParameter.wStationNumber,27,3,29,5,);
L(1,3,5,3);
L(7,3,21,3);
L(1,0,1,5);
END_NETWORK_BODY
END_NET_WORK
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 6 ;
NETWORK_BODY
B(B_CONTACT,,bChangeStationNumber,5,1,7,3,R);
B(B_CONTACT,,bIsChangeInProgress,5,4,7,6,);
B(B_F,FP_COM_PMSET!,,21,0,31,5,,?DEN?Ds1_Port?Ds2_dutParameter?AENO?Cd_Result);
B(B_VARIN,,SYS_COM0_PORT,19,2,21,4,);
B(B_VARIN,,dutComParameter,19,3,21,5,);
B(B_VAROUT,,wResult,31,2,33,4,);
L(1,2,5,2);
L(1,5,5,5);
L(7,2,21,2);
L(7,5,11,5);
L(11,2,11,5);
L(1,0,1,6);
END_NETWORK_BODY
END_NET_WORK
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 5 ;
NETWORK_BODY
B(B_F,FP_TEST_BIT!,,21,0,29,5,,?DEN?D@'s'?Dn_Pos?AENO?Cd);
B(B_VARIN,,wResult,19,2,21,4,);
B(B_VARIN,,15,19,3,21,5,);
B(B_COIL,,bIsChangeInProgress,35,2,37,4,);
L(1,2,21,2);
L(29,3,35,3);
L(1,0,1,5);
END_NETWORK_BODY
END_NET_WORK
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 5 ;
NETWORK_BODY
B(B_F,FP_TEST_BIT!,,21,0,29,5,,?DEN?D@'s'?Dn_Pos?AENO?Cd);
B(B_VARIN,,wResult,19,2,21,4,);
B(B_VARIN,,14,19,3,21,5,);
B(B_COIL,,bIsChangeError,35,2,37,4,);
L(1,2,21,2);
L(29,3,35,3);
L(1,0,1,5);
END_NETWORK_BODY
END_NET_WORK
END_BODY
IF (bChangeStationNumber) then
dutComParameter.wStationNumber := 2;
END_IF;
IF DF(bChangeStationNumber) OR bIsChangeInProgress then
FP_COM_PMSET(s1_Port := SYS_COM0_PORT,
s2_dutParameter := dutComParameter,
d_Result => wResult);
End_IF;
FP_TEST_BIT(s := wResult, n_Pos := 15, d => bIsChangeInProgress);
FP_TEST_BIT(s := wResult, n_Pos := 14, d => bIsChangeError);