APP - 68
APPENDICES
APPENDIX 2 Example Programs
APPENDIX 2.1 Reading M-code
The program example for reading M-code at the completion of positioning start or
positioning is shown below.
The judgement of the positioning start completion and positioning completion is made
with the following signals.
• Positioning start completion ………M2400+20n (positioning start complete signal)
• Positioning completion ……………M2401+20n (positioning complete signal)
[Program Example]
(1) A program that outputs the M-code from PY000 to PY00F to external destination
after conversion into BCD code at the positioning start completion is shown below.
System configuration
Positioning start complete flag for axis 1 ON ?
QY40PQ61P
PY000
to
PY00F
Q172D
CPU
Q03UD
CPU
Q172D
LX
QY40P
PY010
to
PY01F
Motion SFC program
Reading M-code
M2401
#0=BCD(D13)
DOUT PY0, #0
END
[G10]
[F10]
Read M-code for axis 1, and store to #0 after BCD conversion.
Output the data of "#0" to "PY000 to PY00F".