Remote I/O module 16 DI
AL4002
11
•
If the counter module detects a positive edge at pin 4 of the port, the value of the main counter is
incremented (m = m+1).
•
If the main counter reaches the threshold value CT (m = CT), the counter value is reset (m = 0).
Due to the overflow detection, the value of the batch counter is incremented (b = b+1).
•
If the batch counter reaches the threshold value CTb (b = CTb), the counter value is reset (b = 0).
CTb
CT
0
0
t
Main Counter
Batch Counter
4.5.2 Counter mode CTD
In CTD (Count Down) mode, the counter module operates as a down counter with underflow detection
and underflow counting.
Behaviour:
•
The initial value of the main counter is m = 0. The initial value of the batch counter is b = 0. The
main counter has a threshold value CT. The batch counter has a threshold value CTb.
•
The first time a positive edge is detected at pin 4, the value of the main counter is set to the
threshold value CT-1 (m = CT-1). At the same time, the value of the batch counter is set to the
threshold value CTb-1 (b = CTb-1).
•
If the counter module detects a positive edge at pin 4 of the port, the value of the main counter is
decremented (m = m-1).
•
If the main counter falls below 0, the counter value is reset to the threshold value (m = CT-1). Due
to the underflow detection, the value of the batch counter is decremented (b = b-1).
•
If the batch counter falls below 0, the counter value is reset to the threshold value (b = CTb-1).
CTb
CT
0
0
t
Main Counter
Batch Counter
4.5.3 Counter mode CTUD
In CTUD (Count Up Down) mode, the counter operates as a simultaneous up and down counter with
overflow and underflow detection.
Behaviour:
•
The initial value of the main counter is m = 0. The initial value of the batch counter is b = 0. The
main counter has a threshold value CT. The batch counter has a threshold value CTb.
•
If the counter module detects a positive edge at pin 4 of the port, the value of the main counter is
incremented (m = m+1).
•
If the counter module detects a positive edge at pin 2 of the port, the value of the main counter is
decremented (m = m-1).