Warnings, Cautions, and Notes
as Used in this Publication
Warning notices are used in this publication to emphasize that hazardous voltages, currents,
temperatures, or other conditions that could cause personal injury exist in this equipment or
may be associated with its use.
In situations where inattention could cause either personal injury or damage to equipment, a
Warning notice is used.
Caution notices are used where equipment might be damaged if care is not taken.
GFL-001
Warning
Caution
Note
Notes merely call attention to information that is especially significant to understanding and
operating the equipment.
This document is based on information available at the time of its publication. While efforts
have been made to be accurate, the information contained herein does not purport to cover all
details or variations in hardware or software, nor to provide for every possible contingency in
connection with installation, operation, or maintenance. Features may be described herein
which are not present in all hardware and software systems. GE Fanuc Automation assumes
no obligation of notice to holders of this document with respect to changes subsequently made.
GE Fanuc Automation makes no representation or warranty, expressed, implied, or statutory
with respect to, and assumes no responsibility for the accuracy, completeness, sufficiency, or
usefulness of the information contained herein. No warranties of merchantability or fitness for
purpose shall apply.
N.6.4Color Palette Difference between Character Display and Graphics Display481. . . . . . . . . . . . . . . . . . . .
c–7
Page 10
PROGRAMMING
Page 11
B–61803E–1/07
1
PROGRAMMING
NC programs include those which are prepared by custom macro and very
seldom altered and those which may differ from one another according to
relevant machining such as part programs. A batch handling of these
programs of different characters may cause 1 quicker battery
consumption, or spoil the custom macro in case of misoperation.
T o solve a problem, this function will convert the custom macro prepared
by a machine tool builders into an execution format, register it to the ROM
module, and enables it to be executed.
(1) Since the custom macro is converted into an execution format and
registered, the execution speed is high. This will shorten the
machining time and improve the machining accuracy.
(2) The registration to the ROM eliminates battery consumption and
prevents custom macro damage through misoperation. This will
improve the reliability.
(3 ) Since the registered program is not indicated on the program display,
the machine tool builder’s knowhow can be protected.
(4) Since the custom macro is registered in the ROM, the program edit
memory can effectively be used.
(5 ) The user can call the macro with an easy call procedure without being
conscious of the registered program. On the program edit memory,
custom macros can be prepared and executed in the standard manner.
(6) The user can confirm the operation using RAM module before
making a ROM. (excluding Series 21–B)
(7) Conversational macro function can compile machine tool builders
original screen.
1. OUTLINE
3
Page 12
1. OUTLINE
Series 16–B
Series 16–C
Series 16–A
Series 18–A
Series 18
Series 18–B
PROGRAMMING
B–61803E–1/07
The models covered by this manual, and their abbreviations are :
Model nameAbbreviation
FANUC Series 16–TA16–TA
FANUC Series 16–MA16–MA
FANUC Series 16–TTA16–TTA
FANUC Series 16–GCA16–GCA
FANUC Series 16–GSA16–GSA
FANUC Series 16–PA16–PA
FANUC Series 16–LA16–LA
FANUC Series 16–TB16–TB
FANUC Series 16–MB16–MB
FANUC Series 16–PB16–PB
FANUC Series 16–LB16–LB
FANUC Series 160–TB160–TB
FANUC Series 160–MB160–MB
FANUC Series 160–PB160–PB
FANUC Series 160–LB160–LB
FANUC Series 16–TC16–TC
FANUC Series 16–MC16–MC
FANUC Series 16–PC16–PC
FANUC Series 160–TC160–TC
FANUC Series 160–MC160–MC
FANUC Series 160–PC160–PC
FANUC Series 16i–TA16i–TA
FANUC Series 16i–MA16i–MA
FANUC Series 16i–PA16i–PA
FANUC Series 16i–LA16i–LA
FANUC Series 160i–TA160i–TA
FANUC Series 160i–MA160i–MA
FANUC Series 160i–PA160i–PA
FANUC Series 160i–LA160i–LA
FANUC Series 18–TA18–TA
FANUC Series 18–MA18–MA
FANUC Series 18–TTA18–TTA
FANUC Series 18–GCA18–GCA
FANUC Series 18–GSA18–GSA
FANUC Series 18–PA18–PA
FANUC Series 18–TB18–TB
FANUC Series 18–MB18–MB
FANUC Series 18–PB18–PB
FANUC Series 180–TB180–TB
FANUC Series 180–MB180–MB
FANUC Series 180–PB180–PB
Series 16–A
Series 16
i
4
Page 13
B–61803E–1/07
Series 18–C
Series 18
Series 18–A
Series 20–A
Series 20
Series 21–B
Series 21
Series 21–A
PROGRAMMING
Model nameAbbreviation
FANUC Series 18–TC18–TC
FANUC Series 18–MC18–MC
FANUC Series 18–PC18–PC
FANUC Series 180–TC180–TC
FANUC Series 180–MC180–MC
FANUC Series 180–PC180–PC
FANUC Series 18i–TA18i–TA
FANUC Series 18i–MA18i–MA
FANUC Series 18i–PA18i–PA
FANUC Series 180i–TA180i–TA
FANUC Series 180i–MA180i–MA
FANUC Series 180i–PA180i–PA
FANUC Series 20–FA20–FA
FANUC Series 20–TA20–TA
FANUC Series 21–TB21–TB
FANUC Series 21–MB21–MB
FANUC Series 210–TB210–TB
FANUC Series 210–MB210–MB
FANUC Series 21i–TA21i–TA
FANUC Series 21i–MA21i–MA
FANUC Series 210i–TA210i–TA
FANUC Series 210i–MA210i–MA
1. OUTLINE
i
i
The 21–TB model is available in two types: control unit type A and
control unit type B. The two types may also be referred to as the 21–TB
(control unit A) and the 21–TB (control unit B) when the descriptions of
the types differ.
In this manual, the models may be classified as indicated below.
SystemModel name
16–TA, 16–TTA, 16–GCA, 16–TB, 160–TB, 16–TC,
Lathe systemT series
Machining center
system
M series
160–TC, 16i–TA, 160i–T A, 18–T A, 18–TTA, 18–GCA,
18–TB, 180–TB, 18–TC, 180–TC, 18i–TA,180i–TA,
20–TA, 21–TB, 210–TB, 21i–TA, 210i–TA
The words used in the explanation are defined as follows.
”P-CODE program” :
Execution type macro program prepared by a machine tool builder,
being compiled and registered to ROM.
”Execution macro” :
Program to operate machine in P-CODE program.
”Auxiliary macro” :
Program to make an auxiliary operation for the execution macro and
the conversational macro in P-CODE program.
5
Page 14
1. OUTLINE
PROGRAMMING
”Conversational macro” :
Program to operate screen in P-CODE program.
”User program” :
Program prepared by end-user for program edit memory.
B–61803E–1/07
6
Page 15
B–61803E–1/07
2
2. MACRO COMPILER AND MACRO
PROGRAMMING
MACRO COMPILER AND MACRO EXECUTOR
EXECUTOR
7
Page 16
2. MACRO COMPILER AND MACRO
EXECETOR
2.1
MACRO COMPILER
PROGRAMMING
B–61803E–1/07
NOTE
For the macro compiler for other than Series 16/18–A, refer to the
”FAPT MACRO COMPILER (For Personal Computer)
PROGRAMMING MANUAL (B–66102E).” (When reading the
manual, skip Section 2.1.)
The NC program is converted into an execution form (P-CODE program),
output to the ROM module, and registered into a ROM. Mount the
prepared ROM module on the Series 16-A or Series 18 to execute the
registered P-CODE program to be called from the user program by means
of G, M and T codes or specified code set by parameter.
Custom macro
O9000;
#1=#2+#5;
·
·
M99;
Compile parameter
2.1.1
Equipment Needed for
Compile
NC program compiler
P–CODE program executor
ROM transformation
MACRO Compiler Developing Equipment (When SYSTEM P series is
used)
Refer to Appendix D for macro executor with graphic
conversation.
Connect FA writer to CN2 or CN3 for SYSTEM P series.
CN2,3
SYSTEM
P series
FA
WRITER
ROM
MODULE
ADAPTER
ROM
MODULE
NOTE
Use CN1 normally for PPR.
9
Page 18
2. MACRO COMPILER AND MACRO
EXECETOR
2.1.3
Compiling Procedure
(Main Flow)
PROGRAMMING
(START)
Source program
preparation
B–61803E–1/07
2.1.4
Compiling Procedure
Using System P Series
(Details)
Compile
parameter setting
Test compile
ROM write
Check performance
* If a compiling error occurs,
correct a source program and
re-start compiling.
Loading in RAM
module
(1) Equipment connection
Connect FA writer to CN2 or CN3 of SYSTEM P series.
Generally, connect FANUC PPR to CN1.
(2) Turning on power of SYSTEM P series
Turn SYSTEM P series power ON.
(3) Loading system
1. Load the FAPT MACRO compiler system disk to either drive
unit.
2. Keep pressing the ”LOAD” key on the left upper side of the
keyboard for a few seconds.
3. When the menu is displayed, loading operation is completed.
(4) Source program input and correction
For detailed operation method, refer to APPENDIX B.
1. ”R2” (Display and edit)
2. No.=
”1” (Custom MACRO program display and edit) <NL>
(a) Input from keyboard
D ” <FO> = OFF, <F1> = OFF, <F2> = OFF”
D PROGRAM =
D INPUT =
”IN” <NL>
”Oxxxx” <NL>,”
Date <NL> , , , ,
only ”<NL>” at the last
(b)Reading from floppy disk
D ”<F0> = OFF, <F1> = OFF, <F2> = OFF”
10
Page 19
B–61803E–1/07
2. MACRO COMPILER AND MACRO
PROGRAMMING
EXECUTOR
D PROGRAM = ”IN” <NL>
D FD =
”OK_ @File Name <NL>
or ”OK
: File No. <NL>
_
”
” : Space
_
(c) Progran correction within memory
D ”<F0> = ON, <F1> = OFF, <F2> = OFF”
D PROGRAM = ”Oxxxx” <NL>
D Correct a program, using a screen editor.
(5) Setting Compile parameter
Not required when the compile parameter is already set.
1. For no initial screen, press <NL> a few times.
2. ”R1” (setting)
NO.= ”1” (Parameter) <NL>
3. No.=
”1” (parameter setting) <NL>
4. Set the parameter, using the screen editor with ”CHG”.
5. ”R0” (End) when the setting of all parameters is completed
6. Only <NL> (End of program)
(6) Test compile
1. For no initial screen, press <NL> a few times.
2. ”R0” (Start)
3. ”<F3> = ON ” : Displays a source program during compile.
”<F3> = OFF”: Displays o[NL]y program No. during compile.
4. No. =
”1” (Test compile) <NL>
5. If an error occurs during compiling, correct the error and compile
a program.
(7) Setting FA writer Channel
1. ”R1” (setting)
2. No.=
”2 ” (ROM writer) <NL>
3. The current ROM writer channel setting conditions are displayed
on the CRT screen.
4. CN1 =
: ”ON” <NL> : The channel is used.
: ”OFF” <NL>: The channel is not used.
: only <NL> : No setting is changed.
5. CN2 = : Same as above.
6. CN3 = : Same as above.
7. BUILT-IN ROM WRITER =
: Same as above (only P-G mate)
8. No. =
<NL> (End)
(8) Preparations for FA writer
1. Install the erased ROM module to the FA writer.
2. Turn the FA writer power ON.
3. Set the FA writer to the remote mode.
(9) ROM writing
11
Page 20
2. MACRO COMPILER AND MACRO
yp
Datainut
Dataoutut
Replacement
EXECETOR
PROGRAMMING
B–61803E–1/07
1. For no initial screen, press <NL> a few times.
2. ”R0” (start)
3. ”<F7> = OFF, F9 = ON” : (FA writer selection)
4. ”<F3> = ON ” : Displays a source program during compiling.
”<F3> = OFF” : Displays only program No. during compiling.
5. No. =
: ”2” : (ROM writing) <NL>
6. Data writing to ROM is started.
7. Writing is completed within a few minutes to 10 minutes or so.
D If compile parameter ”9000.0 = 0” is selected, no comparison
after ROM writing is made, thus making it possible to reduce
the writing time.
(10) Performance Check
Install ROM module after writing to ”MACRO” socket on the main
CPU PCB of Series 16/ Series 18 to check the operation.
PWE = 1 of setting No.0 :
When power is ON while pressing ”DELETE” key , the 10, 000 level
P-CODE variables and program within RAM are cleared.
2.1.5
Table for Editing by P–G
Mate
Job
Major
classification
Data input
Data display
Data output
p
Insertion
Minor classification
Paper tape, keyboard, floppy
disk
Addition from keyboardKEYIN
Display filenames for files on
floppy disk
Any lineLIST
Lines containing the specified
string
Punch speceSPACESP nPunch n speces
Punch feedFEED
Output to paper tape, floppy
disk
Alter a whole lineALTERLine number 1 line of data
Alter part of a line
Replace address characterREPLACE
Reverse order of 2 address
data characters
Insert1 line of dataINSERTLine number 1 line of data
Insert stringINSERT
Copy and add a specified block MOVEMOV[line number1, line number2]
Keyboard input
Command
(enter NL at end of
command)
INPUT
FDLISTFDL
LISTL string
OUTPUT
ALTER
CHANGE
IN [ string]
KOLD, line number, increment
L[
line number
FEn
OUT[ string]
A string1
[ , string2 ], { }
R character1/character2
C character1/character2
string1 ,
[, string2 ] { }
Notes
Input terminated by the string
specified
Data added several line at a time
]
n
ALL
n
ALL
Display from the specified line
number
Punch n feeds
Replace ALL or n strings with
string1
Replace character1 with character2
Change the order in one block
Insert string2 after string1
Copy and add the data from line
number1 to line number 2
12
Page 21
B–61803E–1/07
g
PROGRAMMING
2. MACRO COMPILER AND MACRO
EXECUTOR
Job
Command
Major
classification
Deletion
Scaling to re-
quire values
Adding and sorting sequence numbersSEQNO
Copy paper tapeCOPYCOPY
Modification
support
Process control
Minor classification
Deletion n whole linesDELETELine number1 [,line number2]
Delete stringDELETE
Delete address dataADELETEAD address character
Delete lines containing a partic-
ular string
Multiple of a pecific addressSCALES address character / nn is the scaling factor
Multiple of incremental NC data ASCALEAS address character / nn is the scalling factor
Renumber linesRENUMBER
Change character used to dis-
play EOB
Display list of commandsHELPH
NC data TH, TV checkTHTVTHTV
Advance pointerFIND
Move pointer backRACKBn
Comment ** comment stringInsert any commnet after *
Start editingEDIT
Change data type and code
system
End editingENDE
Change from integer NVC data
to floating point NC data
Command
D character , { }
BDELETEBD atring
SEQ intial value
[ , increment [ , n ]]
REN[ intial value
[ , increment]]
EOBEOB Character
F { } [,n]
ED { } [, { } ]
MODE
POINT
M { } [, { } ]
PO X1 / n1 [ , Xi / ni ]
Keyboard input
Keyboard input
(enter NL at end of
(enter NL at end of
command)
command)
n
string
FAPT
FAPT
NC
NC
n
ALL
EIA
ISO
EIA
ISO
5
i=2
Notes
Notes
Delet the data from line number1
to line number2
The string can be an address
character
If n is given, add a sequence
number every n blocks
Copies any sort of data on paper
tape.
Read in NC data from tape reader, and check TH, TV’
Advance pointer by n lines
Advance to a line containing a
particular string
Move pointer back n lines.
If n is omitted, move pointer back
to preceding line
Special
conversion
2.1.6
P–CODE Loader
Function
Change from floating point NC
data to integer NC data
ADD a specified amountADD
INTEGER
The P-CODE loader function transfers files in Motorola format S, which
is a ROM format, to the RAM module installed in the Series 16/18-A or
the Series 16-TT A (tool posts 1 and 2). The files are created by the macro
compiler for the FANUC SYSTEM P-MODEL G (referred to hereafter
as the P-G) or a personal computer (referred to hereafter as the PC). The
P-CODE loader function also operates the macro executor in the RAM.
The RS-232C interface is used to connect the Series 16/18–A to the P-G
or PC.
INT X1 / n1 [ , Xi / ni ]
ADD X1 / n1 [ , Xi / ni ]
13
5
i=2
5
i=2
Page 22
2. MACRO COMPILER AND MACRO
EXECETOR
PROGRAMMING
B–61803E–1/07
The communication parameters for transferring the file in the ROM
format (referred to below as loading) depend on the parameters of the
Series 16/18–A. The parameters must be set before loading.
2.1.6.1
Operation
If the
CAN
and
PROG
keys are pressed simultaneously on the MDI, and
the power to the Series 16/18–A is turned off, this function displays the
data transfer screen (loading screen). For the Series 16/18-TTA, the
function displays the data transfer selection screen. When tool post 1 or
2 is selected on the selection screen, the loading screen is displayed. Data
can only be transferred while the loading screen is displayed.
Issue a data transfer command in the P-G or PC. For a description of the
transfer commands and other details, refer to the specifications of the
FAPT Macro Compiler.
The function eliminates the need to store data on a ROM chip when
developing a macro program.
The P-CODE loader function is executed while a power-on sequence is
suspended. The functions of the CNC are disabled while the data transfer
selection screen or loading screen is displayed. The P-CODE loader
function requires an executor option and reader/punch control option.
(1) The communication parameters for loading depend on the
parameters of the Series 16/18–A. Specify parameters such as the
channels to be used and the baud rate before loading.
(2) Turn off the power to the Series 16 and install a RAM module instead
of the ROM module for custom macros. In Series 16/18-TT A, install
the RAM module(s) in tool post 1 and/or tool post 2. Connect the
Series 16/18 to the P-G or PC via the RS-232C interface.
(3) Turn on the power to the Series 16/18 while simultaneously pressing
the
CAN
and
PROG
keys on the MDI. Hold down the CAN and
PROG keys until the title, MACRO COMPILER/EXECUTOR
P-CODE LOADER is displayed.
14
Page 23
B–61803E–1/07
2. MACRO COMPILER AND MACRO
PROGRAMMING
EXECUTOR
(4) On the Series 16/18-TTA, however, the following data transfer
selection screen is displayed instead of the above title.
Pressing address key M on the screen selects tool post 1 and pressing
address key S selects tool post 2.
Pressing numeric key 0 starts the Series 16/18-TTA and enables the
executor to execute the macros loaded in the RAM.
(5) On CNCs other than the Series 16/18-TT A, performing the operation
in step (3) displays the following screen. On the Series 16/18-TT A,
selecting a tool post displays the following screen and initializes the
RAM.
The following screen remains displayed while the RAM is being
initialized. If the RAM has low capacity , the screen in step (6) may
be displayed instead of the following screen.
The selected tool post, HEAD 1 or HEAD 2, is displayed on the
second line of the screen for the Series 16/18-TTA.
MACRO COMPILER/EXECUTOR P–CODE LOADER
HEAD 1/HEAD 2
(I/O PARAMETERS)(DATA TRANSFER)
(8) When the Series 16/18–A receives data, the following data reception
state is displayed.
The transmitted data and its address are displayed.
Mapping is merely a term indicating how much RAM the created
P-CODE program and executor occupy.
A single asterisk (
) refers to 16K bytes when a 2MB RAM module
*
is installed and 8K bytes when a RAM module of 1MB or less is
installed.
When loading terminates normally for the Series 16/18-TTA, the
following message is displayed.
Pressing numeric key 1 returns to the screen in step (4). Select the
next tool post on the screen.
MACRO COMPILER/EXECUTOR P–CODE LOADER
HEAD 1
(I/O PARAMETERS)(DATA TRANSFER)
LOADING END: TOTAL xxxxxxxxBYTES
PUSH 1 KEY: RETURN TO HEAD SELECTION
18
Page 27
B–61803E–1/07
2. MACRO COMPILER AND MACRO
PROGRAMMING
EXECUTOR
(10) If an error occurs during loading, the following message is displayed.
To perform loading again, press the CAN key to retry from the
beginning, that is, initializing the RAM in step (5).
If an error such as a parameter setting error occurs in the Series
16/18–A, turn the power to the Series 16/18–A off then on again.
Specify the same baud rate for the P-code loader as that for the PC or P-G.
No.
011 1ASISB2
#7#6#5#4#3#2#1#0
Data type: Bits
This parameter must be set when I/O CHANNEL = 1. The meanings of
the bits correspond to those of the bits in parameter 101.
No.
0112Specification number of the I/O device (when I/O CHANNEL = 1)
Data type: Bytes
Specify the number of the I/O device when I/O CHANNEL = 1 according
to Table 1.
No.
0113Baud rate (when I/O CHANNEL = 1)
Data type: Bytes
Specify the baud rate for the I/O device when I/O CHANNEL = 1
according to Table 2.
21
Page 30
2. MACRO COMPILER AND MACRO
EXECETOR
PROGRAMMING
B–61803E–1/07
No.
0121ASISB2
#7#6#5#4#3#2#1#0
Data type: Bits
This parameter must be set when I/O CHANNEL = 2. The meanings of
the bits correspond to those of the bits in parameter 101.
No.
0122Number of the I/O device (when I/O CHANNEL = 2)
Data type: Bytes
Specify the number of the I/O device when I/O CHANNEL = 2 according
to Table 1.
No.
0123Baud rate (when I/O CHANNEL = 2)
Data type: Bytes
Specify the baud rate for the I/O device when I/O CHANNEL = 2
according to Table 2.
No.
8701PLD
#7#6#5#4#3#2#1#0
2.1.6.4
Alarms
Data type: Bits
PLD In the P-code loader for the macro compiler or executor, the RAM
is:
0 : Cleared with OMM and rewritten.
1 : Not cleared with OMM, but overwritten.
MessageExplanation
EXECUTOR OPTION NOTHINGA macro executor option is not yet selected.
I/O OPTION NOTHINGReader/punch control 1 option is not yet selected.
I/O OPTION (CH2) NOTHINGReader/punch control 2 option is not yet selected.
ILLEGAL CHANNELA channel other than channel 1 or 2 is selected.
ILLEGAL CHARACTERThe transmitted data is not correct.
OVERRUNOverrun error
FRAMING ERRORFraming error
DSR SIGNAL OFFCommunication error
PARITY ERRORData without parity was transmitted.
CHECK SUM ERRORChecksum error
22
Page 31
B–61803E–1/07
PROGRAMMING
2. MACRO COMPILER AND MACRO
EXECUTOR
2.2
MACRO EXECUTOR
CONTROLS
The macro executor controls the execution of the P-CODE program
created by the macro compiler.
The P-CODE program (execution macro) stored in the ROM can be called
and executed by specifying G, M, T or original code set by parameter
during compilation in the user program.
Custom macros can be created and executed in the user program,
independently of P-CODE program.
23
Page 32
3. EXECUTION MACRO
EXECUTION MACRO
3
PROGRAMMING
B–61803E–1/07
Only a registered P-CODE program cannot be executed. It is called from
the user program by G, M, T code, or specified code by parameter setting,
and executed. In case of macro call, argument designation is possible, and
it is compared as a local variable at the P-CODE (execution macro) side.
Moreover, if a minus value is set to a parameter for macro call by G code,
modal call of P-CODE program can be done by corresponding G code.
Refer to 3.1.5 for details.
These codes cannot be used in combination. For example,
a macro call by a T code cannot be executed together with
a subprogram call by an M code.
Correspondence between codes that call macro programs or subprograms
and program numbers of called programs, and whether or not to call a
subprogram or a macro , are determined by compile parameters. Since
these parameters are registered to the ROM at compilation, be sure to
designate them at compilation. Exclusive codes that call subprograms
shall be set to CNC parameter (No,6090,6091) in executing.
(1) The return sequence number definition for returning to the user’s
program
When operational control is returned to the user’s program from
the P-CODE program, control passes to the sequence number of the
user’s program defined by address P.
User’s program
O0001;
:
G100X123Y456;
G00X789;
:
N100G00Y999;
:
M02;
P–CODE program
O9010;
#100=#24+#25;
:
M99P100;
25
Page 34
3. EXECUTION MACRO
PROGRAMMING
B–61803E–1/07
(2 ) Difference between Subprogram Call (T, M) and Macro Call (G, M)
Argument designation can be made in macro call. In subprogram call,
(a)
however, argument designation is not possible without T code, special
code and call code.
(b) In subprogram call, after execution of another command than T-
or M-code, it will branch to a subprogram. In macro call,
however, it will branch off without doing anything.
(c) In subprogram call, single block stop is made when another
command than T- or M-code is commanded. In macro call,
however, no stop is made.
3.1.1
Calling Subprogram
O9000 by T code
3.1.2
Calling subprograms
O9001–9003 by M code
3.1.3
Calling a Subprogram
Using Specified Codes
The P-CODE program 09000 registered to the ROM can be called by a
T code.
The commanded T code is stored as an argument in the common variable
#149.
All the local variables will become <Vacant>.
N_ G_ X_ Y _ T < tttt >;
By commanding M codes which is designated by compilation parameter,
the programs O9001, O9002, O9003” registered to the ROM can be called
for subprograms. All the local variables are <Blank>.
N_ G_ X_ Y _ M<mm> ;
By setting character codes (decimal notation of ASCII codes) to the
parameters (No. 6090, 6091) of CNC, the P-CODE program (09004,
09005) corresponding to the address can be called as a subprogram. The
defined integer will be stored as a parameter to the macro variable (#146,
#147). The actual use of this function is decided by specifying the
appropiate compilation parameter (No. 9002#1, 9002#2, ACL1, ACL2).
Example)Compiler parameter (No. 9002#1, ACL=1)
When parameter No. 6090 = 66 at execution
User’s program
O0001;
O0001;
:
G00X123Y456B100;
:
M02;
P–CODE program
O9004;(#145=100.)
Definable addresses for 16-TB/16-TA/GCA, 18-TB/18-TA/GCA,
20-TA, 21-TB: A, B, D, F, H, I, J, K, M, Q, R, S, T
Definable addresses for 16-MB/16-MA/GSA, 18-MB/18-MA/GSA,
20-FA, 21-MB: A, B, F, H, I, K, M, Q, R, S, T
26
Page 35
B–61803E–1/07
PROGRAMMING
3. EXECUTION MACRO
3.1.4
Calling Macros
O9010–9019 by G Code
3.1.5
Modal Call Using G Code
By commanding G codes which is designated by compilation parameter
(No. 9013 to 9022), the macro programs ”O9010-O9019” registered to
the ROM can be called.
Local variables without argument designation are <Vacant>.
N_ G<gg>< Argument designation>;
A modal call can be used to call a macro when using G code.
When calling a G code is specified with a compilation parameter,
continuous-state calling can be specified using a negative number.
Continuous-state calling is canceled with G167 or the G code specified
by compilation parameter 9034.
During continuous-state calling, the values of address of each block for
the user program are all arguments.
Example)When compilation parameter 9013 = –100
User’s program
O0001;
:
G100X123Y456;
X789 Z678;
:
:
G167;
(Modal call cancelled or code
set to compile parameter
No.9034.)
:
M02;
P–CODE program
O9010
for each block the difined address is
called as a parameter of “09010”
and executed.
3.1.6
Calling Macros
O9020–9029 by M
Code
Multiple modal calls is not permitted.
By commanding M codes which is designated by compilation parameter
(No. 9023 to 9032). the programs ”O9020 - O9029” registered to the
ROM can be called.
Local variables without argument designation will become <Vacant> .
N_ M<mm>< Argument designation>;
27
Page 36
3. EXECUTION MACRO
PROGRAMMING
B–61803E–1/07
3.1.7
Calling a Macro Using a
T Code
By setting compile parameter TMACC(No.9005#7) to 1, program of
No.9008 registered to ROM can be called macros by specifying a T code
in a user program.
All addresses specified in this block are used as arguments except that the
T code is transferred to #27, values for address P and L are transferred to
#16 and #12, respectively. Also G codes are transferred to variables #28
to #32 for each group.
Be sure that addresses shall be those availabe for CNC and the significant
digits are those specified by the CNC.
G codes are assigned to variables #28 to #32 in ascending
order, starting with the lowest G code group number. When
a G code of G code group 01 exists, G80 may be generated
and assigned to #28 to #32.
3.1.8
M Code Subprogram Call
with Range Specified
Example)G91G28X123.45678T5678:
#24=123.456
#27=5678.0
#28=28.0
#29=91.0
Other variables = < vacant >
ROM-resident program 09009 can be called as a subprogram by using
compilation parameters No. 9042 and No. 9043.
Specify the following codes in compilation parameters No. 9042 and No.
9043:
No. 9042 = M code indicating the lower limit
No. 9043 = M code indicating the upper limit
Examples are given below:
No. 9042 = 100
No. 9043 = 110
If the above codes are specified in the parameters upon compilation,
specifying an M code within the range from M100 to M110 calls
ROM-resident program O9009 as a subprogram.
28
Page 37
B–61803E–1/07
PROGRAMMING
3. EXECUTION MACRO
3.1.9
Calling Macros with a G
Code by Specifying the
Range
The code specified by compilation parameters 9045 to 9047 can be used
to call the programs registered in ROM.
Specifying call arguments is the same as calling macros with G code
(3.1.4).
Specify the following for parameters 9045 to 9047:
Parameter 9045 : G code to start calling
Parameter 9046 : Number of P-CODE programs
Parameter 9047 : Number of the program to be called first
For example, suppose programs are compiled with 200 specified for
parameter 9045, 100 specified for parameter 9046, and 1000 specified for
parameter 9047. When G200 to G299 are specified, 100 programs from
O1000 to O1099 compiled on the ROM can be called.
NOTE
1
Specifying call arguments is the same as calling macros with the
G code specified by compilation parameters 9013 to 9022.
2 Continuous-state calling cannot be specified.
3 When the G code specified with compilation parameters 9013 to
9022 is specified, the specified parameters 9013 to 9022 are
effective.
Parameter 9047 = 1000
When G250 is issued with the settings above, program O9010 is
called.
3.1.10
Function for Calling
Macros with an Axis
Address
Axis address commands enable calling macros.
When AX1CL to AC8CL of compilation parameter 9005#0 to #3,
9008#0 to #3 are set to 1, the programs registered to ROM can be called
by the axis address command.
The program number to be called is selected by compile parameter
AXCLS (No. 9005#4) as follows:
AXCLS 1 : The program number to be called depends on a specified
axis:
Program O9031 is called when 1st axis is specified.
Program O9032 is called when 2nd axis is specified.
::
Program O9038 is called when 8th axis is specified.
0: Always program O9009 is called irrespective of specified
axes.
In this case, all the addresses in the block specified axis address are passed
for use as arguments. However, the specified axis address is passed to
variable 27. Addresses P and L are passed to variable 16 and 12,
respectively, for use as arguments. Up to five G codes in each G code
group are passed to variables 28 to 32 starting from the group with the
lowest number. When a G code of G code group 01 exists, G80 may be
generated and assigned to #28 to #32.
29
Page 38
3. EXECUTION MACRO
PROGRAMMING
B–61803E–1/07
When G code system A is used in the lathe system (T/TT), whether the
axis addresses are called with an absolute or incremental command are
informed to variable 33.
Variable No.Address
#1 to #26Usual argument address
#27Specified axis address (1st to 8th)
#28Specified G code
#29Specified G code
#30Specified G code
#31Specified G code
#32Specified G code
#33Vacant for absolute address
1.0 for incremental address
If the following are specified when a 4th-axis address is B, for example:
G91G28B1.234567X123.4567;
The settings are passed to variables as follows:
123.456 to variable #24
1.234 to variable #27
28.0 to variable #28
91.0 to variable #29
Other variables: Null
The addresses transferred as arguments specified in a block used to call
a macro make changes modal information of the CNC when calling the
macro. In the above example, the CNC model of absolute/incremental
command changes to G91 (incremental command) when a macro is
called.
In the lathe system, for G code system A, and when a 2nd-axis address is
Z (absolute) or W (incremental), the settings are passed to variables as
follows:
Variable #27 = 100.0, variable #33 = <null> for Z100.;
Variable #27 = 100.0, variable #33 = 1.0 for W100.;
NOTE
The addresses those can be used and the range of the
values specified to those addresses are the same as those
allowed to each CNC model concerned.
30
Page 39
B–61803E–1/07
PROGRAMMING
3. EXECUTION MACRO
3.2
ARGUMENT
DESIGNATION
Address of argument
specification I
A#1N (NOTE)#14
B#2P (NOTE)#16
C#3Q#17
I#4R#18
J#5S#19
K#6T#20
D#7U#21
E#8V#22
F#9W#23
G (NOTE)#10X#24
H#11Y#25
L (NOTE)#12Z#26
M#13
Argument designation is possible when calling a call. It can be referred
to as a local variable at the P-CODE program side. Argument
specification I and argument specification II are possible.
For arguments designation, negative symbol and decimal point can be
used irrespective of the address.
T able 3.2(a) Argument specification I at P–CODE program call
Local variable
No.
Address of argument
specification I
Local variable
No.
Address of argument
specification II
A#1K1#6
B#2
C#3I10#31
I1#4J10#32
J1#5K10#33
NOTE
It is available when compilation parameter bit5 of No.9008
is 1.
Table 3.2(b) Argument specification II at P-CODE program call
Local variable
No.
Address of argument
specification II
·
·
Local variable
No.
·
·
31
Page 40
3. EXECUTION MACRO
PROGRAMMING
B–61803E–1/07
3.3
LIMITATION FOR
EXECUTION MACRO
Source program of execution macro should be programmed in the same
way as for custom macro. But, there are some limits for execution.
(1) Macro call
Macro call from an execution macro is executed with ”G65” as the
custom macro . In the execution macro , since it is a macro program
itself to be called from the user program with G (M, T) code or
specified code, it is impossible to use a G
CODE call, etc. from
execution macro.
G65 P (Program No.) L (Number of repetition) <Argument
specification> ;
(2) Argument specification
Argument specification is the same as the
custom macro.
(3) Variable
Expression, argument, etc. of variables are the same as those of the
Custom macro.
NOTE
Common variables referred by a P–CODE program and
Common variables referred by user program are completely
different.
Refer to ”5.3 Common variable”.
(a) P–CODE variable (#10000 – )
Any number of 100 unit of P-CODE exclusive variables starting
from #10000 can be used.
Since it can be used from execution, it is considered as extension
of common variable #500.
However, execution macro cannot refer to P-CODE variable in
arrangement type.
For details, refer to ”5.4 P-CODE exclusive variable”.
(4) Operation command
Operation commands can be used as with the custom macro.
(5) Control command
Both divergence and repetition commands can be used .
IF <Conditional expression> GOTO n;
WHILE <Conditional expression> DO m;
END m;(m=1,2,3)
(6) Modal call from execution macro
Modal call cannot be made.
(7) Macro and subprogram multiplexity in execution macro.
Separately from the user program multiplexity, 4-stack nesting of
macro program, and 4-stack nesting of subprogram are possible on
the execution macro.
(8) Cautions
(a)
Separate registration of a program cannot be made. Max. 400
programs can be registered to the ROM.
(b) In one program, limit the sequence number used for branch
destination (GOTO) to 200. In one program, the same sequence
No. cannot be designated for others.
32
Page 41
B–61803E–1/07
PROGRAMMING
3. EXECUTION MACRO
(c) One block can accept designation of only one sequence number .
Except the program No. ”0” and the optional block skip ”/”,
designate a sequence No. at the block head.
(d) In T series multiple repetitive canned cycle cannot be executed
in the P-CODE program. In case a program including a multiple
repetitive canned cycle is registered and executed, the function
cannot be guaranteed.
(e) In T series programming through direct drawing dimensions
programming cannot be made in the P-CODE program.
In case a program made through direct drawing dimension
input is registered and executed the function cannot be
guaranteed.
33
Page 42
4. CONVERSATIONAL MACRO FUNCTION
AND AUXILIARY MACRO FUNCTION
CONVERSATIONAL MACRO FUNCTION AND
AUXILIARY MACRO FUNCTION
4
PROGRAMMING
B–61803E–1/07
34
Page 43
B–61803E–1/07
PROGRAMMING
4. CONVERSATIONAL MACRO FUNCTION
AND AUXILIARY MACRO FUNCTION
4.1
CONVERSATIONAL
MACRO
Part program storage memory
Main program
The conversational macro function executes a program compiled by the
macro compiler independently of the normal NC part program. This
function basically is not affected by operation modes of NC .
Accordingly, it works concurrently with the NC part program under
execution independently even during the memory operation.
NOTE
The execution of the conversational macro function is
processed at a lower level than that of the CNC operation
internally. Therefore, the execution of the conversational
macro function will not affect the processing speed of the
CNC operation, but the processing speed of the
conversational macro function may become slow while the
CNC operation is ON.
ROM
M code call
T code call
G code call
Special code call
P–CODE
Execution macro program
Memory operation
execution level executor
Memory operation execution level (higher level)
CRT/MDI
CUSTOM screen
Conversation macro and auxiliary macro execution level (lower level)
Compiling
Parameter 9039
Initial setting on power on
Control variable
#8500
Program number specification
Program number modification
Conversation macro
execution level executor
P–CODE
Conversation macro
program
Auxiliary macro execution
level executor
Execution (always)
Compiling
Parameter 9039
4.1 Conversational macro function conceptional diagram
Program number specification
35
P–CODE
Auxiliary macro program
Page 44
4. CONVERSATIONAL MACRO FUNCTION
AND AUXILIARY MACRO FUNCTION
The conversational macro function is executed only when the
conversational screen is selected with the function key
The conversational macro function executes its macro program whose
program No. is the value of the conversational macro execution control
variable #8500. The value of the conversational macro execution control
variable #8500 is to be set with the parameter No. 9038 at compiling. The
conversational macro function will not be executed when there is not a
conversational macro program compiled whose program No. is the value
of the conversational ma ro execution control variable #8500.
The conversational macro program, as well as NC part program, consists
of macro sentences and NC sentences (specific G code commands).
The conversational macro program can describe all the macro statements
used for the custom macro. And all the system variables and common
variables which can be referred to in the P-CODE program can be read and
written. But the conversational macro program has no local variables
except for #1 to #99. They are used to refer an array type P-CODE
variables #10000 ’s. Also, P-CODE variables are prepared for the
conversational macro control.
PROGRAMMING
B–61803E–1/07
CUSTOM
.
It is impossible to execute the NC part program statement with the NC
statement of the conversational macro program. They will be ignored
though commnded. It is impossible to use any codes except the screen
display codes and the execution control codes described in the following
sections. And be sure that the NC statement of the conversational macro
program have the addresses whose meanings and usage are different from
those of the NC part program statement.
The CUSTOM screen started by the conversational macro program is
under the same control as the other screens (POS screen, etc.). Therefore,
finishing of the CUSTOM screen is necessary for changing over from one
screen to another. Decide the timing to finish when executing M99 of the
main program. Be careful about the condition of the conversational
macro program, because if it is of a bad program example as shown below ,
it will be impossible to change the screen to another and HANG-UP
ST A TE will be held. When another function key is pressed mistake, press
CUSTOM
again.
36
Page 45
B–61803E–1/07
4. CONVERSATIONAL MACRO FUNCTION
PROGRAMMING
Bad exampleGood example
AND AUXILIARY MACRO FUNCTION
O1234 ;
NO
Key input ?
YES
Key input process
M99 ;
O1234 ;
NO
Key input ?
YES
Key input process
M99 ;
Program the conversational program so that it will be a cyclic like the
PMC ladder program. That is, execute M99 without fail and it will return
to the head of the main program or to the sequence No. specified with
M99Pp.
Thus, avoid the programming that the divergence destination by GOTO
will reverse direction.
NOTE
To select a conversational macro screen, press function key
CUSTOM
.
T o change the screen from the conversational macro screen
to another screen such as current position screen or
program screen, press the correspondence function key
such as
POS
and
PROG
.
If the Series 20 is your NC, press both right most and left
most soft keys at the same time and the screen changes
from the conversational macro screen to the current position
display screen.
37
Page 46
4. CONVERSATIONAL MACRO FUNCTION
AND AUXILIARY MACRO FUNCTION
PROGRAMMING
B–61803E–1/07
4.2
AUXILIARY MACRO
FUNCTION
The auxiliary macro is always executed regardless of the selection screen
while the conversational macro function is executed only when the
CUSTOM
conversational macro screen is selected in the function
.
The auxiliary macro function executes the auxiliary macro program with
the program number set by parameter 9030 on compiling.
If parameter 9039 is equal to 0 or the auxiliary macro with a set program
number has not been compiled, no auxiliary macro function is executed.
Major differences between the conversation macro and auxiliary macro
functions are as in the following:
1) Auxiliary macro function is always executed regardless of the screen
being displayed.
2) No screen display control code can be used in the auxiliary macro
function. G202, G240, G242, G243, G01, G02, G03
3) No variables for controlling and cursor can be used in the auxiliary
macro function.
#8501-#8509
4) The conversational macro function can control the program number
executed by conversational macro execution control variable #8500.
On the other hand, the auxiliary macro function always executes the
program of the program number set by parameter 9039 on compiling.
NOTE
1 Switching to another screen is disabled while an auxiliary
macro is controlling the reader/punch interface.
2 A larger auxiliary macro (requiring a longer time to execute)
causes screen drawing to become slower.
The conversation macro function and auxiliary macro function are
executed at the same execution level (lower level).
The execution processing is as shown in the following when both the
conversation macro function and auxiliary macro function are
specified.
1) CUSTOM screen selected
The auxiliary macro execution and conversation macro executed are
repeated in this order.
2) Screen other than CUSTOM screen
A compilation parameter makes it possible to display CUSTOM
screen at power on.
38
Page 47
B–61803E–1/07
PROGRAMMING
4. CONVERSATIONAL MACRO FUNCTION
AND AUXILIARY MACRO FUNCTION
4.3
EXECUTION
CONTROL CODE
The following control codes are prepared for execution control.
M98 :Subprogram call
M99 :Subprogram end
(1) Subprogram call (M98)
M98 Pp ;
A macro subprogram specified by address P is called. Frequency of
calling the macro subprogram shall be up to quadruple.
(2) Subprogram end (M99)
M99 Pp ;
When command is done in the c lled subprogram, the calling program will
be restored. When the address P is specified, the block of the sequence
No. specified at P of the calling program will be restored.
Command M99 without fail at the end of the main program. The
command of M99 in the main program is explained below.
When M99 is commanded in the main program, execution of the
conversational macro function is finished once.
Once execution of the conversational macro function is started, the screen
will not change over to another though the function key is depressed until
execution of the conversational macro function ends at M99.
Accordingly, it is necessary to command M99 at the end of the main
program.
When the function key is depressed during the execution of the
conversational macro program, both character display and graphic
display will be erased after the conversational macro program ends, and
CUSTOM
a corresponding screen will take place. When the function key
is
depressed again, the execution of the conversational macro program will
be started according to the value of the conversational macro execution
control variable #8500. At this time, the program will be executed from
the beginning regardless of the command of the address P in block of
M99.
When M99 is executed, the value of the conversational macro execution
control variable #8500 will be checked. When the value of #8500 is
rewritten, both character display and graphic display will be erased and
the control will be transferred to a new conversational macro program.
If not, neither the character display nor the graphic display will be erased,
and execution of the same conversational macro program will be
repeated. In this case, when the address P is commanded, execution will
be started at the block of the sequence No. specified at P.
Once M99 is executed, the graphic display will not be output on th screen
until the graphic screen is erased next. Consequently, when the same
conversational macro program is still executed, the second and the
following graphic displays will not be output on the screen When you
want to redisplay the graphic display in 1 conversational macro program,
command the graphic screen to be erased once.
39
Page 48
4. CONVERSATIONAL MACRO FUNCTION
AND AUXILIARY MACRO FUNCTION
PROGRAMMING
B–61803E–1/07
4.4
CONVERSATIONAL
MACRO EXECUTION
CONTROL VARIABLE
#8500, #8550, #8551
Three screens are available for execution of the conversational macro.
These screens are selected by pressing the function key CUSTOM. The
three screens correspond with those for the FANUC Series 0 as follows;
When the function key
program number is specified by a value of the conversational macro
execution control variale is executed.
Compile parameters (No.9038,No.9040,No.9041) set values of the
conversational macro execution control variable effected at power on.
When the value of the conversational macro execution control variable is
re-written, another conversational macro is controlled. When the value is
re-written, characters and graphics are erased after completion of M99 of
the currently executed conversational macro program(main) and the new
conversational macro is controlled.
Screen for Series 0
CUSTOM
is pressed, a conversational macro whose
Conversational macro
execution control variable
If the value of the conversational macro execution control variable is not
re-written, the same conversational macros are repeatedly executed. In
this case, no characters and graphics are erased.
40
Page 49
B–61803E–1/07
PROGRAMMING
4. CONVERSATIONAL MACRO FUNCTION
AND AUXILIARY MACRO FUNCTION
4.5
NOTES
The conversational macro and auxiliary macro must be programmed so
that M99 of the main program is executed.
The conversational macro, auxiliary macro and standard CNC display
(POS screen, etc.) are executed on the same level. If a wait is programmed
in any macro not having M99, the following occurs:
D If the wait is executed by the conversational macro, the auxiliary
macro is not executed.
D If the wait is executed by the auxiliary macro, the conversational
macro is not executed. The CNC display (POS screen, etc.) is not
updated.
When common variables are used by an auxiliary macro (or
conversational macro) and execution macro, the same variable must not
be written to as a flag. An execution macro has higher priority than an
auxiliary macro (or conversational macro). So, while an auxiliary macro
(conversational macro) is writing to a variable, an execution macro may
interrupt and write to that variable.
In such a case, once writing to the variable by the execution macro ends,
the remaining write processing by the auxiliary macro (or conversational
macro) is completed. So, the value written by the execution macro may
be overwritten by the auxiliary macro (or conversational macro).
Example: Bit 0 of the #100 value is used as an execution macro flag, while
bit 1 of #100 is used as an auxiliary macro flag
To set bit 0 to ON: #100 = 100 OR 1
To set bit 1 to ON: #100 = 100 OR 2
Execution macro
#100=#100 OR 1
Auxiliary macro
Execution macro
Auxiliary macro
#100=#100 OR 2
The value of #100, read at the start of auxiliary macro processing, is
written to #100 after auxiliary macro processing ends. So, a value written
by execution macro processing may be lost.
41
Page 50
5. MACRO VARIABLES
MACRO VARIABLES
5
PROGRAMMING
B–61803E–1/07
42
Page 51
B–61803E–1/07
5.1
MACRO VARIABLES
PROGRAMMING
5. MACRO VARIABLES
VariableNo.User program
Local variable#1 to #33 (#99)∆
Common variable#100 and up
P-CODE variable
Extended P-CODE
variable
Control variable#8500 and up
#500 and up
#10000 and up
#20000 and up
Conversational
macro
(NOTE 1)
: Usable∆ : Partially usable: Unusable
NOTE
1
To be used when the P-CODE variables of array type are
referenced.
2 The variables for controlling screen display and key input cannot
be used.
5.2
LOCAL VARIABLES
The local variables can be used for executable macros.
These local variables are different from those used for the user programs.
Auxiliary macro
(Common variable)
(Common variable)
∆
(NOTE 2)
Executable mac-
ro
(#1 TO #33 OR FOR
REFERENCING THE
P–CODE
VARIABLES OF
ARRAY TYPE, #1 TO
#99)
5.3
COMMON
VARIABLES (#100 TO
#149 AND #500 TO
#531)
The local variables can be used for auxiliary and conversational macros
to reference the P-CODE variables of array type.
The common variables can be used for conversational macros, auxiliary
macros, and executable macros.
The common variables are common to the conversational, auxiliary , and
executable macros.
However, they are different from those used for the user programs.
43
Page 52
5. MACRO VARIABLES
PROGRAMMING
B–61803E–1/07
5.4
P–CODE VARIABLES
#10000–
It is possible to use optional quantity of the P-CODE variables starting
with #10000 on 100-pc. basis.
A 100 times as many as the numerical value preset on the compiling
parameter No. 9037 will be the usable quantity of P-CODE variables.
When the value on the parameter No. 9037 is 0, P-CODE exclusive
variables are not usable.
The upper limit of the P-CODE variables is as follows.
10000 + (Value of Compiling Parameter No. 9037) 100–1
The lower limit of the P-CODE variables is 10000. For example, the
P-CODE variables can be used as follows:
#10000 to #10099 when the value of parameter No. 9037 is 1
#10000 to #10199 when the value of Parameter No. 9037 is 2
NOTE
1 For P-CODE variables, about 1.63 meter of part program
memory is consumed per 100 pieces of variables when part
program storage is 20 to 80m. The more P–CODE are
used, the more part program memory decreases. The
maximum no. of the usable P-CODE variables depends on
the capacity of the part program memory.
Part program storage memory 10 m:
Parameter on compiling No. 9037 = 6
Part program storage memory 20 m:
Parameter on compiling No. 9037 = 12
Part program storage memory 40 m:
Parameter on compiling No. 9037 = 25
Part program storage memory 80 m:
Parameter on compiling No. 9037 = 51
Part program storage memory 160 m - 1280 m:
Parameter on compiling No. 9037 = 60
In Series 16-B/18-B, part program storage memory is not
used. (Parameter no. 9037 needs to be set).
When compilation parameter no. 9007#7 EXT=1, the no.
of P-CODE variables is the above value–1.
For the 21-TB, approximately 1.63 meters of tape is
required to store each 100 P-CODE variables, even
when the tape length is 160 meters.
For the 21-MB, whether part program memory is used
varies with the CNC system software series.
-DDA1 series :Part program memory is not used.
-D201 series:Part program memory is used.
2 The P–CODE variables still maintain their values after the
power is turned off.
3 Before executing the conversational macro with the
complied ROM module loaded, erase all the programs in the
part program storage memory once.
(Turn on the power while pushing key with the setting
DELETE
(PWE = 1).)
With this operation all the conversational macro functions
will be initialized to be ”blank”.
Array type variables for P–CODE in conversational macro
#10000 – can be refered to in 2 to 3 dimentional array type.
(See 6.12 (1) )
44
Page 53
B–61803E–1/07
PROGRAMMING
5. MACRO VARIABLES
5.5
VARIABLES OF
EXPANDED P–CODE
(#20000 – ....)
The variables of the expanded P-CODE which start from #20000 can be
used for the optional number, if the capacity of tape memory is 160m to
1280m. This variable can be selected for numbers with floating decimal
points, the same as the usual common variable or for numbers with the
integer type by parameter (parameter No. 9002#3 EVF) specification.
Parameter No. 9002#3
EVF= 0: floating decimal point type
EVF= 1: the integer type
N times the number set paramater No.9044 is the number of the usuable
variables for the P-CODE the same as the exclusive variables for the
P-CODE (#10000 ---). The P-CODE variables cannnot be used, if
parameter No. 9044 is 0.
The number of n is 12 with the floating decimal point type, and is 30 with
the integer type.
EVF=0: in the case of the floating decimal point type
#20000 to #20011 if parameter No. 9044 equals 1
#20000 to #20023 if parameter No. 9044 equals 2
EVF=1: in the case of the integer type
#20000 to #20029 if parameter No.9044 equals 1
#20000 to #20059 if parameter No.9044 equals 2
In the case of the integer type, one of -32768 to 32767 can be set. Digits
under the decimal point are rounded off when a value is substituted to the
left side of the substitution statement.
Furthermore, this variables is evaluated after converted into the
floatingdecimal point type, if this varables occurs in expression.
About a 0.21 meter of part program memory is used per set (number of
parameter No. 9044) of the variables of the expanded P-CODE.
The part program memory being used is displayed on the program library
screen. The maximum number of P-CODE variables depends on the
capacity of the part program memory.
Part program memory 160m: Parameter No. 9044=819
Part program memory 320m: Parameter No. 9044=1638
Part program memory 640m (EVF=0): Parameter No. 9044=3276
Part program memory 640m (EVF=1): Parameter No. 9044=2184
Part program memory 1280m (EVF=0): Parameter No. 9044=5461
Part program memory 1280m (EVF=1): Parameter No. 9044=2184
NOTE
For Series 20, Series 21, expanded P-CODE (#2000 -)
cannot be used.
45
Page 54
5. MACRO VARIABLES
PROGRAMMING
B–61803E–1/07
5.6
DISPLAYING
VARIABLES
The variables used for P-CODE programs, such as local variables,
common variables, P-CODE variables, and extended P-CODE variables,
can be displayed by pressing the function key
OFFSET
several times.
SETTING
The values of these variables can be specified using the MDI keys.
The desired screen can be selected using page keys, cursor key, and
[NO-SEL] key.
Pressing the
screen. Pressing the
page key returns the current screen to the previous
page key displays the next screen.
A desired variable can be displayed with the numeric key and [NO-SEL]
key .
The desired value can be entered for the variable at the cursor position
using the numeric keys and the
INPUT
key. However, no values can be
entered in local variables or write-inhibited system variables.
NOTE
1
The setting of NDP, bit 1 in parameter 9000, for the executor
depends on whether variables to be used for P-CODE programs
are displayed. T o display the variables, set bit 1 of parameter 9000
to 1.
2 The specified values of the variables are displayed when the
screen is displayed. In other words, if the values of the variables
are changed while the screen is displayed, the changed values are
not displayed.
3 To change the screen from the P-CODE VARIABLE screen to
another screen such as current position screen or conversational
macro screen, press the correspondence function key such as
and .
POS
If the 20-FA or 20-TA is your NC, press both right most and left
most soft keys at the same time and the screen changes from the
P-CODE screen to the current position display screen.
CUSTOM
46
Page 55
B–61803E–1/07
6
6. FUNCTIONS OF THE MACRO
PROGRAMMING
FUNCTIONS OF THE MACRO EXECUTOR
T able 6 (a) Functions (1/2)
EXECUTOR
No.
6.1Screen display function
1 Screen display control
2 Function screen control
3 Masking conversational macro screen
status display
4 Shift for adjusting the graphic screen
6.2Address functionReads data at PMC addresses.
6.3Writing at PMC addressesWrites data at PMC addresses.
6.4Reader/punch interface controlControls the RS-232C interface.
6.5Reading and writing an NC programReads NC programs from and writes them
6.6Continuous input with the cursor and page
keys
6.7Masking the display of O and N numbersClears the display of O and N numbers on
6.8Reading and presetting the cutting time and
cutting distance
6.9Reading and presetting the relative coordinates
6.10Key/data input controlReads the states of MDI keys and the val-
6.11Cursor controlDisplays the cursor at any position on the
6.12Processing of P-CODE variables of array
type
6.13Torque limit controlSpecifies the override values of the torque
6.15Key-in line functionSpecifies a desired display position and
6.16Reading the status indicating editing in the
background
6.17Reading the number of registered programs
6.18Reading the unused capacity of CNC program memory
6.19Reading the remaining travel distanceReads the remaining travel distances for
FunctionOutline
Controls the display of the conversational
macro screen.
onto the CNC tape.
Continuously inputs data with the cursor
and page keys.
the CUSTOM screen.
Reads and presets the cutting time and the
cutting distance.
Reads and presets the relative coordi-
nates.
ues of entered data.
conversational macro display screen.
References P-CODE variables of two- or
three-dimensional array type.
limits for each servo axis.
color of the key-in line for conversational
macros.
Reads the status indicating whether editing
is currently performed in the background.
Reads the number of the programs registered in CNC program memory.
Reads the capacity of unused areas in
CNC program memory.
each servo axis.
Conversa-
tional
(NOTE 1)
(NOTE 3)(NOTE 3)
Auxiliary
(NOTE 1)
Execut-
(NOTE 2)
able
47
: Usable∆ : Partially usable: Unusable
Page 56
6. FUNCTIONS OF THE MACRO
EXECUTOR
PROGRAMMING
T able 6 (a) Functions (2/2)
B–61803E–1/07
No.FunctionOutline
6.20Use of offset memory and extended system
variables in the workpiece coordinate system
6.21PMC axis controlControls the PMC control axes.
6.22Interlock along each axisApplies interlocks along each axis and
6.23Separation of P-CODE program UI/UOSeparates the system variables for macro
6.24Referencing the common variables for custom macros
6.25Displaying the conversational macro
screen when power is turned on
6.26Masking of screen switching with the CUSTOM key
6.27Searching for a P-CODE workpiece number
6.28Function for calling a user program with an
executable macro
6.29Arithmetic functionLogarithmic function, Exponential function
6.30MDI key image read function by conversational macro
6.31Window functionVarious CNC system information can be re-
6.32Special character registeration and display
function
6.33Execution macro call mask functionAn execution macro call can be masked by
Reference data in offset memory and the
values of extended system variables in the
workpiece coordinate system using macro
variables from 100000 to 199999.
reads the travel axis and the direction of
movement along the axis when the skip signal goes high.
DI/DO into the signals for user programs
and those for P-CODE programs.
Reads the common variables for the user
program from and writes them to the PCODE program.
Displays the conversational macro screen
in the emergency stop state of the CNC or
in the external reset state.
Inhibits the conversational macro program
from being executed again from the beginning when the CUSTOM key is pressed on
the conversational macro screen.
Directly executes the P-CODE program
registered in an executable macro variable.
Calls a user program from the P-CODE
programs for executable macros.
Arc sine function and Arc cosine function
can be used.
MDI key image that reflects MDI key status
(pressed/or released) can be read from the
conversational macro.
ferred to through window.
Maximum 40 special characters can be
registered and displayed.
using an executor parameter or macro variable.
Conversa-
tional
(NOTE 3)(NOTE 3)(NOTE 3)
(NOTE 4)(NOTE 4)
(NOTE 5)(NOTE 5)
(NOTE 7)
Auxiliary
Execut-
able
(NOTE 6)
: Usable∆ : Partially usable: Unusable
NOTE
Since the Series 21 do not support the graphic display feature, they
1
cannot use the drawing, painting, or other functions based on the
graphic coordinate system.
2 This function can be used only for Series 16-B.
3 This function can not be used for Series 20 and for Series 21.
4 This function can not be used for Series 20-TA.
5 This function can not be used for Series 20.
6 To use the arithmetic function in the execution macro, custom
macro B option must be combined in the CNC.
7 This function can be used only for Series 20.
48
Page 57
6. FUNCTIONS OF THE MACRO
B–61803E–1/07
T able 6 (b) Functions of the Macro Executor and the Associated G Codes and Macro Variables (1/2)
PROGRAMMING
EXECUTOR
No.Function
6.1Screen display functionG01, G02, G03, G202,
6.2Address function
6.3Writing at PMC addressesG310
6.4Reader/punch interface control
6.5Reading and writing of an NC
program
6.6Continuous input with the cursor and page keys
6.7Masking the display of O and
N numbers
6.8Reading and presetting the
cutting time and cutting distance
6.9Reading and presetting the
relative coordinates
6.14Reading of A/D converter data#8631, #8632, #8633, #8634
6.15Key-in line function#8561, #8562, #8563, #8564,
6.16Reading the status indicating
editing in the background
6.17Reading the number of registered programs
6.18Reading the unused capacity
of CNC program memory
6.19Reading the remaining travel
distance
6.20Use of offset memory and extended system variables in
the workpiece coordinate system
6.21PMC axis controlG340, G341, G344,
Associated G
code
G204, G206, G240,
G242, G243, G244,
G249
G330, G331, G335,
G336, G337, G338,
G339
G320, G321, G325,
G326, G327, G328,
G329
#8501
#8553, #8554
#8998, #8999
G315#851 1, #8512, #8513, #8514,
#8526
#8527
#8528
#5181 to #5188
#100000 and up
G345, G346, G348,
G349
Associated macro vari-
able
#8509
#8539
#8520, #8521, #8522, #8523,
#8529
#8552
#8515, #8516, #8517, #8519
#8565
#8602, #8700
#8710 to #8713, #8715,
#8720 to #8723, #8725
#8730 to #8733, #8735
#8740 to #8743, #8745
Conversa-
tional
(NOTE 1)∆(NOTE 1)
(NOTE 3)(NOTE 3)
(NOTE 3)(NOTE 3)
(NOTE 4)(NOTE 4)
Auxiliary
Executa-
ble
(NOTE 2)
49
: Usable∆ : Partially usable: Unusable
Page 58
6. FUNCTIONS OF THE MACRO
EXECUTOR
PROGRAMMING
T able 6 (b) Functions of the Macro Executor and the Associated G Codes and Macro Variables (2/2)
B–61803E–1/07
No.Function
6.22Interlock along each axis#8600, #8601
6.23Separation of P-CODE program UI/UO
6.24Referencing the common
variables for custom macros
6.25Displaying the conversational
macro screen when power is
turned on
6.26Masking screen switching
with the CUSTOM key
6.27Searching for a P-CODE
workpiece number
6.28Function for calling a user program with an executable macro
6.29Arithmetic function
6.30MDI key image read function
by conversational macro
6.31Window function#8998, #8999
6.32Special character registeration and display function
6.33Execution macro call mask
function
Associated G
code
#99000
#8549
#8690, #8691
Associated macro vari-
able
Conversa-
tional
(NOTE 5)(NOTE 5)
(NOTE 7)
Auxiliary
Executa-
ble
(NOTE 6)
: Usable∆ : Partially usable: Unusable
NOTE
Since the Series 21 do not support the graphic display feature, they
1
cannot use the drawing, painting, or other functions based on the
graphic coordinate system.
2 This function can be used only for Series 16-B.
3 This function can not be used for Series 20 and for Series 21.
4 This function can not be used for Series 20-TA.
5 This function can not be used for Series 20.
6 To use the arithmetic function in the execution macro, custom
macro B option must be combined in the CNC.
7 This function can be used only for Series 20.
50
Page 59
B–61803E–1/07
PROGRAMMING
6. FUNCTIONS OF THE MACRO
EXECUTOR
6.1
SCREEN DISPLAY
FUNCTION
6.1.1
Coordinates System
of Screen
In this section, the terms twelve–soft–key type and seven–soft–key type
represent the following display units:
Twelve–soft–key type:Those display units with twelve (10 + 2) soft
keys (such as the 14” CRT, 10” LCD, 9.5”
LCD, and 10.4” LCD units)
Seven–soft–key type:Those display units with seven (5 + 2) soft keys
(such as the 9” CRT, 8.4” LCD, 9” PDP, and
7.2” LCD units)
The coordinates system used for character display and cursor display in
the conversational macro program is called the character coordinates
system.
The coordinate system used for graphic display in the conversational
macro program is called the graphic coordinate system.
(1) Display unit with seven soft keys
The graphic coordinate system can be selected from the standard
mode and the high resolution mode. Select one of these by the
parameter HRGR (No.9003#2) in compiling. Select high-resolution
mode for Series 16 and Series 18.
As for the character coordinates system, the horizontal direction is X
coordinate and the vertical direction is Y coordinate. Specify the X
coordinates from 0 to 39 from left to right and the Y coordinates from
0 to 15 from top to bottom. Any command of display exceeding the
above range will be ignored. 1 unit is 1 character.
Since the 13th is used for the input section and the 14th is used for the
state display section, they cannot be specified. Furthermore, the soft
key frame section cannot be specified either.
123
0123456789012345678901234567890123456789
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
6.1.1(a) Character Coordinate System (In Case of Seven Soft Keys)
[][][][][]
012345678901234567890123456 7890123456789
123
The coordinates system used for graphic display in the conversational
macro function is called the graphic coordinates system.
51
Page 60
6. FUNCTIONS OF THE MACRO
EXECUTOR
PROGRAMMING
B–61803E–1/07
As for the graphic coordinates system, too, the horizontal direction is the
X coordinate and the vertical direction is the Y coordinate. Specify the
X coordinates from -160 to 159(-320 to 319) from left to right and the Y
coordinates from -112 to 112(-200 to 199) from bottom to top.(Value in
parenthesis is for high resolution mode.) Any command of display
outreaching the above range will be ignored. 1 unit is 1 dot.
The center of the screen will be (X, Y) = (0, 0).
Y
–160
(–320)
Screen
+112(199)
0.0
–112(–200)
Value in parenthesis is for high
resolution mode.
X
+159
(319)
6.1.1(b) Graphic Coordinate System
(a) Standard mode
Use the same coordinate system as that of the series 0 standard
seven soft keys.
Center of screen
(X coordinates, Y coordinates) = (0, 0)
Left and right of screen
(X coordinates) = (–160 – 159)
Top and bottom of screen
(Y coordinates) = (–112 – 112)
(b) High resolution mode
Use the high resolution coordinate system.
Center of screen
(X coordinates, Y coordinates) = (0, 0)
Left and right of screen
(X coordinates) = (–320 – 319)
Top and bottom of screen
(Y coordinates) = (–200 – 199)
Graphic display macro prepared in the series 0 standard seven soft keys
can almost be used unchanged in standard mode. The high resolution
graphic mode allows highly accurate display that was not possible in
standard mode.
(2) Display unit with twelve soft keys
(a) Character coordinates line, graphic coordinates line
Character coodinate system instructs in the range of 0-79 for the left and
righ directions (X coodinates), and 0-24 for the up and down directions
(Y coordinates). The 20th line is used for input and the 21st line is used
by the system for status display and can not be satisfied. The space for
the software key also cannot be satisfied.
52
Page 61
B–61803E–1/07
19
20
21
22
23
24
6. FUNCTIONS OF THE MACRO
PROGRAMMING
167
0123456789012 to 678901234567890123456789
0
1
2
3
4
5
6
7
8
0123456789012 to 678901234567890123456789
167
6.1.1(c) Character Coordinate System (twelve soft keys)
EXECUTOR
6.1.2
Screen Display Control
Code
Instruct the following graphic coordinates of the graphic coordinates
system.
Center of screen
(X coordinates, Y coordinates) = (0, 0)
Left and right of screen
(X coordinates) = (–320 – 319)
Up and down of screen
(Y coordinates) = (–200 – 199)
It is possible to make the screen freely by commanding the contents of the
screen display with the conversational macro program. The following
control codes are prepared for the screen display.
1. G243 Character display
2. G202 Screen erase
3. G240 Color specification
4. G244 Graphic line specification
5. G242 Setting of graph start point
6. G01 Straight line graph
7. G02 Circular graph (Clockwise)
8. G03 Circular graph (Counterclockwise)
G202, G242 and G244 are the one-shot G codes. All the other G codes
are the modal G codes and they are considered as belonging to the same
G code group.
Also the following are the modal addresses.
X :X coordinate of the character coordinates system,
53
Page 62
6. FUNCTIONS OF THE MACRO
EXECUTOR
PROGRAMMING
B–61803E–1/07
X coordinate of the graphic coordinates system
Y : Y coordinate of the character coordinates system, Y coordinate of
the graphic coordinates system
I :X coordinate at the center of the circular graph of the graphic
coordinates system
J :Y coordinate at the center of the circular graphic of the graphic
coordinates system
A :Character size (Character display)
B :Flash specification (Character display)
F :Format of numeric display (Character display)
Z :Zero supress specification of numeric display (Character display)
Q :Circular graph (Graphic display), PC address write data
NOTE
Since the Series 21 do not support the graphic display
feature, they cannot use G01, G02, G03, G242, or G244.
Only character deletion is possible when using G202
(screen deletion).
(1) Character display (G243)
G243 Xx Yy Aa Bb Cc (c..) (*hhhh..*) Kk Ff.e Zz Dd Pp ;
There are 2 ways of commanding the character string to display.
a) Command to display a character string by enclosing it with
parentheses:
G243 (FANUC 16-SERIES) ; ”FANUC 16-SERIES” will be
displayed.
Those which you can command by enclosing with parentheses are the
alphabet, numbers, minus marks, and decimal points only.
b) Commandto display a character string by bounding with ”(*” and
”*)” by internal codes:
G243 (*46 41 4E 55 43*) ; ”FANUC” will be displayed.
G243 (*4E 43 4175 4356*) ; ”NC system” will be displayed.
Command with hexadecimal number. Divide the internal codes with
blanks. Take a space for 2 characters aside for hiragana and kanji. The
coordinates will be renewed when a character string is displayed.
For the character string, it is possible to specify up to maximum total 255
characters in 1 block. Count hiragana and kanji as 2 characters
respectively.
Also, it is possible to command the character code to display directly at
the address C
by decimal number. The commandable codes are 32 - 95
(20 - 5F with hexadecimal number) or 160 - 223 (A0 - DF with
hexadecimal number).
C40 →
*C61
→ =
Command the display positions of the character strings at the addresses
X and Y with the character coordinates.
54
Page 63
B–61803E–1/07
6. FUNCTIONS OF THE MACRO
PROGRAMMING
EXECUTOR
Command character size at the address A.
A1 = Normal size
A2 = Full size
A3 = Triple size (32 size)
A4 = 22 size
The following characters and symbols can be displayed at full size:
Alphabetic characters, numeric characters, kana characters, blanks,
the plus sign (+), minus sign (–), period ( . ), equal sign (=), comma
( , ), asterisk (
The triple size is 3 times as wide as and 2 times as long as the normal size.
The characters which can be displayed with the triple size characters are
the alphabet, numbers, minus marks, decimal points and blanks. No other
characters can be displayed with the triple size.
A 2-by-2 character is two times taller and two times wider than a standard
character. Fifteen types of 2-by-2 characters can be displayed: numbers
(0 to 9), plus sign, minus sign, decimal point, asterisk, and slash. Note,
however, that the Greek character φ is displayed for a slash.
NOTE
Only the Series 20 allows 2-by-2 character display . With the
Series 16/18/21, 2-by-2 characters cannot be displayed; A4
cannot be specified.
1. Standard character
G243 Xx Yy A1 (8)
2. Full-size character
G243 Xx Yy A2 (8)
3. Triple-size character (3-by-2 character)
G243 Xx Yy A3 (8)
4. 2-by-2 character
G243 Xx Yy A4 (8)
55
Page 64
6. FUNCTIONS OF THE MACRO
EXECUTOR
PROGRAMMING
B–61803E–1/07
Bink control is commanded by the address B.
B0 = Does not blonk.
B1 = Blinks slowly. (Energized for about 1/2 sec. and deenergized
for about 1/4 sec..)
B2 = Blinks quickly. (Energized for about 1/4 sec. and deenergized
for about 1/8 sec..)
NOTE
When a blink is specified, the display is energized or
deenergized according to the timer condition when the
display is commanded. Therefore, when the display is not
repeated, it will be kept energized or deenergized.
Command the number of blanks at the address K
. The blanks as many as
commanded at K will be displayed. When the blanks are displayed, the
coordinates will be renewed.
Command the format to display the numeric values at the address F
Command the number of display figures on the left of the point and the
number of figures under the point on the right of the point.
Command at the address Z
whether you do ”leading zero suppress” or not
when displaying the numeric values.
Z = 0 .. leading zero suppress will take place.
= 1 .. leading zero suppress will not take place.
The mark will not be displayed when Z is 0.
Command the numeric values to display at the address D
.
Command the sequence No. that the character string is cataloged at the
address P
. The character displayed will be the character string in one
block of the sequence No. commanded with P in the program set at the
character string registered program control variable #8509. The variable
for controlling character-string registration programs (#8509) is defined
as the number of the first program in the character-string registration
program group. Use the five digits for address P to select the desired
character-string registration program in the group.
.
G243 Xxx Yyy Ponnnn;
o : A number from 0 to 8 to select a program in the
character-string registration program group
nnnn : Sequence number 0001 to 9999
Example 1)#8509 = 1000 ;
G243 P10 ; ⇒ Displays the character string with sequence
number N10 in program O1000
G243 P80010 ; ⇒ Displays the character string with sequence
number N10 in program O1008.
Up to nine character-string registration programs can be selected as
desired in the above way.
56
Page 65
B–61803E–1/07
PROGRAMMING
Example 2)
6. FUNCTIONS OF THE MACRO
EXECUTOR
O9000;
:
#8509=8000;
X0Y0;
G243(ABC)P20;
O8000;
:
N10(IJK);
N20(XYZ);
In this case, one block of the sequence No. 20 in the program No. 8000
will be executed.
In the above example, ”ABCXYZ” will be executed.
And address P executes the specified block after the process of the
corresponding block is finished. Consequently, ”ABCXYZ” will be
displayed though command is done as follows with the above example.
G243 P20 (ABC) ;
Nothing but the character string will be described at the block specified
by P.
When #8509 is 0, the block of the sequence No. specified in the current
program will be executed.
NOTE
Process sequence of modal address
Program is processed by block in the normal NC program,
but it is processed in sequence of address command in the
conversation macro program.
(Example)
1F8.3 ;
G243 F5.1 D#100 ;
2F8.3 ;
G243 D#100 F5.1 ;
In 1 #100 is displayed with F5.1, but in 2 it is displayed with
F8.3.
(2) Screen erase (G202)
G202 XxYyIiJjPp;
X= Start point of X coordinate in character coordinate
Y= Start point of Y coordinate in character coordinate
I = Number of characters to be erased from the start point
(X coordinate) for partial erasing.
J = Number of characters to be erased from the start point
(Y coordinate) for partial erasing.
P = 1 ... Erasing graphic screen
= 2 ... Erasing character screen
57
Page 66
6. FUNCTIONS OF THE MACRO
EXECUTOR
PROGRAMMING
B–61803E–1/07
= 3 ... Erasing graphic and character screens
Also to make partial erasing, all X, Y, I and J addresses must be specified.
If any address is omitted, all the screen is erased.
(3) Displayed color specification (G240)
G240 Pp L
;
l
Colors of segments and character strings specified by conversational
program can be designated.
P = 0 .. Black
= 1 .. Red=–1 Red (highlights)
= 2 .. Green=–2 Green (highlights)
= 3 .. Yellow =–3 Yellow (highlights)
= 4 .. Blue =–4 Blue (highlights)
= 5 .. Purple =–5 Purple (highlights)
= 6 .. Blueish green =–6 Bluish green(highlights)
= 7 .. White=–7 White (highlights)
L = 0 .. not blink
= 1 .. blink
If no designation is made, a segment and a character string are white
without blink.
(4) Graphic line specification (G244)
G244 Pp ;
P = 0 .. Full line
= 1 .. Broken line
= 2 .. 1-dot line
= 3 .. 2-dot line
= 4 .. Erase
The graphic line is full line at power ON.
(5) Setting of graph start point (G242)
G242 Xx Yy ;
Command the display start point with the absolute coordinates at the
addresses X and Y.
Next display will start at this point.
(6) Straight line graph (G01)
G01 Xx Yy ;
Command the coordinate of the end of the straight line with the absolute
coordinate at the addresses X and Y.
A straight line will be made with the line commanded with G244 from the
current position to the commanded coordinate. The coordinates will be
renewed.
(7) Circular display (G02, G03)
G02 Xx Yy Ii Jj Qq ;
G03 Xx Yy Ii Jj Qq ;
58
Page 67
B–61803E–1/07
6. FUNCTIONS OF THE MACRO
PROGRAMMING
EXECUTOR
G02 display the arc clockwise and G03 counter-clockwise.
Command the end of the arc with the absolute coordinate at the adresses
X and Y.
Y
Q=0
Q=1
X
Q=4
Q=2
Q=3
[No. of quadrants]
6.1.3
Graphic Painting
Function
Command the center coordinate of the arc with the absolute coordinate
at the address I and J.
Command the number of quadrant (0 - 4) of the arc at the address Q. The
arc will be graphed with the line commanded with G244 from the current
position to the coordinate of the commanded end.
The coordinate will be renewed.
The graphic function for conversational macros enables painting the
specified field.
NOTE
The graphic painting function cannot be used for Series 21.
(1) Description
The field to be painted is drawn using a solid line with the graphic
function. Then the paint command is used together with control code
G206 to specify any point inside the field and the boundary color. The
field is filled with the color which is used as standard when G206 is
issued.
G206PpXxYy;
Painting boundary color (P)
p = 0: Same as the fill color
p = 1: Red
p = 2: Green
p = 3: Yellow
p = 4: Blue
59
Page 68
6. FUNCTIONS OF THE MACRO
EXECUTOR
PROGRAMMING
p = 5: Purple
p = 6: Blue-green
p = 7: White
p = 8: Specified two or more colors other than black
Arbitrary point inside the field to be painted (X, Y)
NOTE
The field to be painted must have a closed boundary.
CorrentIncorrent
B–61803E–1/07
NOTE
To use the painting command on the high-resolution 9”
monochrome CRT, set HRGC of compilation parameter
9004 to 1 to make the CRT enter the intensity modulation
mode.
Graphic cursor can be displayed in the conversational macro.
(Command Format)
G249 Pp Xxxx Yyyy;
p:Control code
=0 : Display on (lit)
=1 : Display on (Blinks at low speed)
=2 : Display on (Blinks at high speed)
=3 : Display off
xxx/yyy:Graphic cursor display position
(Graphic coordinate)
(When display off is specified, this specification
is ignored. It can be omitted).
In a conversational macro, a rectangular figure can be displayed.
(1)Function
In rectangular display, a rectangle in which addresses X and Y, I and
J become diagonal positions is displayed.
(Xx,Yy)
(Ii,Jj)
Addresses X and Y, I and J are any position that can create a rectangle.
61
Page 70
6. FUNCTIONS OF THE MACRO
EXECUTOR
PROGRAMMING
B–61803E–1/07
(Ii,Jj)
(Xx,Yy)
(Ii,Jj)
(Xx,Yy)
(Command format)
G204 X_ Y_ I_ J_ [P ];
X: X coordinate of the start of a rectangle
Y: Y coordinate of the start of a rectangle
I : X coordinate of the end of a rectangle
J : Y coordinate of the end of a rectangle
P : Painting control= 1 : Painting in rectangle (red)
= 2 : Painting in rectangle (green)
= 3 : Painting in rectangle (yellow)
= 4 : Painting in rectangle (blue)
= 5 : Painting in rectangle (purple)
= 6 : Painting in rectangle
(bluish green)
= 7 : Painting in rectangle (white)
Command in parentheses can be omitted.
The color of boundary of a rectangle is of specified by G240P_ and
painted color in rectangle is of specified by address P.
When address P is omitted, only boundary of a rectangle is displayed.
After the painted color is specified by P, the color remains the following
movement. That is, the color specified by P changes the P value of
G240P_.
T ype of line of rectangle is of a type specified by the line type specification
command (G244P_).
(2) Example
G244 P1;
G240 P1;
G204 X-200 Y150 I0 J10;
–3200319
199
Boundary
line is red.
0
~~
–200
62
Page 71
B–61803E–1/07
6. FUNCTIONS OF THE MACRO
PROGRAMMING
G244 P0;
G240 P2;
G204 X50 Y50 I-200 J150 P1;
–3200319
199
~~
–200
Painting is
Boundary
line is
green.
(High resolution mode)
EXECUTOR
6.1.6
Intensity Modulation
Mode Display of 9”
Monochrome CRT
NOTE
Be sure to specify full line when you specify painting.
Painting is started from the point determined to be the
midpoint between addresses X and I and that between
addresses Y and J.
In painting, a boundary line can be displayed in any color
other than black. Painting is executed only when specified
on a black ground.
For 9” monochrome CRT, the conversational macro screen can be
displayed in intensity modulation mode using a compile parameter (No.
9004#4, 9008#7).
Color specification code (G240) specifies intensity. During the
monochrome mode, the color specification code is ignored.
G240 Pp L1;
P = 7 (Brightest ) to 1 (Darkest), 0 (Black)
L = Reverse specification
63
Page 72
6. FUNCTIONS OF THE MACRO
EXECUTOR
PROGRAMMING
B–61803E–1/07
6.1.7
Displaying Seven Soft
Keys Data on the Twelve
Soft Keys Type
Data for a twelve soft keys can be displayed on the user-1 screen for a
conversational macro screen on the twelve soft keys by setting US19W
of compilation parameter (bit 5 of parameter 9006). (This screen is
equivalent to the AUX screen in Series 0.)
The whole of user screens 2 and 3 can be used as macro screens while they
are displayed. (The absolute coordinates are always displayed on the
position screen.)
US19W = 1: Displays seven soft keys data on the twelve soft keys
type
<<USER1 screen when seven soft keys data is displayed>>
Position screen
Macro screen
NOTE
Upper left corner of the macro screen is X=40 and Y=7.
<<USER2 and USER3 screens>>
Macro screen
64
Page 73
B–61803E–1/07
PROGRAMMING
6. FUNCTIONS OF THE MACRO
EXECUTOR
6.1.8
Function Screen Control
Function
Function screen for a small keyboard
POS
: Current value display screen
: Program display screen
PROG
OFFSET
: Offset/setting screen
SETTING
SYSTEM
: Parameter/diagnosis and suchlike
MESSAGE
: Alarm/message screen
CUSTOM
: Graphic/user screen
GRAPH
CUSTOM
: User screen
Writing a desired value in parameter 8510 enables displaying any
function screen. Reading the value of parameter 8510 enables checking
which function screen is currently displayed.
The following table shows the correspondence between function screens
and the values of parameter 8510.
Value of pa-
rameter 8510
0
1
2
3
4
5
6
Function screen for a standard/FAPT
keyboard
: Current value display screenPOS
: Program display screen
PROG
OFFSET
: Offset/setting screen
SETTING
SYSTEM
: Parameter/diagnosis and suchlike
MESSAGE
: Alarm/message screen
GRAPH
: Graphic screen
CUSTOM
: User screen
Value of pa-
rameter 8510
0
1
2
3
4
5
6
6.1.9
Function for Masking the
Status Display on the
Conventional Macro
Screen
6.1.10
Shift Function for
Adjusting the Graphic
Screen
: FAPT screen (FAPT key)FAPT
7
The mode and status display can be masked on the user-1, -2, and -3
screens for displaying the conversational macro screen by specifying
compilation parameter STDM (bit 2 of parameter 9006).
The 14th line on the seven soft keys and 21st line on the twelve soft keys
can therefore be controlled with conventional macros.
The graphic coordinate system can be shifted in units of dots on the
conversational macro screen by specifying compilation parameters 9048
and 9049.
Compilation parameter 9048:
Shift value along the X-axis in the graphic coordinate system on the
conversational macro screen
Compilation parameter 9049:
Shift value along the Y-axis in the graphic coordinate system on the
conversational macro screen
65
Page 74
6. FUNCTIONS OF THE MACRO
EXECUTOR
PROGRAMMING
B–61803E–1/07
6.2
ADDRESS
FUNCTIONS
The address functions are the functions to return the address of PMC or
the contents of the parameter as the function values. However, as the
address functions cannot be written, it is impossible to describe them on
the left side of an operation. Control code G310 is prepared for PMC
address writing.
The format of the address functions is as follows.
<Address><Address No.> or <Address><Address No.>.<Bit position>
(parameter cannot be used) or<Address><Address No.>.<Axis No.>
Address P indicates the parameter and the other addresses indicate PMC
addresses.
P100 returns the contents of the parameter No. 100 as function values
respectively.
Since the bit position cannot be specified for parameters, if it is required,
take the bit data using AND instruction.
Also, G100.1 returns the contents of the bit 1 of PMC address G100 ,and
G105 returns the contents of PMC address G105 as function values
respectively.
It is possible to describe <Address No.> and <Bit position>or<Axis No.>
with variables or
# [<Expression>] or [<Expression>], instead of numbering them with
numerical values directly.
For example, it is possible to describe as follows.
P#100
P#100.#101
G# [#100+1]
G [#100+1] .[[#100-1]/2]
The usable addresses are ”P” for parameter and X, Y, F, G, R, D,T,C, K
and A of PMC addresses.
Format conforms to that used for ladder diagram.
Refer to the operator’s manual for the detail of parameters and to the PMC
programming manual for details of the PMC addresses.
NOTE
Refer to the section titled ”PMC Address Write Control Code
(G310)” for writing data to the PMC addresses R,D,C, and
K.
66
Page 75
B–61803E–1/07
6.3
READING AND
WRITING A PMC
ADDRESS
6. FUNCTIONS OF THE MACRO
PROGRAMMING
EXECUTOR
(1) PMC address write control
Data of one, two, or four bytes can be written when address L is
specified with control code G310.
G310 Dd Qq Lx;
G310 Rr Qq Lx;
G310 Cr Qq Lx;
G310 Kr Qq Lx;
These commands write the data indicated by address Q at the PMC
address indicated by address D, R, C, or K, a number of bytes at a time
as indicated by address L. The data cannot be specified in bits.
The write data indicated by address Q is rounded as follows: Decimal
places of 0.5 and over are counted as a whole number and the rest are
discarded. Then the data is expressed in binary form and written.
When the data is a negative value, it is handled and converted as two’s
complement.
When the following is specified, the data is written in the PMC data
area (D300 to D303) as shown in the table below:
In two’s complement, the decimal number –500 becomes FFFFFE0CH in
hexadecimal.)
When the specified data contains more bytes than that indicated by
address L, only the data of the length specified by address L is written.
This will not cause an error. (If L1 is specified in the example above,
the identical data is written only in D300.)
(2) PMC address read control
When a variable is indicated by address P with control code G310, the
PMC data can be read. Address L indicates that the data of one, two,
or four bytes is read at a time.
G310 Dd Pp Lx;
G310 Rr Pp Lx;
G310 Cr Pp Lx;
G310 Kr Pp Lx;
These commands read the data which starts from the PMC address
indicated by address D, R, C, K or A and whose length is indicated
in bytes by address L into the variable indicated by address P. The
read data is handled as binary data consisting of the specified number
of bytes, converted, and assigned to the variable.
If G310 D400 P101 L2; is specified when the PMC data area (D400
to D401) has the data shown below, –500.0 is input in #101.
Bit76543210
D40000001100
D40111111110
67
Page 76
6. FUNCTIONS OF THE MACRO
EXECUTOR
PROGRAMMING
B–61803E–1/07
The address function can read data the specified number of bytes at
a time. However, the following must be noted: As the address
function handles and converts the read data as a signed value (in two’s
complement), the read data may be changed.
If the following is specified with the example shown above, –2.0 and
254.0 are read into #102 and #103 respectively.
G310 D401 P102 L1;
#103 = D401;
NOTE
1
When address Q is specified, write control is executed. When
address P is specified, read control is executed. If both addresses
Q and P are specified, write control is executed.
2 Addresses other than D, R, C, K (X, Y , G, F...) cannot be specified.
3 With address L, 1, 2, or 4 can be specified. If another value is
specified, or if address L is omitted, the data is written or read the
specified number of bytes at a time.
4 For details of the PMC address, refer to the PMC programming
manual.
68
Page 77
B–61803E–1/07
6.4
READER PUNCHER
INTERFACE
CONTROL BY
CONVERSATIONAL
MACRO
PROGRAMMING
6. FUNCTIONS OF THE MACRO
EXECUTOR
6.4.1
Outline
The conversation macro function allows the reader/puncher interface to
be controlled.
The control is performed by combining the following four control codes.
When this function is used, always set the expansion function validity
(No. 9002.7, EXT1) to 1 in the parameter on compiling.
G330 → reader puncher interface open
G331 → reader puncher interface close
G335 → 1 byte read
G336 → Data transmit
G337 → input of macro variable
G338 → output of macro variable
Select either channel 1 or channel 2 as a circuit to be used by specification
on opening.
Channels 1 and 2 cannot be controlled simultaneously.
In addition, when the normal I/O function is commanded on the channel
which is being used in this function, operation is not proper if the channel,
where the input of NC program is being executed by the I/O function, is
opened.
Select one control method out of the three methods shown in the
following by specification on opening a circuit.
(1) User macro control
The reader puncher interface is opened in the bidirectional mode and
no output control of control codes (DC1 to DC4) can be carried out
by the macro executor.
Use the macro executor when creating your own protocol.
When overflow of the reception buffer is detected, send the
transmission stop/restart message to the target device by switching
ON/OFF the control signal ”RS”.
(2) Read control (DC1/DC3 automatic control)
The ”DC1” code is automatically sent on opening, thus requesting
the target device to transmit data.
The ”DC3” code is transmitted on closing.
In addition, when overflow of the reception buffer is detected, the
output of ”DC3” and ”DC1” is automatically controlled.
No control of data transmission (G336) can be performed when the
reader/puncher interface circuit is opened in the read control mode.
(End code = 8)
(3) Transmission control (DC2/DC4 automatic control)
The ”DC2” code is automatically on opening, thus requesting the
target device to transmit data.
The ”DC4” code is transmitted on closing.
The interruption and restart processing of transmission by the target
device using the ”DC3” and ”DC1” are also automatically carried out.
69
Page 78
6. FUNCTIONS OF THE MACRO
EXECUTOR
6.4.2
Function Details
PROGRAMMING
B–61803E–1/07
No control of 1 byte reading (G335) can be carried out when the
reader/puncher interface circuit is opened in the transmission control
mode (End code = 8). There is an end code to check to see if the
commanded control code has been properly executed or not.
Check the end code after executing G330 to G338.
#8539 : End code (only for reading)
However, the circuit closing processing always ends normally.
(1) Circuit open (G330)
G330 Pp Bb Ss Cc ;
The reader puncher interface of the specified channel is opened
according to the control method and control conditions to enable it to
be used.
Select the channel and control method used by the specification of
address ”P”.
1 : Channel 1 User macro control
2 : Channel 2 User macro control
11 : Channel 1 Reading control (DC1/DC3 automatic control)
12 : Channel 2 Reading control (DC1/DC3 automatic control)
21 : Channel 1 Transmission control
(DC2/DC4 automatic control)
22 : Channel 2 Transmission control
(DC2/DC4 automatic control)
NOTE
In case of 21-TB, only channel 1 is used.
Specify the baud rate by the specification of address ”B”.
When the circuit is opened in the reading control mode, no control of
data transmission is carried out (End code = 8).
6.4.3
Inputting and Outputting
Macro Variables
Macro variable data input and output can be conducted simply by an
instruction via reader puncher interface. Instruct the control with the
following G code.
G337→ macro variable data input
G338→ macro variable data output
An end code #8539 is provided to check that input and output processing
runs correctly or not. Check the end code #8539 after running G337,
G338.
#8539 end code (read only)
72
Page 81
B–61803E–1/07
6. FUNCTIONS OF THE MACRO
PROGRAMMING
EXECUTOR
(1) Macro Variable Data Input (G337)
G337 Pp ;
p : the head variable number which mounts the macro variable
(omissible)
A macro variable data, which is input from reader puncher interface
that opened with the read control mode, is read and set it to the
correspondenting variable.
The tape format of macro variable data is as follows;
LFN_ P_LFP_LF%
Leader part
Start to input
Variable
number
Variable data
T ape end
Information before ”LF” which appears on the tape at first is all
disregarded.
The tape to the end (”EOR”) from the first ”LF” is analyzed as
significant information.
A section which is spaced with ”LF” and ”LF” into significant
information segments called a block, and one block shows one macro
variable data.
Address ”N” can be omitted. In this case, the variable number is
interpreted to be (the variable number of the preceding block) +1. If
”N” is omitted at the head block, the variable number is assumed to
be the one specified by address ”P” with instruction G337. Therefore,
a tape without ”N” is made out, and arbitrary variables are read by the
instruction of ”337” ” Pp”.
Address ”P” on the tape indicates the value of the variable and cannot
be omitted. ”LF” is specified after ”P” for value zero (#0) without
specifying the value.
LFN_ PLF
”LSK” or ”EDIT” goes on and off under the right of the screen if the
data is being read. If the data is being read, the screen cannot be
changed.
NOTE
1 G337 is a one shot G code.
2 Address ”O” data and every ”CR”, space, ”DEL” code is
disregarded within the significant information section.
3 Only ISO or ASCII code can be used for input code.
4 TV, TH check does not run.
73
Page 82
6. FUNCTIONS OF THE MACRO
EXECUTOR
PROGRAMMING
B–61803E–1/07
(2) Outputting Macro Variable Values(G338)
G338 Pp Qq Ff Zz ;
A specified macro variable is changed into a prescribed tape format
and output from reader puncher interface which opened with the
transmit control mode.
Output code is selected between ISO and ASCII code by the open
command.
p : Specify the head of output macro variable
q : Specidy the number of output macro variable data
f : Specify the output format of macro variable data
(modal value when omitted)
z : Specify the zero-suppress of macro variable data
(modal value when omitted)
For output tape format, same as the input format, the head variable
number address ”N” and variable values with address ”P” at the head
block, then variable values are continuously output with P in the
following blocks and finally, the tape end (”EOR”) code is output.
”CR” code of every block can be output by the compile parameter
PTCR(No.9003#6) . Use this code to make carriage return of a
printer, etc.
PTCR=0: ”CR” is not output after ”LF”, when outputting macro
variable values.
%LF N10000P1234P5678LFLF%
PTCR=1: ”CR” is output twice after ”LF”, when outputting macro
variable values.
LFN10000P1234%CRCRLFCRCRP1234 LFCRCR%
Control of the feed part does not act at output. Conduct with
”G336Kk” data transmission to feed with a paper tape puncher, etc.
”EDIT” goes on and off at the lower right of the screen if a data is
outputting. Screen cannot change if data is outputting.
NOTE
1
G338 is a one-shot G code.
2 Only ISO code or ASCII code can be used for output.
3 An end code is communicated by 115 when an invalid data is
specified to a variable number, and the outputting stops.
74
Page 83
B–61803E–1/07
PROGRAMMING
6. FUNCTIONS OF THE MACRO
EXECUTOR
6.4.4
Extending the Function
for Inputting and
Outputting a Macro
Variable
The conversational macro can input and output a macro variable via the
reader/punch interface. This function can be extended so that two or more
variable groups can be output at a time and the output data can be read into
another variable.
(1) Outputting macro variables
By adding address R to G338 described in (2) of Section 6.4.3, the
tape format of the variable data to be output can be controlled.
(Command format)
G338 Pp Qq Ff Zz Rr;
------------R0: Standard format (Same as when R is not specified)
R1: Variable numbers are not output.
R10 : At the end of the tape, % (EOR) is not output.
R11 : Variable numbers are not output. At the end of the tape,
% (EOR) is not output.
R20 : At the beginning of the tape, % (EOR) is not output.
R21 : V ariable numbers are not output. At the beginning of the
tape, % (EOR) is not output.
R30 : At the beginning and end of the tape, % (EOR) is not
output.
R31 : Variable numbers are not output. At the beginning and
end of the tape, % (EOR) is not output.
(a) When variable numbers are not output, the function for inputting
a macro variable (G337) can read the output variable data into a
variable indicated by address P.
(b) When % (EOR) is not output at the beginning and/or end of a tape,
two or more variable groups can be output to form a single tape
format.
|←#10000 to #10009→|←#11000 to #11019→|←#12000 to #12009→|
”R11””R31””R21”
B–61803E–1/07
(2) Function for inputting macro variables
By adding address Q to G337 described in (1) of Section 6.4.3, the
number of variables to be input can be specified. When address R is
also specified, data reading can be continued.
(Command format)
G337 Pp Qq R99;
--------P :Number of the variable to be read (V alid when variable
number N is not specified on the input tape)
Q :Number of variables to be read (Can be omitted)
R99 : Reading to be continued (Can be omitted)
(a) When address Q is specified, the number of variables to be read
can be specified. After the specified number of variables are
input, completion code #8539 is set to 99 to indicate that data
reading can be continued. If % (EOR) is read before reading the
specified number of variables, completion code #8539 is set to 0.
If address Q is omitted, the system assumes that an infinite
number is specified.
(b) When R99 is specified, the remaining variable data can be read
after the specified number of variables are read and completion
code #8539 is set to 99. If data reading is continued without R99,
the data of a variable is lost in the middle of reading because of
a significant information check. (The data up to the first ”;(LF)”
is skipped.)
(Example) Reading the tape output according to the example
described above
G330 Pp Bb ... ;
G337 P100 Q10 ;⇒
IF[#8539 NE 99]GOTO888;
G337 P15000 Q20 R99 ;⇒
IF[#8539 NE 99]GOTO888;
G337 P16000 R99 ;⇒
IF[#8539 NE 0]GOTO888;
G331 ;
76
The data of the first ten variables is read into #100 to
#109.
(After the data is normally
read, #8539 is set to 99.)
The data of twenty variables
is read into #15000 to
#15019.(After the data is
normally read, #8539 is set
to 99.)
The remaining variable data
is read into #16000 to
#16009.
(After the data is normally
read, #8539 is set to 0.)
Page 85
B–61803E–1/07
PROGRAMMING
6. FUNCTIONS OF THE MACRO
EXECUTOR
6.4.5
FANUC Floppy Cassette
Control
File data on the FANUC FLOPPY CASSETTE, FA CARD or FANUC
PROGRAM FILE M
ate can be read, prepared and deleted, by an opening
command and the instruction of control code ”G339”.
Read file data(G330)
Make file and write data(G330)
Read directory information(G330/G339 P1)
Delete file(G330/G339 P2)
Change file data(G330/G339 P3)
(1) Reading File Data (G330)
G330 Pp Bb Ss Cc Ll/Ff/Aa ;
Specify one of the address ”L/F/A” at the time when the line is open
by read control mode. At the result of this action, the head of specified
file and file data reading is conducted. Refer to Section 6.4.2(1)
”Circuit open” about address ”P/B/S/C”. However, specify reading
control (11/12) for address ”P” and ISO(2) for address (C).
Select one of addresses L,F, or A depending on the process.
(a) Head call by file name
Head call by file name is possible if the head variable number of
the variable string which is housed in the file name is specified
by address”L”.
Set the file name by decimalized ASCII code to the variable
string of 17 variables, and specify the head variable number by
address ”L”.
(Example)
When calling the file name ”ABCD”, set 65(A), 66(B),
67(C), 68(D), 32...32(space) to 17 variables of common
variables #100-116.
G330 P11 B10 S2 C2 L100 ;
NOTE
1
A file name is fixed to 17 characters. Be sure to use 17 characters.
2 Specify the file name with alphanumerics and space. Alarm 8 will
be generated if code 32(space) is specified at the head of file
name.
(b) Head call by the file number
Head call can be conducted with a file number, if the file number
(1-9999) is specified with address ”F”.
(Example)
When making a head call of file number 3
G330 P11 B10 S2 C2 F3 ;
(c) Head call of next file
Next file’s head call, which already exists can be conducted by
the specification of address ”A”. Use this function to read files
continuously . Be sure to specify ”A1” for address A”. End code
(=8) is the other specification.
(Example)
When making a head call of the next file which is being called
now
G330 P11 B10 S2 C2 A1 ;
77
Page 86
6. FUNCTIONS OF THE MACRO
EXECUTOR
PROGRAMMING
B–61803E–1/07
(2) Making Files and Writing Data (G330)
G330 PpB
Ss Cc (Ll/Ff) ;
b
New files are made and data can be written on a F ANUC cassette by
specifying one of address L or F when the communication line is
opened with transmission control mode.
Refer to 6.4.2(1) ”Circuit open” for the specification of address
”P/B/S/C”. Be sure to specify transmission control (21/22) for
address ”P”, and ISO (2) for address ”C”.
Select one of address L or F by processing.
(a) Making files by file name
A new file can be made and data can be written on a FANUC
cassette with a specified file name, if you specify the head
variable number of a variable string describing a file name by
address ”L”.
Set the file name by decimalized ASCII code to a variable string
of 17 variables. Set the head variable number with address ”L”.
(Example)
If you make a file of file name ”ABCD”;
65(A), 66(B), 67(C), 68(D), 32...32(space) shall be set to the
17 common variables of #100-116
G330 P21 B10 S2 C2 L100 ;
NOTE
A file name is fixed to 17 characters. Be sure to fill spaces(code
1
32), if the file name is less than 17 characters.
2 Specify a file name with alphanumeric and spaces. Alarm 8 will be
generated if the 32(space) code is specifyed at the head of the file
name.
3 A new file is added to the end of recorded files.
(b) Making files by file number
A new file can be made and data can be written to a specified file
number by specifying the file number (1-9999) after address ”F”.
(Example)
To make file No.3, specify as follows:
G330 P21 B10 S2 C2 F3 ;
NOTE
1 If you make a file with the file number, be careful that every file
which was previously input in the specifyed file number, and all
subsequent file numbers are deleted.
2 Preparation of files by file number can only be conducted for the
existing files. Files can be added only by file name specification.
(3) Control of Directory Information (G330/G339)
The control of directory information is possible with control code
”G339”.
Read directory information(G339 P1)
78
Page 87
B–61803E–1/07
6. FUNCTIONS OF THE MACRO
PROGRAMMING
EXECUTOR
Delete file(G339 P2)
Change file name(G339 P3)
The control mode at line opening shall be of directory information to
use this function. Instruct P=31/32 at the opening time for
specification of directory information.
G330 Pp Bb Ss Cc ;
P31 : Channel 1Directory information control
P32 : Channel 2Directory information control
Refer to the section on line opening for address ”B/S/C”. Be sure to
specify ISO (2) for address ”C”.
Do not instruct several functions continuously in one opening time
for every function of directory reading, file deleting, file name
changing if you open with the control mode of directory information.
For instance, close the line once to delete the file after reading and
checking directory information, as follows;
1. Open with the control mode of directory information
2. Read directory information
3. Close the line
4. Open with the control mode of directory information
5. Delete a file
6. Close the line
The same function can be instructed several times in one openning.
(a) Reading directory information
G339 P1 Ff Ll Ss ;
File directory information can be read to a specified variable by
specifying ”G339 P1”.
Specify the file number(1-9999) for which the directory
information is to be read by address ”F”.
Address ”L” specifies the head variable number of a continuous
17 variables which houses the read file name. The file name is
read with decimalized ASCII code every character.
Address ”S” specifies the variable number which houses the read
file size.
If you have specified (F specification) the file number once, the
next directory information can be read by instructing ”G339 P1”
without F specification.
End code =11 reports that the directory of the specified file
number does not exist.
(b) Deleting a file (G339 P2)
G339 P2 Ll/Ff ;
The relevant file can be deleted by the specification of ”G339
P2”.
Specify the head variable number of the variable string which
houses the file name (ASCII code) you wish to delete by address
”L”, or specify the file number of the file you want to delete by
address ”F”.
Be carefull when deleting with the file number because
subsequent file numbers will change after deletion.
79
Page 88
6. FUNCTIONS OF THE MACRO
EXECUTOR
PROGRAMMING
B–61803E–1/07
(c) Changing the file name (G339 P3)
G339 P3 Ff Ll ;
The recorded file name can be changed by the specification of
”G339 P3”.
Specify the file number (1-9999) of the file name you wish to
change, by address ”F”.
Specify the head variable number of the variable string that
houses the file name (ASCII code) to be changed, with address
”L”.
6.4.6
End Code (#8539)
Check the end code when G330-G339, has been instructed. There is no
end code for line closing processing. It is always a normal end.
#8539Contents
0Normal end
1Line doesn’t open
2Line trouble ,DSR signal OFF
3Line trouble, Over run
4Line trouble, Receive buf fer over flow
5Line trouble, Framing error, parity error
6No option for line function
7Line use
8Error in parameter
G335 instructed with transmit control mode
G336 instructed with read control mode
9Data format error
10Error on file number
11File of file number specified to read directory information does not exist
115Undefined variable number specified
255Receive data does not exist
80
Page 89
B–61803E–1/07
6.5
REFERENCING AND
READING NC
PROGRAM WITH
CONVERSATIONAL
MACRO
PROGRAMMING
6. FUNCTIONS OF THE MACRO
EXECUTOR
6.5.1
Outline
Recording, deleting and changing of NC part program is possible by the
conversational macro function. Control the NC program with program
number and block number. The block numbers are counted on each EOB
regarding the block with address ”O” being the No.1 block. For NC
programs in the converational macro , one word is expressed by 2
variables of an address code and a number, and several words construct
a block.
Set extension function valid (Parameter EXT1(No. 9002#7)) to ”1” at
compiling when using this function.
Make the control instruction using G codes (G320-G329) in the
conversational macro.
There is an end code #8529 to check that the instructed function run
correcctly or not. Check end code after running G320-G329.
The end is normal when the end code #8529 is 0, and in the cases other
than 0, the same number as the P/S alarm in the usual editing process will
be notified.
Control variable
#8520Specification of program number. . . .
#8521Specification of block number. . . .
#8522Specification of housed variable number. . . .
#8523Variable number of a variable that specifies the number. . . .
of digits under a decimal point.
#8529End code(for reading only). . . .
Control codes
G320Record a new block. . . .
G321Delete block. . . .
G322Condensation of program. . . .
G325Read specified block. . . .
G326Write block. . . .
G327Delete block. . . .
G328Read a specified block coded in characters. . . .
G329Write a specified block coded in characters. . . .
Background editing function as NC function is necessary for this
function.
81
Page 90
6. FUNCTIONS OF THE MACRO
EXECUTOR
6.5.2
Recording of a New
Program
PROGRAMMING
G320 ;
Specify the program number to #8520 and instruct G320 to record a new
program.
(Example)
To record O0002,
#8520=2 ;
G320 ;
IF[#8529 NE 0] GOTO 900 ;
Recording end
N900 ;
Error
Conduct similar processing as the edit ”Oxxxx”+”INSERT” when
recording a new program. EOB is not inserted.
O0002
%
B–61803E–1/07
6.5.3
Deleting a Program
6.5.4
Reading a Specified
Block
G321 ;
Specify the program number and instruct G321 to delete a program.
(Example)
To delete O0003
#8520=3 ;
G321 ;
IF[#8529 NE 0] GOTO900 ;
End of deletion
N900 ;
Error
(1) Reading a specified block coded in words (G325)
When issuing this command, specify a program number, block
number, and the number of the variable into which the block is to be
read. From the corresponding NC program coded in words, the
corresponding block is read into the specified variable area. Each
word contains two variables: an address code and numerical value.
If the function for reading a specified block coded in words (G325)
reads a block which is not coded in words, completion code #8529 is
set to 253 to indicate the fact.
When the completion code is set to 253, use the function for reading
a specified block coded in characters (G328) to read the same block.
(2) Reading a specified block coded in characters (G328)
When entering this command, specify a program number and block
number. From an NC program which is not coded in words, the
corresponding block can be read in units of characters into a specified
variable area. The block is read in the form of decimal ASCII codes.
Each control command (WHILE/IF/...) or function
(SIN/COS/FUP/...) is represented as a single data item consisting of
special code.
Prepared program data can be written in the variable area after the
block specified by the program number and block number.
Specify the maximum number of variable data by address P. If
address ”EOB” is present within the specified data, program is
written up to ”EOB”; if ”EOR” is present, program is written up
to the EOR; and if neither ”EOB” nor ”EOR” is present, program
is written by the number of data specified by address ”P”.
and it is impossible to conduct writing,
if the specification of block number is EOR block only or higher
numbers.
(1) Decimal point specification of every address in block writing
The number of digits after the decimal point of every address can be
specified. With this specification, the contents of the variable number
which was specified to #8523 becomes the number of digits after the
decimal point of address A, and it is possible to determine the number
of digits after the decimal point of every address, as shown below.
#8523=501 ;
#501 is the number of digits after the decimal point of address A
#502 is the number of digits after the decimal point of address B
:
:
#525 is the number of digits after the decimal point of address Y
#526 is the number of digits after the decimal point of address Z
Specify <vacant> or 0 - 7 for the number of digits after the decimal
point. In the case of <vacant>, it is considered that no decimal point
exists in the address.
(Example)
If address code=A, number=1.2345678
Decimal point specification
* The data less than the specified digits is rounded off.
When #8523 is 0, auto setting is conducted by the system conditions
(mm input/inch input, 0.1µm instruction) and specified address.
#8520 - #8523 is set to 0 when the power is turned on.
(2) Writing a block coded in characters (G329Pp)
Use this command to write a program whose data is not coded in
words. This command writes the program data coded in units of
characters in a variable area.
The block to be written must be defined beforehand in ASCII code
in a macro variable area. This command writes the data after the block
specified by the program number and block number.
The maximum number of variable data items is indicated by address
P . If EOB or EOR is detected while the specified variable data is being
written, data writing ends at the EOB or EOR. When neither EOB
nor EOR is found, the complete data indicated by address P is written.
This command cannot catalog a program. If an attempt is
made to catalog a program with this command (if the data
to be written begins with O), an error code is indicated and
#8529 is set to 202.
G327 ;
A block specified by a program number and a block number can be
deleted.
#8520=4 ;
#8521=3 ;
G327 ;
IF[#8529 NE 0] GOTO900 ;
End of deletion
N900 ;
Error
The block of block No.3 of program O0004 is deleted by the above
instruction.
86
Page 95
B–61803E–1/07
PROGRAMMING
6. FUNCTIONS OF THE MACRO
EXECUTOR
6.5.7
Condensation of
Program
6.5.8
End Code (#8529)
When writing an NC program prepared by a conversational macro onto
the NC’s tape memory, the program can be condensed to extend memory
area.
Set a program number of a program to be condensed to the variable #8520
and specify G322. Then the program is condensed.
The result of condensation is informed to the end code #8529.
(Example)To condense O1234
#8520=1234;
G322;
IF [#8529 NE 0] GOTO Error;
Check the end code after running every processing.
The end is normal when the end code is 0, and when the end code is a
number other than 0, the same number as with the P/S alarm in the usual
edition processing and the following codes are informed.
#8529Contents
140Processing of the program being selected in the foreground cannot be con-
ducted.
200The specified character code is not found. (G329)
202The data to be written begins with O. (G329)
253The specified block is not coded in words.
254Program editing is prohibited by setting the memory protection key [when
compilation parameter bit 1 of No. 9006 (KEYC) is set to 0].
255Need the option for background editing function.
It is impossible to instruct the statement during background editing.
Parameter for the extension function effective (No.9002#7 EXT1) must be
set to ”1” at compiling.
6.5.9
Notes
6.5.10
Address Code Table
Selection processing by work number search etc. is required when
foreground operation is executed for a program which has been prepared
and edited under background.
Continuous input by cursor and page key is possible with the
conversational macro key input control (#8501).
(Address code table)
#8501 can be read with the following timing if the cursor and page key,
are continuously pressed.
Page key ON
OFF
#8501=data
#8501=0
3232128
(MSEC)
NOTE
The value of #8501 remains as is until read by a macro
statement. Once the value has been read, all key entries
are ignored.
89
Page 98
6. FUNCTIONS OF THE MACRO
EXECUTOR
PROGRAMMING
B–61803E–1/07
6.7
MASKING OF O, N
NUMBER
APPEARANCE
6.8
READING AND
PRESETTING
CUTTING TIME AND
CUTTING DISTANCE
BY
CONVERSATIONAL
MACRO
6.8.1
Reading and Presetting
Cutting Time (#8553)
O, N number appearance can be erased on the CUSTOM screen.
O, N numbers does not appear when compile parameter ”ONMSK=1”
(No.9003#0).
Cutting distance and cutting time can be read and preset with the macro
variable of the conversational macro.
Use it for the control of a tool life.
#8553, #8554 does not bocome 0 at power on.
The time only for instruction of G01 (linear interpolation) and G02,G03
(circular interpolation) can be counted by #8553.
The unit is the same as the macro variable (#3002).
6.8.2
Reading and Presetting
Cutting Distance (#8554)
The distance only for instruction of G01(linear interpolation), and G02,
G03 (circular interpolation) can be counted by #8554.
It is valid also for helical instruction.
Parameters (No.9002#7 / EXT1) and (No.9004#7 / CUTLG) have to be
on at compiling to use this function.
The unit is
... 0.001(mm) for the mm input system.
... 0.0001(inch) for the inch input system.
As the tool movement distance is added to #8554 at the time of starting
the cutting block, the distance of block movement is added even when
cutting stops during a block due to resetting, etc.
90
Page 99
B–61803E–1/07
PROGRAMMING
6. FUNCTIONS OF THE MACRO
EXECUTOR
6.9
READING AND
PRESETTING
RELATIVE
COORDINATES BY
CONVERSATIONAL
MACRO
6.9.1
Reading Relative
Coordinates
Relative coordinates can be read and preset with the conversational
macro.
Reading of relative coordinates can be informed by the window function.
Set ID No.110-115 to #8993, and relative coordinates can be read by
If the relative coordinates value of the 1st axis is
#8998=110; ((Include the contents of ID No.110)
#500=#8999;
Contents of #500 is -123456.
Relative coordinate values can be freely preset by G310AaQq.
Set the ID No. shown above to address A.
A110 - 115
Set the coordinates values to be preset to address Q.
–99999999 to 99999999
Q
Relative coordinate values can be preset freely by execution of this
control.
(Example)
To preset the relative coordinates value of 1st axis to -123.45;
G310 A110 Q-123450
Be sure that this function does not change the increment system.
–123.456
91
Page 100
6. FUNCTIONS OF THE MACRO
EXECUTOR
6.10
KEY–INPUT AND
DATA–INPUT
CONTROL
PROGRAMMING
B–61803E–1/07
(1) Key-input control variable #8501
You can read out the key input with #8501. The following is the
correspondence of the key input and #8501.
Display unit with seven soft keys
Key inputValueKey inputValue
PAGE.DOWN1SOFT FUNCTION KEY LEFT11
PAGE UP2SOFT FUNCTION KEY 112
CURSOR DOWN3SOFT FUNCTION KEY 213
CURSOR UP4SOFT FUNCTION KEY 314
ALTER5SOFT FUNCTION KEY 415
INSERT6SOFT FUNCTION KEY 516
DELETE7SOFT FUNCTION KEY RIGHT17
INPUT8
RESET10
CURSOR RIGHT18
CURSOR LEFT19
Display unit with twelve soft keys
The soft function keys follows:
The other keys are the same as seven softy keys.
Key inputValueKey inputValue
SOFT FUNCTION KEY LEFT20SOFT FUNCTION KEY 121
SOFT FUNCTION KEY 222SOFT FUNCTION KEY 323
SOFT FUNCTION KEY 424SOFT FUNCTION KEY 525
SOFT FUNCTION KEY 626SOFT FUNCTION KEY 727
SOFT FUNCTION KEY 828SOFT FUNCTION KEY 929
SOFT FUNCTION KEY 1030SOFT FUNCTION KEY RIGHT31
When there is no key input, the #8501 value is 0.
Once there is a key input, #8501 holds its value till it is input with the
macro statement, and the following key inputs will be ignored. When
#8501 is input, the status gets ready to accept the key input and #8501
will be 0.
It is impossible to write a value into #8501.
(2) Data input control variable #8502, numerical data variable #8503,
address data variable #8504
Control the input of numeric data and address data by setting the
following values to #8502.
#8502 = 0 ...No data input
= 1 ... Input of numeric data
= 2 ...Input of address data and numeric data
= 3... Expanded data input control
When #8502 is 0, nothing will be displayed on the data input line and
it will be impossible to input data, either.
When #8502 is 1, NUM will be displayed on the data input line and
input of numeric data will be possible. When #8502 is 2, ADRS will
be displayed on the data input line. After address data is input, NUM
is displayed and it is possible to input the numeric data. #8502 value
is 0 at switching on the power.
92
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.