Mitsubishi Electronics Q172HCPU Baby Accessories User Manual


 
APP - 48
A
PPENDICES
APPENDIX 3 Example Programs
APPENDIX 3.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.
#0D150=BCD( D100)
DOUT YOCD150
QY40
System configuration
Motion SFC program
Q61P
PY000
to
PY00F
Q172H
CPU
M2401
Positioning start complete flag for axis 1 ON
?
#0=BCD(D13)
DOUT PY0, #0
END
Reading M-code
[G10]
[F10]
Q02H
CPU
Read M-code for axis 1, and store to #0 after
BCD conversion.
Output the data of "#0" to "PY000 to PY00F".
Q172
LX