Programming Tips For Timers And Counters; Specifying Timer And Counter Setpoints Indirectly - Mitsubishi Electric FX2N Beginners Manual

Hide thumbs Also See for FX2N:
Table of Contents

Advertisement

Devices in Detail
4.6

Programming Tips for Timers and Counters

4.6.1

Specifying timer and counter setpoints indirectly

The usual way to specify timer and counter setpoint values is directly, in an output instruction:
Ladder Diagram
X17
0
M50
4
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 following listing shows an example of how to specify setpoint values indirectly:
Ladder Diagram
M15
0
X17
6
M8002
10
M50
16
When relay M15 is one the contents of data register D100 are copied to D131. This register
contains the setpoint value for T131. You could use a programming or control unit to adjust
the contents of D100.
The special relay M8002 is only set for a single program cycle directly after the PLC is swit-
ched on. This is used to copy the constant value of 34 to data register D5, which is then
used as the setpoint value for counter C0.
You don't have to write program instructions to copy the setpoint values to the data registers.
You could also use a programming unit to set them before the program is started, for example.
FX Beginners Manual
Programming Tips for Timers and Counters
K500
T31
K34
C0
MOV D100 D131
D131
T31
MOV K34 D5
D5
C0
Instruction List
0
LD
X17
1
OUT
T31
4
LD
M50
5
OUT
C0
Instruction List
0
LD
M15
1
MOV
D100
6
LD
7
OUT
T31
10 LD
M8002
11 MOV
K34
16 LD
M50
17 OUT
C0
K500
K34
D131
X17
D131
D5
D5
4 – 15

Advertisement

Table of Contents
loading

Table of Contents