FP_UNIFY_DIGITS

Digit combination

This FP instruction unifies the number of digits specified at n_Digits of the data starting at s_Start if the trigger EN is TRUE. The result is stored in d.

Parameters

Input

s_Start (WORD)

Input value, range: 0–65535

n_Digits (WORD, INT, UINT)

Number of digits to be unified, range: 0–4

Unused portions of the memory area are filled with zeros.

Output

d (REAL)

Result

Error flags

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

  • if the value at n_Digits is out of range

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

  • if the value at n_Digits is out of range

Example

  1.  (1) Offset 0
  2.  (2) Offset 1
  3.  (3) Offset 2

Example

Global variables

In the global variable list you define variables that can be accessed by all POUs in the project.

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
		bStart: BOOL:=FALSE;
		iTestIndex: INT:=0;
		dutTestError: BOOL32_OVERLAPPING_DUT:=w0 := 0,
w1 := 0;
		arrDivideDigits_WORD: ARRAY [0..3] OF WORD:=[4(0)];
	END_VAR

POU body

When the variable bStart is set to TRUE, the function is carried out.

LD body

BODY
    WORKSPACE
        NETWORK_LIST_TYPE := NWTYPELD ;
        ACTIVE_NETWORK := 0 ;
    END_WORKSPACE
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 6 ;
        NETWORK_BODY
B(B_F,FP_UNIFY_DIGITS!,,18,0,27,5,,?DEN?Ds_Start?Dn_Digits?AENO?Cd);
B(B_VARIN,,arrDivideDigits_WORD[0],16,2,18,4,);
B(B_VARIN,,4,16,3,18,5,);
B(B_F,E_EQ-2!,,29,1,35,6,,?DEN?D?D?AENO?C);
B(B_VARIN,,g_arrValuesWORD[iTestIndex],27,4,29,6,);
B(B_F,E_NOT!,,35,1,41,5,,?DEN?D?AENO?C);
B(B_VAROUT,,dutTestError.b3,41,3,43,5,);
B(B_CONTACT,,bStart,3,1,5,3,);
L(27,3,27,4);
L(27,4,29,4);
L(27,2,29,2);
L(29,2,29,3);
L(1,2,3,2);
L(5,2,18,2);
L(1,0,1,6);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

IF (bStart) then
    FP_UNIFY_DIGITS(s_Start := arrDivideDigits_WORD[0],
                    n_Digits := 4,
                    d => wResult);
    IF (wResult <> g_arrValuesWORD[iTestIndex]) then
        dutTestError.b3 = TRUE;
    END_IF;              
END_IF;

Modified on: 2019-04-17Feedback on this pagePanasonic hotline