APPENDICES
APP − 53
APPENDIX4 EXAMPLE PROGRAMS
4.1 Reading M Codes
An example of a program for reading an M code on completion of positioning start
or on completion of positioning is shown here.
The distinction between positioning start completion and positioning completion is
made with the following signals.
• Positioning start completed .........M2400+20n (positioning start completed signal)
• Positioning completed..................M2401+20n (positioning completed signal)
[Program Example]
(1) A program that outputs the M code for axis 1 from Y000 to Y00F to an external
destination on completion of positioning start and after conversion to BCD code,
is shown here.
System configuration
Sequence program
A273UH
CPU
A278
LX
AY40
Y000
to
Y00F
M2400
BCD
P
D13 Y0000
CIRCUIT END
0
K4
Axis 1 positioning start completed signal
Y000 to Y00F designation
M code storage area for axis 1
(Refer to Section 3.2.1.)
BCD conversion instruction
Power supply
module
A61P
(2) A program that outputs the M code for axis 1 from Y000 to Y00F to an external
destination on completion of positioning and after conversion to BCD code, is
shown here.
System configuration
Sequence program
M2400
BCD
P
D13 Y0000
CIRCUIT END
0
K4
Axis 1 positioning completed signal
Y000 to Y00F designation
M code storage area for axis 1
(Refer to Section 3.2.1.)
BCD conversion instruction
A273UH
CPU
A278
LX
AY40
Y000
to
Y00F
Power supply
module
A61P