Mitsubishi Electronics FX3G User Manual

Page of 964
816
FX
3S
/FX
3G
/FX
3GC
/FX
3U
/FX
3UC
 Series
Programming Manual - Basic & Applied Instruction Edition
36 Interrupt Function and Pulse Catch Function
36.5 Timer Interrupt (Interrupt in Constant Cycle)
2. Timer interrupt processing of RAMP (FNC 67) instruction
The ramp signal output circuit shown below is programmed using the timer interrupt function executed every 10 ms.
→ For the use method of the instruction execution complete flag M8029, refer to Subsection 6.5.2.
→ For RAMP (FNC 67) instruction, refer to Section 14.8.
1) Ramp output pattern
D4 is occupied as a register for counting the number of times of execution.
2) Program
(D 1) = 1
(D 3)
(D 2) = 255
X000 = ON
M8029
Execution is completed
While M8026 is OFF
10 sec.
While M8026 is ON
X000
Start
FNC 04
EI
FNC 12
MOV
K  1
D  1
FNC 12
MOV
K255
D  2
PLS
M  0
M  0
SET
M  1
FNC 06
FEND
M  1
FNC 67
RAMP
D  1
D  2
D  3 K1000
Initial
value
Target
value
Current
value
Number of
times of
transfer
M  1
M8029
FNC 03
IRET
END
I610
M8026
Interrupt
pointer
Step
0
When interrupt is given every 10 ms
RST
Interrupts are enabled by EI instruction.
The main program is described.
With M8026 turned ON,  when the value of
(D3) reaches the final value (D2), the final
value is latched.
As soon as the start command is given, the
initial value (D1) and target value (D2) are
transferred.
The main program is finished by FEND
instruction.
While the instruction is executed 1000
times (in 10 seconds), the contents of D3
are changed from the value of D1 to the
value of D2.
When the instruction execution complete
flag M8029 turns ON, RAMP instruction
drive input is set to OFF.
If RAMP (FNC 67) instruction is
continuously executed while M8026 is OFF,
the value of D3 returns to the initial value
(D1) immediately after it reaches the final
value (D2), and then the same operation is
repeated.
This program is not necessary when M8026
is ON.