FP_COM_SET_PARAMETER

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.

NOTE

When using this instruction, please make sure that the communication mode of the appropriate port is set to PLC link.

Input

s1_Port (WORD, INT, UINT)

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

s2_dutParameter (FP_COM_PARAMETER_DUT)

Parameters to be set for CPU/SCU/MCU port

s3_dutPlcLinkParameter (FP_COM_PLCLINK_PARAMETER_DUT)

Parameters to be set for PLC link

Output

d_Result (WORD, INT, UINT)

Starting address of the memory area in the master unit that stores the processing result (1 word)

Content of the processing result d_Result

  1.  (1) Higher byte
  2.  (2) Execution result flag

    FALSE: Normal completion

    TRUE: Abnormal completion

  3.  (3) Process-in-progress flag

    FALSE: Process is completed

    TRUE: Process is in progress

  4.  (4) Lower byte (set only when processing is done)
    • 0: Normal completion
    • 1: The specified communication port is invalid
    • 2: Setting error
    • 3: Mode change error
    • 4: The specified communication port is occupied
    • 5: Inconsistency of parameters to be changed (at the start/end of the setting process, parameters specified by operands are inconsistent)
    • 7: Unit number setting on the front panel of the multi-wire link unit (when the rotary switch is not set to 0)

Remarks

  • 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.

Error flags

sys_bIsOperationErrorHold (turns to TRUE and remains TRUE)
  • 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

sys_bIsOperationErrorNonHold (turns to TRUE for one scan)
  • 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

Example

POU header

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

LD body

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

ST body

if (bEnable) then
FP_COM_SET_PARAMETER(s1_Port := nPort,
                     s2_dutParameter := dutParameter,
                     s3_dutPlcLinkParameter := dutPlcLinkParameter, 
					 d_Result => wResult);
end_if;

Modified on: 2024-03-06Feedback on this pagePanasonic hotline