FP_EVENTS_OPERATION_TIME

Counts the operation time of each bit

This FP instruction measures the duration of the TRUE state of each bit in the data area specified by the starting address s1_Start and the number of bits n_Bits. The results are stored in the area of n_Bits*2 words starting with d_Start. The operation time is indicated in seconds.

Parameters

Input

s1_Start (WORD, INT, UINT)

Starting address of the data area for the bits to be evaluated.

Use the following formula to determine the size of the data type:

All decimal places in the result of this integer division must be removed.

  • n_Bits from 1 to 16=> size is 1 word.

  • n_Bits from 17 to 32=> size is 2 words...

s2_WorkArea (WORD, INT, UINT)

Starting address of the working area. Its size must be identical to the size of s1_Start.

n_Bits (INT, DINT, UINT, UDINT)

Number of bits (permissible range: 1–65535)

Output

d_Start (WORD, INT, UINT)

Starting address of the data area storing the counting results consisting of minimum n_Bits elements of data type DINT or UDINT. Please use the instructions Adr_Of_Var_I (LD/FBD) or Adr_Of_Var (ST) to apply this data area.

Error flags

sys_bIsOperationErrorHold (turns to TRUE and remains TRUE)
  • if the area specified using the index modifier exceeds the limit.
  • if d_Start, s1_Start, or s2_WorkArea are out of range.
sys_bIsOperationErrorNonHold (turns to TRUE for one scan)
  • if the area specified using the index modifier exceeds the limit.
  • if d_Start, s1_Start, or s2_WorkArea are out of range.

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
		bStart: BOOL:=FALSE;
		iTestIndex: INT:=0;
		iWorkAreaTime: INT:=0;
		arrOpTimeEvents: ARRAY [0..5] of dint:=[6(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_EVENTS_OPERATION_TIME!,,12,0,27,6,,?DEN?Ds1_Start?Ds2_WorkArea?Dn_Bits?AENO?Cd_Start);
B(B_VARIN,,iWorkAreaTime,10,3,12,5,);
B(B_VARIN,,6,10,4,12,6,);
B(B_VAROUT,,arrOpTimeEvents[0],37,2,39,4,);
B(B_CONTACT,,bStart,3,1,5,3,);
B(B_VARIN,,iTestIndex,10,2,12,4,);
B(B_F,Adr_Of_Var_O!,,28,2,36,4,,?D?C);
L(1,2,3,2);
L(5,2,12,2);
L(27,3,28,3);
L(36,3,37,3);
L(1,0,1,6);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

IF (bStart) then
    FP_EVENTS_OPERATION_TIME(s1_Start := iTestIndex,
                             s2_WorkArea := iWorkAreaTime,
                             n_Bits := 6,
                             d_Start => Adr_Of_Var(arrOpTimeEvents[0]));
END_IF;

Modified on: 2019-01-31Feedback on this pagePanasonic hotline