Specifications

Table Of Contents
10 - 34
10.5.10 M code function
The M code No. ranges from 0 to 255, and is added to the servo program. When this
servo program is executed, the M code is set in the M code monitor register.
Since the M code is known when it is checked using the compare command in the
sequence program, pre-determined work can be executed.
(1) Example of servo program (with M code added)
Addition of M code "3"
REAL
AXIS
VELOCITY
M CODE
(2) Practice conditions
When the M code '3' is detected, the pen is lowered.
When the M code '0' is detected, the pen is raised.
When the M code '4' is detected, the pen is raised/lowered repeatedly.
The solenoid to move the pen is wired to the Y0B. (The pen is lowered when
the solenoid is excited.)
(3) SFC program
It is necessary to create a program to read the M code and to raise/lower the pen.
1) Read the M code.
SFC program No. 90
Reading of M code
M291 is turned ON with
M code '3' of axis 1
(D13) or axis 2 (D33).
M291 is turned OFF
with M code '0' of axis 1
and axis 2.
Moved
downward
with M code
'4' of axis 1.
M31
flickers at
an interval
of 0.5 sec.
G900 G902
(D13==K3)+(D33==K3) (D13==K0)*(D33==K0)
G904 G906
[Transition]
(D13==K4)*M2001*M2002 M31
F900 F901
SET M291 RST M291
F902 F903
[Operation control
step]
SET M291 RST M291