5.7 Programming Tips for Timers and Counters
5.7.1 Specifying timer and counter setpoints indirectly
The usual way to specify timer and counter setpoint values is directly, in an output instruction:
In the example above T31 is a 100ms timer. The constant K500 sets the delay to 500 x 0.1s =
50s. The setpoint for counter C0 is also set directly, to a value of 34 with the constant K34.
The advantage of specifying setpoints like this is that you don’t have to concern yourself with
the setpoint value once you have set it. The values you use in the program are always valid,
even after power failures and directly after switching the controller on. However, there is also a
disadvantage: If you want to change the setpoint you need to edit the program. This applies
particularly for timer setpoint values, which are often adjusted during controller configuration
and program tests.
You can also store setpoint values for timers and counters in data registers and have the pro-
gram read them from the registers. It is then possible to change the values quickly with a pro
-
gramming unit if necessary, or to specify setpoint values with switches on a control console or
a HMI control panel.
The listing shown on the next page is an example of how to specify setpoint values indirectly:
MELSEC System Q Beginners Manual 5 – 15
Devices in Detail Programming Tips for Timers and Counters
MELSEC Instruction List
LD X1
OUT T31
K500
LD M50
OUT C0
K34
Ladder Diagram
IEC Instruction List
LD X1
TIMER_M TC31, 500
LD M50
COUNTER_M CC0, K34