High-speed counter instructions
1168
Part IV Tool Instructions
Output variable Data type Function
iError BOOL TRUE if the combination of Channel%d and pYOuput.iOffset does not
match a valid combination of channel number and output relay as
determined by the global variable
Example
In this example the function has been programmed in ladder diagram (LD) and structured text (ST).
(ST).The same POU header is used for all programming languages.
GVL
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.
Body
Use HscInfo_IsActive (see page 1157) 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.
LD
ST
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);