![background image](http://html1.mh-extra.com/html/omron/prt1-com/prt1-com_operation-manual_744566059.webp)
5-1
Section
Examples of Counter Unit Operation
47
5-1-2 Present Count Value Reading
If the following bits in the output area for the Counter Unit have been set to ON,
the set values or the present count value (count value) will always be read to
words m and m+1 in the input area.
To read set value 1:
Output area word n+2, bit 04
To read set value 2:
Output area word n+2, bit 05
To read count value:
Output area word n+2, bit 06
The simplest example of a program to commence count operation and obtain
the count value is given in the following. For details refer to
7-3 Counter Unit
.
Note
1. To execute counting, it is necessary to set the count mode. If the count mode
is changed during count operation, however, the count value will be cleared
to 0.
2. Setting and reading will not be executed if a bit with a higher priority is ON.
As shown in the following example, therefore, it is recommended that word
n+2 be used with the MOV instruction.
When execution of count value reading is indicated
(execution conditions are ON), set the following condi-
tions:
S
Word 53
Bit 03: Data code BCD
Bit 06: Count value reading
Bits 10, 11: Count mode phase difference
×
1
The count value will subsequently be sent to words m
and m+1 (353, 354) of the Counter Unit automatically.
MOV(21)
#0C40
053
END(01)
NTLP
5-1-3 Counter Setting and Execution
When the program is executed, the necessary settings for the Counter Unit will
be made, and count operation will start. During count operation, external outputs
1 and 2 of the Counter Unit will automatically switch ON or OFF, according to the
count value.
Note
It will be necessary to reset all the settings, including the set values,
present value and count mode, every time the Counter Unit is turned
ON.