Onboard Counter Inputs
Example:
Setting Parameters for Counter A and Counter B (S5-95U)
Table 11-4. Setting Parameters for Counter Inputs
Setting Parameters for Counter Inputs
12:
KS
=' OBC: CAP 500 CBN 999 ;
24:
KS
=' '
Counter A and counter B count independently of each other.
If the counters reach the comparison value (counter overflow), the following takes place.
•
The actual counter status is reset to "0",
•
Bit I 35.0 of the diagnostic byte is set (counter A),
•
Bit I 35.1 of the diagnostic byte is set (counter B),
•
OB3 is called if it has been programmed.
11.2
Programming the Reaction to Interrupts in OB3
S5-90U
Bit I 35.0 of the diagnostic byte is set in OB3 if the interrupt was caused by "Counter has reached
comparison value".
You must reset bit I 35.0 in the interrupt program.
S5-95U
Bit I 35.0 of the diagnostic byte is set in OB3 if the interrupt was caused by "Counter A has reached
comparison value".
Bit I 35.1 of the diagnostic byte is set in OB3 if the interrupt was caused by "Counter B has reached
comparison value".
You must reset bit I 35.0 and/or I 35.1 in the interrupt program.
Example: Counter A has counted up to the comparison value; an interrupt was triggered. Program
execution is to jump from OB3 to FB3 if the interrupt was caused by "Counter A has
reached comparison value".
STL
OB3
A
I
35.0
R
I
35.0
JC
FB3
.
.
.
BE
11-4
Counter A counts positive edges; compar. value 500
Counter B counts negative edges; compar. value 999
Table 11-5. Program Example for OB3
An interrupt has been triggered.
Bit 0 in the diagnostic byte is reset to "0".
The counter reaction program in FB3 will be
processed.
S5-90U/S5-95U
Explanation
Explanation
EWA 4NEB 812 6115-02b