![Kuhnke FIO (V2) Скачать руководство пользователя страница 58](http://html.mh-extra.com/html/kuhnke/fio-v2/fio-v2_manual_2009572058.webp)
Kendrion Kuhnke Automation GmbH
Counter/Posi2, Counter2
58
11/25/2016
4.13.4 Examples
4.13.4.1 Enable Counter
The counter is active, when the variable " EnableCounter_1" is TRUE.
Term2_EnableCounter_1:=TRUE;
(*Release of the counter*)
Term2_Counting_1;
(*TRUE, if counter is enabled*)
Term2_Clockwise_1;
(*Count direction, TRUE, when up*)
4.13.4.2 Counter Set/ Clear
Copying the contents of "SetValue_1" into the current value is executed by a
rising edge to " SetCounter_1". Execution is indicated by
"CounterSet_1=TRUE".
If "SetCounter_1" is reset (FALSE) again, "CounterSet_1" becomes also
again FALSE.
Term2_SetValue_1:=diCounterValue ;
(*Copy a number into the source var*)
(* 0 = Clear*) and
Term2_SetCounter_1:=TRUE;
(*copy to the counter current value*)
Term2_CounterSet_1;
(*TRUE, if set*)
4.13.4.3 Set Compare Value
Configuration settings set in "Zähler 1 Optionen" are activated by the rising
edge of the control bit "SetOptions_1". The successful take-over of the
options is confirmed with the status bit "OptionsSet_1".
e.g. Set compare function.
PROGRAM Initialization
VAR
bInit: BOOL := TRUE;
Step: USINT;
END_VAR
--------------------------------------------------------------------------------
IF bInit THEN
CASE Step OF
(*Select options, activate them by a rising edge to "Set_Options"*)
0:
Term2_EnableCounter_1:=TRUE;
(*Release counter*)
Term2_EnableCompare_1:=TRUE;
(*Activate compare function*)
Term2_ControlOutput_1:=TRUE;
(*Compare function controls Output*)
Term2_SetValue_1:=10000;
(*Set value = 10000..*)
Term2_SetCompare_1:=TRUE;
(*..use as compare value*)
Term2_SetOptions_1:=TRUE;
(*Activate selected options*)
Step:= 1;
(* Wait for confirmations "OptionsSet" and " CompareSet"*)
1:
IF Term2_OptionsSet_1 AND Term2_CompareSet_1 THEN
Step:= 2;
END_IF
(* Set "Set_Options" and " SetCompare" in the starting position*)
2:
Term2_SetOptions_1:=FALSE;
Term2_SetCompare_1:=FALSE;
Step:=0;