FP_BAND

Compare with deadband

This FP instruction compares the positive or negative input value at input s3_In with a deadband. The deadband's lower limit is specified at input s1_Min and its upper limit is specified at s2_Max. The result is stored in d.

Parameters

Input

s1_Min

Input value

  • On 16-bit PLC types: (INT, DINT, REAL)

  • On 32-bit PLC types: (INT, DINT, UINT, UDINT, REAL, LREAL)

s2_Max

Input value

  • On 16-bit PLC types: (INT, DINT, REAL)

  • On 32-bit PLC types: (INT, DINT, UINT, UDINT, REAL, LREAL)

s3_In

Input value

  • On 16-bit PLC types: (INT, DINT, REAL)

  • On 32-bit PLC types: (INT, DINT, UINT, UDINT, REAL, LREAL)

Output

d_y

Result

  • On 16-bit PLC types: (INT, DINT, REAL)

  • On 32-bit PLC types: (INT, DINT, UINT, UDINT, REAL, LREAL)

Remarks

The result is calculated as follows:

  • For s3_In <s1_Min: d =s3_In – s1_Min (lower limit is subtracted from input value)

  • For s3_In >s2_Max: d =s3_In – s2_Max (upper limit is subtracted from input value)

  • For s2_Max³s3_In³s1_Min: d = 0

    1.  (1) Output value d
    2.  (2) Input value s3_In
    3.  (3) Upper limit of deadband s2_Max
    4.  (4) In this range, 0 is output
    5.  (5) Lower limit of deadband s1_Min

Error flags

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

  • if s1_Min>s2_Max

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

  • if s1_Min>s2_Max

Related topics:

Corresponding F instructions: F287_BAND, F53_DBDIV

System instructions

Related topics:

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;
			(*activates the function*)
		diChecked_value: DINT:=6;
			(*value to check*)
		diOutput_value: DINT:=0;
			(*result after a 0->1 leading
edge from start: -2*)
	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 := 7 ;
        NETWORK_BODY
B(B_F,FP_BAND!,,11,1,18,7,,?DEN?Ds1_Min?Ds2_Max?Ds3_In?AENO?Cd);
B(B_CONTACT,,bStart,4,2,6,4,);
B(B_VARIN,,-10,9,3,11,5,);
B(B_VARIN,,20,9,4,11,6,);
B(B_VARIN,,diChecked_value,9,5,11,7,);
B(B_VAROUT,,diOutput_value,18,3,20,5,);
L(1,3,4,3);
L(6,3,11,3);
L(1,0,1,7);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

IF start THEN     
    FP_BAND(s1_Min := -10,
            s2_Max := 20,
            s3_In := diChecked_value,
            d => diOutput_value);
END_IF;    (* 10=lower limit of deadband, 20=upper limit of deadband *)

Modified on: 2022-08-23Feedback on this pagePanasonic hotline