Cautions On Subroutines And Interrupt Routines - Mitsubishi Electric FX3G SERIES Programming Manual

Programmable controllers
Hide thumbs Also See for FX3G SERIES:
Table of Contents

Advertisement

FX
/FX
/FX
Series Programmable Controllers
3G
3U
3UC
Programming Manual - Basic & Applied Instruction Edition
8.2.1

Cautions on subroutines and interrupt routines

This section explains cautions on creating programs in subroutines and interrupt routines.
The explanation below is given for subroutines, but the situation also applies to interrupt routines.
1. When using timers in subroutines (or interrupt routines)
Use retentive type timers T192 to T199 in subroutines.
These timers execute counting when the coil instruction or END instruction is executed.
After a timer reaches the set value, the output contact is activated when the coil instruction or END instruction is
executed.
Because general timers execute counting only when the coil instruction is executed, they do not execute counting if
they are used in subroutines in which the coil instruction is executed only under some conditions.
2. When using retentive type 1 ms timers in subroutines (or interrupt routines)
If a retentive type 1 ms timer is used in a subroutine, note that the output contact is activated when the first coil
instruction (or subroutine) is executed after the timer reaches its set value.
3. Countermeasures against latches of devices used in subroutines (or interrupt routines)
Devices which were set to ON in a subroutine are latched in the ON status even after the subroutine is finished. (Refer
to the program example shown below.)
When RST instruction for a timer or counter is executed, the reset status of the timer or counter is latched also.
For turning OFF such a device latched in the ON status or for canceling such a timer or counter latched in the reset
status, reset such a device in the main program after the subroutine is finished, or program a sequence for resetting
such a device or for deactivating RST instruction in the subroutine. (Refer to the program example shown on the next
page.)
Example in which outputs are latched
In the following program example, the counter C0 is provided to count X001. When X000 is input, the subroutine
P0 is executed only in one scan, and then the counter is reset and Y007 is output.
1)
Program example
X000
X001
X000
P0
2)
Timing chart
Execution of
subroutine P0
triggered by X000
X001
Current
value of C0
RST
C0
Y007
FNC 01
CALLP
C0
FNC 06
FEND
RST
Y007
FNC 02
SRET
Subroutine is executed.
Counter
3
is reset.
2
1
Remains reset.
Y007 is being output.
P0
K10
C0
Because the reset instruction
for C0 is valid, the current value
of C0 remains unchanged even
if pulses are input.
Outputs are held.
8 Program Flow – FNC 00 to FNC 09
8.2 FNC 01 – CALL / Call Subroutine
1
2
3
4
5
6
7
8
9
10
229

Advertisement

Table of Contents
loading

This manual is also suitable for:

Fx3u seriesFx3uc series

Table of Contents