C-18
IP 240
EWA 4NEB 811 6120-02b
Cyclic Program
The cyclic program is located in OB 1.
At the beginning of the program, the inputs are mapped to memory bits
which are then used in the rest of the program. At the end of the program,
control memory bits are transferred to the outputs and displayed.
The FC 172 function is called absolutely with the function 1; this means that
it is always processed and reads the actual value, the end value and the status
bits in every program cycle.
The end value is not calculated until the first count process has been com-
pleted (see below).
With positive edge at input I 3.0 (M 170.0), the control bit STRT is set and
the FC 172 function is called with function 2 (write control bits). Now the IP
240 records the count pulses: the actual value is counted downward, begin-
ning at the count starting value which was preset at start-up. The released
counting is displayed at output Q3.0 (M 171.0).
With negative edge at input I 3.0 (M 170.0), the control bit STRT is reset and
written to the module. Now the counting is completed: the actual value
reached is stored as the end value. When the count process is started again,
the counting begins again at the count starting value.
The count process was previously influenced by the software through the
control bit STRT. You can also influence the count process with the gate con-
tact by specifying the value W#16#0001 as the EXTE parameter of the FC
171 function during structuring and restart the CPU.
The count process with hardware gate is executed in the same way as the one
previously described.
With positive edge at input I 3.0 (M 170.1), you can specify a new count
starting value. Set the count starting value to the number you require in the
data block DB 172.DBD 68 (for example, with “Monitor/Modify variable”)
and activate the input.
The new count starting value is transferred to the module (call FC 172 with
function 4) and comes into effect the next time a count process is started.
General Remarks
Reading the Actual
Value, End Value
and Status Bits
Starting and
Stopping Counting
Counting with the
Hardware Gate
Transferring the
Count Starting
Value
IP 240 Counter, Position Decoder and Positioning Module