34
Overview of G-language Programs in the MC Unit
Section 1-7
Example Program
The following diagram shows the format of a basic G-language program.
Block Numbers
Programs are composed of blocks, which are distinguished by block numbers
N000 through N999. Block numbers are equivalent to the program’s line num-
bers.
Always declare the program number and axis in block number N000 (
A
).
Program Numbers
Program numbers range from P000 through P499. The program shown above
begins with block number N000 (
A
) and ends with the block (N004) that con-
tains the program end command, G79.
Subroutines have program numbers ranging from P500 through P999, and
end with a subroutine end command, G73.
The number of blocks and number of programs are the total numbers of
blocks and programs being used. A maximum of 100 programs and 2,000
blocks can be used in the MC Unit. A maximum of 800 blocks can be used in
any one program.
G-language Codes
Code G00 in line
C
is a G-language code representing the PTP control posi-
tioning function.
Arguments
Positions are input as arguments. In this example “X100” has been input to
indicate 100 on the X-axis.
The next argument, “M100,” outputs M-code 100 when the positioning to X100
has been completed.
Some commands, such as G90 in line
B
, don’t require arguments. The abso-
lute specification command (G90) indicates that coordinates are to be treated
as absolute coordinates.
Format
The following table explains the contents of the MC program.
N000
P001
X
A
Axis being used.
Program number (P000 to P499)
Block number (N000 to N999)
Parameters
G-language code
N001
G90
B
N002
G00
X100
M100
C
Program end command
N003
G26
X
D
N004
G79
E
Line
MC program blocks
Function
A
N000 P001 X
Declares program number (001) and the axis being
used (X).
B
N001 G90
Specifies positioning by absolute coordinates.
C
N002 G00 X100 M100
Moves to X-axis coordinate 100. Outputs M-code
100 when positioning is completed.
Executed the next block with the M Code Reset
Command from the CPU Unit.
D
N003 G26 X
Returns to the reference origin.
E
N004 G79
Ends the MC program.
Summary of Contents for CS1W-MC221 -
Page 1: ...Motion Control Units Cat No W359 E1 04 CS1W MC221 V1 421 V1 OPERATION MANUAL ...
Page 2: ...CS1W MC221 V1 421 V1 Motion Control Units Operation Manual Revised February 2008 ...
Page 3: ...iv ...
Page 5: ...vi ...
Page 11: ...xii ...
Page 15: ...xvi ...
Page 19: ...xx ...
Page 27: ...xxviii Conformance to EC Directives 6 ...
Page 133: ...106 Installation Section 2 2 2 2 4 Dimensions CS1W MC421 CS1W MC221 ...
Page 173: ...146 Connecting Peripheral Devices Section 2 7 ...
Page 227: ...200 Command Area Section 3 6 ...
Page 351: ...324 Interface Specifics Section 5 4 ...
Page 513: ...486 Absolute Encoder Interface Specifications Section 9 7 ...
Page 575: ...548 Error Log Section 12 6 ...
Page 589: ...562 Performance Appendix A ...
Page 655: ...628 Control Bit Flag Timing Charts Appendix E ...
Page 683: ...656 Origin Search Patterns Appendix F ...
Page 685: ...658 Encoder Divider Rate and Rotation Speed for OMRON Servo Drivers Appendix G ...