FP_COM_PMSET

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.

Parameters

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 SCU port

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

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.

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

Error flags

sys_bIsOperationErrorHold (turns to TRUE and remains TRUE)
  • if the area specified using the index modifier exceeds the limit.

sys_bIsOperationErrorNonHold (turns to TRUE for one scan)
  • if the area specified using the index modifier exceeds the limit.

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
		dutComParameter: FP_COM_PARAMETER_DUT;
		bChangeStationNumber: BOOL:=FALSE;
		wResult: WORD:=0;
		bIsChangeInProgress: BOOL:=FALSE;
		bIsChangeError: BOOL:=FALSE;
	END_VAR

LD body

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

ST 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);

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