X20 system modules • Counter modules • X20DC4395
X20 system User's Manual 3.10
873
4.11.17.12.6 Counters and encoders
The module has 4 internal counter functions, each with 2 event counter registers. Each of these 4 counters is
permanently assigned to 2 physical inputs. This assignment cannot be changed.
The counter registers perform different functions based on how the event functions are connected. The counter
registers can be configured in the following ways:
•
ABR counter
•
AB counter
•
Up/down counters
•
Event counters
Different names are used for them in Automation Studio and in the register description to improve clarity.
Channel
Counter function
Counter register
Name in AS
1
1
ABEncoder01
ABREncoder01
Counter01
EventCounter01
2
1
2
EventCounter02
3
1
ABEncoder02
Counter02
EventCounter03
4
2
2
EventCounter04
5
1
ABEncoder03
ABREncoder02
Counter03
EventCounter05
6
3
2
EventCounter06
7
1
ABEncoder04
Counter04
EventCounter07
8
4
2
EventCounter08
4.11.17.12.6.1 Counter value calculation
There are 3 steps for calculating the state of any counter function
1. The counter value is based on the 2 absolute value counters "abs1" and "abs2". These are only used internally in
the module and cannot be read. Depending on the mode, these registers show the respective physical input signals.
Mode
Edge counters
AB encoders
Up/down counter
abs1
Edges of counter channel 1
Increments in positive direction
Counter channel 2 = 0:
Edges of counter channel 1
in up direction
abs2
Edges of counter channel 2
Increments in negative direction
Counter channel 2 = 1
Edges of counter channel 1
in down direction
2. From the absolute value registers "abs1" and "abs2", 2 more counters are formed: "counter 1" and "counter 2".
They are only used internally in the module and cannot be read. The following values are used for the calculation:
•
Absolute value registers "abs1" and "abs2"
•
SW_reference_counter 1 and 2: This reference value can be defined by the "CfO_CounterPresetValue"
register to allow referencing <> 0.
•
HW_reference_counter 1 and 2: In the "CfO_CounterEventMode" register, you can configure whether
latched values should be copied to these registers when counter events occur.
counter1 = abs1 + SW_reference_counter1 - HW_reference_counter1
counter2 = abs2 + SW_reference_counter2 - HW_reference_counter2
3. The counter registers contain the sum of the two internal counters "counter 1" and "counter 2". The
"CfO_CounterConfigReg" register allows you to define a sign for each "counter" register and define whether or
not it should be used.
Counter register = co counter2
Summary of Contents for X20 System
Page 2: ......