Pulse_TargetValueMatch_Set

Target value match ON (pulse output)

If the elapsed value matches the target value diTargetValue of the pulse output channel specified by iChannel, the output relay specified by pYOutput immediately turns to TRUE.

Parameters

Input

bExecute (BOOL)

A rising edge activates the function; evaluate the pulse output channel control flag using PulseInfo_IsTargetValueMatchActive

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

pYOutput (POINTER)

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

bError (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 pulse output. For a detailed description of the instruction(s) used internally, please refer to:F166_PulseOutput_Set

NOTE

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

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

  • Channel%d must be a pulse output 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 Pulse_TargetValueMatch_ChannelA_Y11F _MotorOn

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

Related topics:

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_EXTERNAL
		g_bPulse_TargetValueMatch_Channel1_YA_Horn1_On: BOOL:=FALSE;
	END_VAR
	VAR 
		diTargetValue0: DINT:=11000;
		iChannel1: INT:=1;
		bIsActive: BOOL:=FALSE;
		bErrorSet: BOOL:=FALSE;
		bSet: BOOL:=FALSE;
	END_VAR

LD body

Use PulseInfo_IsTargetValueMatchActive to evaluate the channel iChannel1 is active. If a rising edge is detected at bSet 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_bPulse_TargetValueMatch_Channel1_YA_Horn1_On. When pulse output on channel 1 reaches the target value diTargetValue0, output YA is set to TRUE.

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_VARIN,,iChannel1,7,1,9,3,);
B(B_VAROUT,,bIsActive,26,1,28,3,);
B(B_F,PulseInfo_IsTargetValueMatchActive!,,9,0,26,3,,?DiChannel?C);
L(1,0,1,3);
        END_NETWORK_BODY
    END_NET_WORK
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 6 ;
        NETWORK_BODY
B(B_VAROUT,,bErrorSet,51,1,53,3,);
B(B_CONTACT,,bSet,3,1,5,3,R);
B(B_CONTACT,,bIsActive,7,1,9,3,N);
B(B_VARIN,,iChannel1,32,2,34,4,);
B(B_VARIN,,diTargetValue0,32,4,34,6,);
B(B_F,GetPointer!,,27,3,34,5,,?D?C);
B(B_VARIN,,g_bPulse_TargetValueMatch_Channel1_YA_Horn1_On,25,3,27,5,);
B(B_F,Pulse_TargetValueMatch_Set!,,34,0,48,6,,?DbExecute?DiChannel?DpYOutput?DdiTargetValue?CbError);
L(5,2,7,2);
L(1,2,3,2);
L(9,2,34,2);
L(48,2,51,2);
L(1,0,1,6);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

bIsActive:=PulseInfo_IsTargetValueMatchActive(iChannel1);
Pulse_TargetValueMatch_Set(bExecute := DF(bSet) AND NOT bIsActive,
             iChannel := iChannel1,
             pYOutput := GetPointer(g_bPulse_TargetValueMatch_Channel1_YA_Horn1_On),
             diTargetValue := diTargetValue0,
             bError => bErrorSet);

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