Hsc_TargetValueMatch_Reset

Target value match OFF (high-speed counter)

If the elapsed value matches the target value diTargetValue of the high-speed counter channel specified by iChannel, the output relay specified by pYOutput immediately turns to FALSE.

Parameters

Input

bExecute (BOOL)

A rising edge activates the function; evaluate the high-speed counter control flag using HscInfo_IsActive

iChannel (INT)

FPS: 0, 2

FP-X R: 0, 1

FP-X 16K C14T: 0, 1, 2

FP-X 32K C30T, C60T: 0, 1, 2, 3

FP0R: 0, 1, 2, 3

FP0: 0, 1

FP-e: 0, 1

pYOutputPOINTER

Pointer result obtained by GetPointer from a global variable that supplies the channel number and output

diTargetValue (DINT)

Specify a 32-bit data value for the target value within the following range:

FP0, FP-e: -838808–+8388607

FPS, FP-X, FP0R: -2147483467–+2147483648

Output

iError (BOOL)

TRUE if the combination of Channel%d and pYOuput.iOffset does not match a valid combination of channel number and output as determined by the global variable

Remarks

This non-inline instruction is part of the tool instructions for high-speed counters. For a detailed description of the instruction(s) used internally, please refer to: F167_HighSpeedCounter_Reset

NOTE

To validate the combination of channel and Y output, the compiler requires the following name pattern for global variables:%sHsc_TargetValueMatch_Channel%d_Y%d_%s

Always use this pattern for global variables in target value match control.

  • Channel%d must be a high-speed counter channel number enabled in the system registers

  • Y%d must be an explicit output address supported by the PLC

    FP-S, FP0, FP-e:

    Y0–Y7

    FP-S (V3.1 or higher), FP0R:

    Y0–Y1F

    FP-X:

    Y0–Y29F

  • %s is an optional descriptor at the beginning of the pattern

  • _%s is an optional descriptor at the end of the pattern

Example

Optional Fixed pattern Optional
g_b Hsc_TargetValueMatch_ChannelA_Y11F _MotorOn

This global variable generates the code for channel A and output Y11F.

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
	VAR 
		bExecute: BOOL:=0;
		iChannel1: INT:=1;
		diTargetValue1: DINT:=15000;
		bIsActive: BOOL:=FALSE;
		diElapsedValue: DINT:=0;
		bReset: BOOL:=FALSE;
		bErrorReset: BOOL:=FALSE;
	END_VAR

LD body

Use HscInfo_IsActive to evaluate the channel specified by iChannel1. If a rising edge is detected at bReset and if bIsActive is not TRUE, the instruction is executed. The combination of channel number and output contact is validated in the global variable g_bHsc_TargetValueMatch_Channel1_Y7_YellowLamp_On. When the high-speed counter on channel 1 reaches the target value diTargetValue1, output Y7 is set to FALSE.

BODY
    WORKSPACE
        NETWORK_LIST_TYPE := NWTYPELD ;
        ACTIVE_NETWORK := 0 ;
    END_WORKSPACE
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 3 ;
        NETWORK_BODY
B(B_F,HscInfo_IsActive!,,9,0,18,3,,?DiChannel?C);
B(B_VARIN,,iChannel1,7,1,9,3,);
B(B_VAROUT,,bIsActive,18,1,20,3,);
L(1,0,1,3);
        END_NETWORK_BODY
    END_NET_WORK
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 7 ;
        NETWORK_BODY
B(B_CONTACT,,bReset,2,1,4,3,R);
B(B_CONTACT,,bIsActive,6,1,8,3,N);
B(B_VARIN,,iChannel1,31,2,33,4,);
B(B_VARIN,,diTargetValue1,31,4,33,6,);
B(B_VAROUT,,bErrorReset,47,1,49,3,);
B(B_F,GetPointer!,,26,3,33,5,,?D?C);
B(B_VARIN,,g_bHsc_TargetValueMatch_Channel1_Y7_YellowLamp_On,24,3,26,5,);
B(B_F,Hsc_TargetValueMatch_Reset!,,33,0,47,6,,?DbExecute?DiChannel?DpYOutput?DdiTargetValue?CbError);
L(1,2,2,2);
L(4,2,6,2);
L(8,2,33,2);
L(1,0,1,7);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

bIsActive:=HscInfo_IsActive(iChannel1);
Hsc_TargetValueMatch_Reset(bExecute := DF(bReset) AND NOT bIsActive,
             iChannel := iChannel1,
             pYOutput := GetPointer(g_bHsc_TargetValueMatch_Channel1_Y7_YellowLamp_On),
             diTargetValue := diTargetValue1,
             bError => bErrorReset);

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