Index Manuals FANUC Robotics SYSTEM R-30iA and R-30iB Controller. KAREL Reference Manual (MARRC75KR07091E Rev D)
|
|
B. KAREL EXAMPLE PROGRAMS
MARRC75KR07091E Rev D
-----------------------------------------------------------------------------
WRITE (CHR(cc_home) + CHR(cc_clear_win))-- Clear TP USER menu
SET_CURSOR(TPDISPLAY, 12, 1, status)
-- reposition cursor
comment = ’ ’
-- Initialize the comment
WRITE (’comment: ’)
-- Display message
DISCTRL_ALPH(’t_fu’, 12, 10, comment, ’COMM’, 0, term_char, status)
IF status <> 0 THEN
-- Verify DISCTRL_ALPH was successful
POST_ERR(status, ’’, 0, cc_warn)
-- Post the status as a warning
ENDIF
IF term_char = ky_enter THEN
WRITE (CR, ’comment was changed:’, comment, CR) -- Display new comment
ELSE
WRITE (CR, ’comment was not changed’, CR)
ENDIF
WRITE (CR, ’Press enter to continue’)
READ (CR)
Using the DISCTRL_ALPHA Built-in - Enter Data from CRT/KB
-----------------------------------------------------------------------------
---- Section 4-C: This section will perform program name entry from the
----
CRT/KB. The dictionary name and element values are
----
explicitly stated here, instead of using the available
----
default values.
-----------------------------------------------------------------------------
-- Set the dictionary language to English
-- This is useful if you want to use this same code for multiple
-- languages. Then any time you load in a dictionary you check
-- to see what the current language, $language, is and load the
-- correct dictionary.
-- For instance you could have a DCALPHJP.TX file which
-- would be the Japanese dictionary. If the current language, $language,
-- was set to Japanese you would load this dictionary.
SET_LANG ( dp_english, status)
IF (status <> 0) THEN
POST_ERR (status, ’’, 0,cc_warn)
-- Post the status as a warning
ENDIF
-- Load the dcalpheg.tx file, using ALPH as the dictionary name,
-- to the English language, using DRAM as the memory storage device.
ADD_DICT (’DCALPHEG’, ’ALPH’, dp_english, dp_dram, status)
IF (status <> 0 ) THEN
POST_ERR (status, ’’, 0, cc_pause)
-- Post the status and pause the
-- program, since the dictionary
ENDIF
-- must be loaded to continue.
device_stat = crt_panel
-- Give control to the CRT/KB
WRITE OUTPUT (CHR(cc_home) + CHR(cc_clear_win))--Clear CRT/KB USER menu
B-84
MARRC75KR07091E Rev D
B. KAREL EXAMPLE PROGRAMS
FORCE_SPMENU (device_stat, SPI_TPUSER, 1) -- Force the CRT/KB USER menu
-- to be visible
SET_CURSOR(OUTPUT, 12, 1, status)
-- Reposition the cursor
WRITE OUTPUT (’prog_name: ’)
prog_name = ’ ’
-- Initialize program name
DISCTRL_ALPH(’c_fu’,12,12,prog_name,’ALPH’,alph_prog,term_char,status)
--DISCTRL_ALPHA uses the ALPH dictionary and ALPH_PROG dictionary element
IF status <> 0 THEN
-- Verify DISCTRL_ALPH was
-- successful.
POST_ERR(status, ’’, 0, cc_warn)
-- Post returned status to the
ENDIF
-- error (’err’) window.
IF term_char = ky_enter THEN
WRITE (CR, ’prog_name was changed:’, prog_name, CR)
ELSE
WRITE (CR, ’prog_name was NOT changed.’, CR)
ENDIF
device_stat = tp_panel
-- Make sure to reset
END DCALP_EX
B.13.1
Dictionary Files
This ASCII dictionary file is used to write text to the specified screen. DCALPH_EG.UTX is also
used with DCAL_EX.KL. For more information on DCAL_EX.KL, refer to Section B.13 .
DCALPHEG.UTX Dictionary File
.KL DCALPH
$, alpha_prog
" PRG
MAIN
SUB
TEST
>"&new_line
" PROC
JOB
MACRO
>"&new_line
" TEST1
TEST2
TEST3
TEST4
>"
Note The greater than symbol (>) in DCALPHEG.UTX Dictionary File is a reminder to use the
NEXT key to scroll through the multiple lines. Also notice that the &new_line appears only on the
first two lines. This ensures that the lines will scroll correctly.
B.14
APPLYING OFFSETS TO A COPIED TEACH PENDANT
PROGRAM
This program copies a teach pendant program and then applies an offset to the positions within the
newly created program. This is useful when you create the teach pendant program offline and then
B-85
B. KAREL EXAMPLE PROGRAMS
MARRC75KR07091E Rev D
realized that all the teach pendant positions are off by some determined amount. However, you should
be aware that the utility PROGRAM ADJUST is far more adequate for this job.
Applying Offsets to Copied Teach Pendant Program - Overview
------------------------------------------------------------------------------
----
CPY_TP.KL
------------------------------------------------------------------------------
----
Elements of KAREL Language Covered:
In Section:
----
Actions:
----
----
Clauses:
----
FROM
Sec 3-F
----
----
Conditions:
----
----
Data Types:
----
ARRAY OF REAL
Sec 2
----
ARRAY OF STRING
Sec 2
----
BOOLEAN
Sec 2
----
INTEGER
Sec 2; 3-B,C,D,E
----
JOINTPOS
Sec 2
----
REAL
Sec 2
----
STRING
Sec 2
----
XYZWPR
Sec 2
----
Directives:
----
ENVIRONMENT
Sec 1
----
Built-in Functions &
Procedures:
----
AVL_POS_NUM
Sec 3-E
----
CHR
Sec 3-B, 4
----
CLOSE_TPE
Sec 3-E
----
CNV_REL_JPOS
Sec 3-E
----
CNV_JPOS_REL
Sec 3-E
----
COPY_TPE
Sec 3-E
----
GET_JPOS_TPE
Sec 3-E
----
GET_POS_TYP
Sec 3-E
----
GET_POS_TPE
Sec 3-E
----
OPEN_TPE
Sec 3-E
----
PROG_LIST
Sec 3-B
----
SELECT_TPE
Sec 3-E
----
SET_JPOS_TPE
Sec 3-E
----
SET_POS_TPE
Sec 3-E
Applying Offsets to Copied Teach Pendant Program - Overview Continued
----
Statements:
B-86
MARRC75KR07091E Rev D
B. KAREL EXAMPLE PROGRAMS
----
FOR...ENDFOR
Sec 3-B,D,E
----
IF ...THEN...ELSE...ENDIF
Sec 3-A,B,C,E
----
READ
Sec 3-B,C,D
----
REPEAT...UNTIL
Sec 3-B,C,D
----
RETURN
Sec 3-E
----
ROUTINE
Sec 3-A,B,C,D,E,F
----
SELECT...ENDSELECT
Sec 3-E
----
WRITE
Sec 3-B,C,D,E,4
----
----
Reserve Words:
----
BEGIN
Sec 3-A,B,C,D,E;
4
----
CONST
Sec 2
----
CR
Sec 3-B,C,D,E
----
END
Sec 3-A,B,C,D,E;
4
----
PROGRAM
Sec 1
----
VAR
Sec 2
Applying Offsets to Copied Teach Pendant Program - Declaration Section
------------------------------------------------------------------------------
----
Section 1: Program and Environment Declaration
------------------------------------------------------------------------------
PROGRAM CPY_TP
%ENVIRONMENT TPE
-- necessary for all xxx_TPE built-ins
%ENVIRONMENT BYNAM
-- necessary for PROG_LIST built-in
------------------------------------------------------------------------------
----
Section 2: Constant and Variable Declaration
------------------------------------------------------------------------------
CONST
ER_WARN = 0
-- warning constant for use in POST_ERR
SUCCESS = 0
-- success constant
JNT_POS = 9
-- constant for GET_POS_TYP
XYZ_POS = 2
-- constant for GET_POS_TYP
MAX_AXS = 9
-- Maximum number of axes JOINTPOS has
VAR
from_prog: STRING[13]
-- TP program name to be copied FROM
to_prog
: STRING[13]
-- TP program name to be copied TO
over_sw
: BOOLEAN
-- Decides whether to overwrite an existing
-- program when performing COPY_TPE
status
: INTEGER
-- Holds error status from the builtin calls
off_xyz
: XYZWPR
-- Offset amount for the XYZWPR positions
jp_off
: ARRAY [9] of REAL
-- Offset amount for the JOINT positions
new_xyz
: XYZWPR
-- XYZWPR which has offset applied
org_xyz
: XYZWPR
-- Original XYZWPR from to_prog
B-87
B. KAREL EXAMPLE PROGRAMS
MARRC75KR07091E Rev D
new_jpos : JOINTPOS
-- JOINTPOS which as the offset applied
org_jpos : JOINTPOS
-- Original JOINTPOS from to_prog
open_id
: INTEGER
-- Identifier for the opened to_prog
jp_org
: ARRAY [9] of REAL
-- REAL representation of org_jpos
jp_new
: ARRAY [9] of REAL
-- REAL representation of jp_new
Applying Offsets to Copied Teach Pendant Program - Declare Routines
------------------------------------------------------------------------------
----
Section 3: Routine Declaration
------------------------------------------------------------------------------
------------------------------------------------------------------------------
----
Section 3-A: CHK_STAT Declaration
----
Tests whether the status was successful or not.
----
If the status was not successful the status is posted
------------------------------------------------------------------------------
ROUTINE chk_stat (rec_stat: integer)
begin
IF (rec_stat <> SUCCESS) THEN
-- if rec_stat is not SUCCESS
-- then post the error
POST_ERR (rec_stat, ’’, 0, ER_WARN)
-- Post the error to the system.
ENDIF
END chk_stat
------------------------------------------------------------------------------
----
Section 3-B: GetFromPrg Declaration
----
Generate a list of loaded TPE programs.
----
Lets the user select one of these programs
----
to be the program to be copied, ie FROM_prog
------------------------------------------------------------------------------
ROUTINE GetFromPrg
VAR
tp_type
: INTEGER
-- Types of program to list
n_skip
: INTEGER
-- Index into the list of programs
format
: INTEGER
-- What type of format to store programs in
n_progs
: INTEGER
-- Number of programs returned in prg_name
prg_name
: ARRAY [8] of STRING[20] --Program names returned from PROG_LIST
status
: INTEGER
-- Status of PROG_LIST call
f_index
: INTEGER
-- Fast index for generating the program listing.
arr_size
: INTEGER
-- Array size of prg_name
prg_select: INTEGER
-- Users selection for which program to copy
indx
: INTEGER
-- FOR loop counter which displays prg_name
Applying Offsets to Copied Teach Pendant Program - Generate Program List for User
BEGIN
B-88
MARRC75KR07091E Rev D
B. KAREL EXAMPLE PROGRAMS
f_index = 0
-- Initialize the f_index
n_skip
= 0
-- Initialize the n_skip
tp_type = 2
-- find any TPE program
format
= 1
-- return just the program name in prg_name
n_progs = 0
-- Initialize the n_progs
arr_size = 8
-- Set equal to the declared array size of prg_name
prg_select = 0 -- Initialize the program selector
REPEAT
WRITE (chr(128),chr(137))
-- Clear the TP USER screen
-- Get a listing of all TP program which begin with "TEST"
PROG_LIST(’TEST*’,tp_type,n_skip,format,prg_name,n_progs,status,f_index)
chk_stat (status)
--Check status from PROG_LIST
FOR indx = 1 to n_progs DO
WRITE (indx,’:’,prg_name[indx], CR) -- Write the list of programs out
ENDFOR
IF (n_skip > 0) OR ( n_prog >0) THEN
WRITE (’select program to be copied:’,CR)
WRITE (’PRESS -1 to get next page of programs:’)
REPEAT
READ (prg_select)
-- get program selection
UNTIL ((prg_select >= -1) AND (prg_select <= n_progs)
AND (prg_select <> 0))
ELSE
WRITE (’no TP programs to COPY’, CR)
WRITE (’Aborting program, since need’,CR)
WRITE (’at least one TP program to copy.’,CR)
ABORT
ENDIF
-- Check if listing is complete and user has not made a selection.
IF ((prg_select = -1) AND (n_progs < arr_size)) THEN
f_index = 0
--reset f_index to re-generate list.
n_progs = arr_size
--set so the REPEAT/UNTIL will continue
ENDIF
-- Check if user user has made a selection
IF (prg_select <> -1) then
from_prog = prg_name[prg_select]-- Set from_prog to name selected
n_progs = 0
-- Set n_prog to stop looping.
ENDIF
UNTIL (n_progs < arr_size)
END GetFromPrg
Applying Offsets to Copied Teach Pendant Program - Overwrite or Delete Program
------------------------------------------------------------------------------
----
Section 3-C: GetOvrSw Declaration
----
Ask user whether to overwrite the copied
B-89
B. KAREL EXAMPLE PROGRAMS
MARRC75KR07091E Rev D
----
program, TO_prog, if it exists.
------------------------------------------------------------------------------
ROUTINE GetOvrSw
VAR
yesno
: INTEGER
BEGIN
WRITE (CR, ’If Program already exists do you want’,CR)
WRITE (’to overwrite the file Yes:1, No:0 ? ’)
REPEAT
READ (yesno)
UNTIL ((yesno = 0) OR( yesno = 1))
IF yesno = 1 then
--Set over_sw so program is overwriten if it exists
over_sw = TRUE
ELSE
--Set over_sw so program is NOT overwriten if it exists
over_sw = FALSE
ENDIF
END GetOvrSw
Applying Offsets to Copied Teach Pendant Program - Input Offset Positions
------------------------------------------------------------------------------
----
Section 3-D: GetOffset Declaration
----
Have the user input the offset for both
----
XYZWPR and JOINTPOS positions.
------------------------------------------------------------------------------
ROUTINE GetOffset
VAR
yesno
: INTEGER
index
: INTEGER
BEGIN
--Get the XYZWPR offset, off_xyz
REPEAT
WRITE ( ’Enter offset for XYZWPR positions’,CR)
WRITE (’ X = ’)
READ
(off_xyz.x)
WRITE (’ Y = ’)
READ
(off_xyz.y)
WRITE (’ Z = ’)
READ
(off_xyz.z)
WRITE (’ W = ’)
READ
(off_xyz.w)
WRITE (’ P = ’)
READ
(off_xyz.p)
WRITE (’ R = ’)
READ
(off_xyz.r)
--Display the offset values the user input
B-90
MARRC75KR07091E Rev D
B. KAREL EXAMPLE PROGRAMS
WRITE (’ Offset XYZWPR position is’,CR, off_xyz,CR)
WRITE (’Is this offset correct? Yes:1, No:0 ? ’)
READ
(yesno)
UNTIL (yesno = 1)
-- enter offset amounts until the user
-- is satisfied.
--Get the JOINTPOS offset, jp_off
REPEAT
WRITE ( ’Enter offset for JOINT positions’,CR)
FOR indx = 1 TO 6 DO
-- loop for number of robot axes
WRITE (’ J’,indx,’ = ’)
READ
(jp_off[indx])
ENDFOR
WRITE (’JOINT position offset is’, CR)
FOR indx = 1 TO 6 DO
write ( jp_off[indx],CR)
-- Display the values the user input
ENDFOR
WRITE (’Is this offset correct? Yes:1, No:0 ? ’)
READ
(yesno)
UNTIL (yesno = 1)
-- Enter offset amounts until the user
END GetOffset
-- is satisfied
Applying Offsets to Copied Teach Pendant Program - Apply Offsets to Positions
------------------------------------------------------------------------------
----
Section 3-E: ModifyPrg Declaration
----
Apply the offsets to each position within the TP program
------------------------------------------------------------------------------
ROUTINE ModifyPrg
VAR
pos_typ : INTEGER
--The type of position returned from GET_POS_TYP
num_axs : INTEGER
-- The number of axes if position is a JOINTPOS type
indx_pos: INTEGER
-- FOR loop counter, that increments through TP position
group_no: INTEGER
-- The group number of the current position setting.
num_pos : INTEGER
-- The next available position number within TP program
indx_axs: INTEGER
-- FOR loop counter, increments through REAL array
BEGIN
SELECT_TPE (’’, status)
-- Make sure the to_prog is currently not selected
to_prog = ’MDFY_TP’
-- Set the to_prog to desired name.
------ Copy the from_prog to to_prog -----
COPY_TPE (from_prog, to_prog, over_sw, status)
chk_stat(status)
-- check status of COPY_TPE
--- If the user specified not to overwrite the TPE program and
--- the status returned is 7015, "program already exist",
--- then quit the program. This will mean not altering the already
--- existing to_prog.
IF ((over_sw = FALSE) AND (status = 7015)) THEN
WRITE (’ABORTING:: PROGAM ALREADY EXISTS!’,CR)
B-91
B. KAREL EXAMPLE PROGRAMS
MARRC75KR07091E Rev D
RETURN
ENDIF
--- Open the to_prog with the Read/Write access
OPEN_TPE (to_prog, TPE_RWACC, TPE_RDREJ, open_id, status)
chk_stat(status)
-- check status of OPEN_TPE
group_no = 1
--- apply offset to each position within to_prog
--- The current number of position that the TPE program has is num_pos -1
FOR indx_pos = 1 to num_pos-1 DO
--Get the DATA TYPE of each position within the to_prog
--If it is a JOINTPOS also get the number of axes.
GET_POS_TYP (open_id, indx_pos, group_no, pos_typ, num_axs, status)
chk_stat (status)
WRITE(’get_pos_typ status’, status,cr)
Applying Offsets to Copied Teach Pendant Program - Apply Offsets to Positions Cont.
--Decide if the position, indx_pos, is a JOINTPOS or a XYZWPR
SELECT pos_typ OF
CASE (JNT_POS):
-- The position is a JOINTPOS
FOR indx_axs = 1 TO MAX_AXS DO
-- initialize with default values
jp_org[indx_axs] = 0.0
-- This avoids problems with the
jp_new[indx_axs] = 0.0
-- CNV_REL_JPOS
ENDFOR
-- get the JOINTPOS P[indx_pos] from to_prog
-----
org_jpos = GET_JPOS_TPE (open_id, indx_pos, status)
chk_stat( status)
-- Convert the JOINTPOS to a REAL array, in order to perform offset
CNV_JPOS_REL (org_jpos, jp_org, status)
chk_stat (status)
-- Apply the offset to the REAL array
FOR indx_axs = 1 to num_axs DO
jp_new[indx_axs] = jp_org[indx_axs] + jp_off[indx_axs]
ENDFOR
-- Converted back to a JOINTPOS.
-- The input array, jp_new, must not have any uninitialized values
-- or the error 12311 - "Data uninitialized" will be posted.
-- This is why we previously set all the values to zero.
CNV_REL_JPOS (jp_new, new_jpos, status)
chk_stat(status)
-- Set the new offset position, new_jpos, into the indx_pos
SET_JPOS_TPE (open_id, indx_pos, new_jpos, status)
chk_stat(status)
write (’indx_pos’, indx_pos, ’new_jpos’,cr, new_jpos,cr)
CASE (XYZ_POS): -- The position is a XYZWPR
-- Get the XYZWPR position P[indx_pos] from to_prog
B-92
MARRC75KR07091E Rev D
B. KAREL EXAMPLE PROGRAMS
org_xyz = GET_POS_TPE (open_id , indx_pos, status)
chk_stat( status)
-- Check status from GET_POS_TPE
Applying Offsets to Copied Teach Pendant Program - Clears TP User Menu
-- Apply offset to the XYZWPR
new_xyz.x = org_xyz.x + off_xyz.x
new_xyz.y = org_xyz.y + off_xyz.y
new_xyz.z = org_xyz.z + off_xyz.z
new_xyz.w = org_xyz.w + off_xyz.w
new_xyz.p = org_xyz.p + off_xyz.p
new_xyz.r = org_xyz.r + off_xyz.r
--Set the new offset position, new_xyz, into the indx_pos
SET_POS_TPE (open_id, indx_pos, new_xyz, status)
chk_stat (status)
-- Check status from SET_POS_TPE
ENDSELECT
ENDFOR
---Close TP program before quitting program
CLOSE_TPE (open_id, status)
chk_stat (status)
--Check status from CLOSE_TPE
END ModifyPrg
-----------------------------------------------------------------------------
----
Section 3-F: TP_CLS Declaration
----
Clears the TP USER Menu screen and forces it to
----
become visible. The actual code resides in
ROUT_EX.KL
-----------------------------------------------------------------------------
ROUTINE TP_CLS FROM rout_ex
-----------------------------------------------------------------------------
----
Section 4: Main Program
-----------------------------------------------------------------------------
BEGIN
-- CPY_TP
tp_cls
-- Clear the TP USER Menu screen
GetFromPrg
-- Get the TPE program to copy FROM
GetOvrSw
-- Get the TPE program name to copy TO
GetOffset
-- Get the offset for modifying
-- the teach pendant program
ModifyPrg
-- Modify the copied program by the offset
END CPY_TP
B-93
Appendix C
KCL COMMAND ALPHABETICAL
DESCRIPTION
Contents
Appendix C
KCL COMMAND ALPHABETICAL DESCRIPTION
C-1
C.1
ABORT command
C-6
C.2
APPEND FILE command
C-6
C.3
APPEND NODE command
C-6
C.4
CHDIR command
C-7
C.5
CLEAR ALL command
C-7
C.6
CLEAR BREAK CONDITION command
C-8
C.7
CLEAR BREAK PROGRAM command
C-8
C.8
CLEAR DICT command
C-9
C.9
CLEAR PROGRAM command
C-9
C.10
CLEAR VARS command
C-9
C.11
COMPRESS DICT command
C-10
C.12
COMPRESS FORM command
C-10
C.13
CONTINUE command
C-11
C.14
COPY FILE command
C-11
C.15
CREATE VARIABLE command
C-12
C.16
DELETE FILE command
C-13
C.17
DELETE NODE command
C-13
C.18
DELETE VARIABLE command
C-14
C.19
DIRECTORY command
C-14
C.20
DISABLE BREAK PROGRAM command
C-15
C-1
C. KCL COMMAND ALPHABETICAL DESCRIPTION
MARRC75KR07091E Rev D
C.21
DISABLE CONDITION command
C-15
C.22
DISMOUNT command
C-15
C.23
EDIT command
C-16
C.24
ENABLE BREAK PROGRAM
C-16
C.25
ENABLE CONDITION command
C-16
C.26
FORMAT command
C-17
C.27
HELP command
C-17
C.28
HOLD command
C-18
C.29
INSERT NODE command
C-18
C.30
LOAD ALL command
C-18
C.31
LOAD DICT command
C-19
C.32
LOAD FORM command
C-19
C.33
LOAD MASTER command
C-20
C.34
LOAD PROGRAM command
C-20
C.35
LOAD SERVO command
C-21
C.36
LOAD SYSTEM command
C-21
C.37
LOAD TP command
C-22
C.38
LOAD VARS command
C-23
C.39
LOGOUT command
C-24
C.40
MKDIR command
C-24
C.41
MOUNT command
C-24
C.42
MOVE FILE command
C-25
C.43
PAUSE command
C-25
C.44
PURGE command
C-26
C.45
PRINT command
C-26
C.46
RECORD command
C-27
C.47
RENAME FILE command
C-27
C.48
RENAME VARIABLE command
C-28
C.49
RENAME VARS command
C-28
C.50
RESET command
C-29
C.51
RMDIR command
C-29
C.52
RUN command
C-30
C.53
RUNCF command
C-30
C.54
SAVE MASTER command
C-31
C.55
SAVE SERVO command
C-31
C.56
SAVE SYSTEM command
C-31
C.57
SAVE TP command
C-32
C.58
SAVE VARS command
C-33
C.59
SET BREAK CONDITION command
C-33
C.60
SET BREAK PROGRAM command
C-34
C.61
SET CLOCK command
C-35
C-2
MARRC75KR07091E Rev D
C. KCL COMMAND ALPHABETICAL DESCRIPTION
C.62
SET DEFAULT command
C-35
C.63
SET GROUP command
C-35
C.64
SET LANGUAGE command
C-36
C.65
SET LOCAL VARIABLE command
C-36
C.66
SET PORT command
C-37
C.67
SET TASK command
C-37
C.68
SET TRACE command
C-38
C.69
SET VARIABLE command
C-38
C.70
SET VERIFY command
C-39
C.71
SHOW BREAK command
C-39
C.72
SHOW BUILTINS command
C-40
C.73
SHOW CONDITION command
C-40
C.74
SHOW CLOCK command
C-40
C.75
SHOW CURPOS command
C-41
C.76
SHOW DEFAULT command
C-41
C.77
SHOW DEVICE command
C-41
C.78
SHOW DICTS command
C-41
C.79
SHOW GROUP command
C-41
C.80
SHOW HISTORY command
C-42
C.81
SHOW LANG command
C-42
C.82
SHOW LANGS command
C-42
C.83
SHOW LOCAL VARIABLE command
C-42
C.84
SHOW LOCAL VARS command
C-44
C.85
SHOW MEMORY command
C-44
C.86
SHOW PROGRAM command
C-44
C.87
SHOW PROGRAMS command
C-45
C.88
SHOW SYSTEM command
C-45
C.89
SHOW TASK command
C-45
C.90
SHOW TASKS command
C-46
C.91
SHOW TRACE command
C-46
C.92
SHOW TYPES command
C-46
C.93
SHOW VARIABLE command
C-47
C.94
SHOW VARS command
C-47
C.95
SHOW data_type command
C-48
C.96
SIMULATE command
C-48
C.97
SKIP command
C-49
C.98
STEP OFF command
C-50
C.99
STEP ON command
C-50
C.100
TRANSLATE command
C-50
C.101
TYPE command
C-51
C.102
UNSIMULATE command
C-51
C-3
C. KCL COMMAND ALPHABETICAL DESCRIPTION
MARRC75KR07091E Rev D
C.103
WAIT command
C-52
C-4
MARRC75KR07091E Rev D
C. KCL COMMAND ALPHABETICAL DESCRIPTION
This section describes each KCL command in alphabetical order. Each description includes the
purpose of the command, its syntax, and details of how to use it. Examples of each command are also
provided.
The following notation is used to describe KCL command syntax:
•
< > indicates optional arguments to a command
•
| indicates a choice which must be made
•
{ } indicates an item can be repeated
• file_spec: <device_name:><\\host_name\><path_name\>file_name.file_type |
<device_name:><\\host_name\>‘host_specific_name’
• path_name: <file_name\><dir\dir\. . .>
• file_name: maximum of 36 characters, no file type
device_name: is a two to five-character optional field, followed by a colon. The first character is a
letter, the remaining characters must be alphanumeric. If this field is left blank, the default device
from the system variable $DEVICE will be used.
host_name: is a one to eight character optional field. The host_name selects the network node that
receives this command. It must be preceded by two backslashes and separated from the remaining
fields by a backslash.
path_name : file_name\<path_name> - is a recursively defined optional field, each field consisting of
a maximum of 36 characters. It is used to select the file subdirectory. The root or source directory is
handled as a special case. It is designated by a file_name of zero length. For example, access to the
subdirectory SYS linked off of the root would have path name ‘\SYS’. A fully qualified file_spec
using this path_name would look like this, ‘C1:\HOST\SYS\FILE.KL’.
file_name: from one to 36 characters
file_type: from zero to three characters
KCL commands can be abbreviated allowing you to type in fewer letters as long as the abbreviated
version remains unique among all keywords. For example, ‘‘ABORT’’ can be ‘‘AB’’ but
‘‘CONTINUE’’ must be ‘‘CONT’’ to distinguish it from ‘‘CONDITION.’’
path_names, file_names, and file_types that contain special characters or begin with numbers can be
specified as a host_specific_name inside single quotes. FR:\’00\’ is valid, FR:\’00\test.kl’ is valid,
FR:\’00’\test.kl is invalid because the host_specific_name must be last.
KCL commands that have <prog_name> as part of the command syntax will use the default program
if none is specified. KCL commands that have <file_name> as part of the command syntax will use
the default program as the file name if none is specified.
C-5
C. KCL COMMAND ALPHABETICAL DESCRIPTION
MARRC75KR07091E Rev D
C.1
ABORT command
Syntax: ABORT < ( prog_name ) | ALL) > <FORCE>
where:
prog_name : the name of any KAREL or TP program which is a task
ALL : aborts all running or paused tasks
FORCE : aborts the task even if the NOABORT attribute is set. FORCE only works with ABORT
prog_name; FORCE does not work with ABORT ALL
Purpose: Aborts the specified running or paused task. If prog_ name is not specified, the default
program is used.
Execution of the current program statement is completed before the task aborts except for the current
motion, DELAY, WAIT, or READ statements, which are canceled.
Examples: KCL> ABORT test_prog FORCE
KCL> ABORT ALL
C.2
APPEND FILE command
Syntax: APPEND FILE input_file_spec TO output_ file_spec
where:
input_file_spec : a valid file specification
output_file_spec : a valid file specification
Purpose: Appends the contents of the specified input file to the end of the specified output file. The
input_file_spec and the output_file_spec must include both the file name and the file type.
Examples: KCL> APPEND FILE flpy:test.kl TO productn.kl
KCL> APPEND FILE test.kl TO productn.kl
C.3
APPEND NODE command
Syntax: APPEND NODE <[ prog_name ]> var_name
where:
C-6
MARRC75KR07091E Rev D
C. KCL COMMAND ALPHABETICAL DESCRIPTION
prog_name : the name of any KAREL or TP program
var_name : the name of any variable of type PATH
Purpose: Appends one node to the end of the specified PATH variable previously loaded in RAM.
The appended node value is uninitialized and the index number is one more than the last node index.
Execute the KCL> SAVE VARS command to make the change permanent.
Examples: KCL> APPEND NODE [test_prog]weld_pth
KCL> APPEND NODE weld_pth
C.4
CHDIR command
Syntax: CHDIR < device_name >\< path_name >\ or CD < device_name >\< path_nam e >
where:
device_name : a specified device
path_name : a subdirectory previously created on the memory card device using the mkdir command.
When the chdir command is used to change to a subdirectory, the entire path will be displayed on the
teach pendant screen as mc:\new_dir\new_file.
The double dot (..) can be used to represent the directory one level above the current directory.
Purpose: Changes the default device. If a device_name is not specified, displays the default device.
Examples: KCL> CHDIR rd:\
KCL> CD
KCL> CD mc:\a
KCL> CD ..
C.5
CLEAR ALL command
Syntax: CLEAR ALL <YES>
where:
YES : confirmation is not prompted
Purpose: Clears all KAREL and teach pendant programs and variable data from memory. All cleared
programs and variables (if they were saved with the KCL> SAVE VARS command) can be reloaded
into memory using the KCL> LOAD command.
C-7
C. KCL COMMAND ALPHABETICAL DESCRIPTION
MARRC75KR07091E Rev D
Examples: KCL> CLEAR ALL
Are you sure? YES
KCL> CLEAR ALL Y
C.6
CLEAR BREAK CONDITION command
Syntax: CLEAR BREAK CONDITION < prog_name > ( brk_pnt_no | ALL)
where:
prog_name : the name of any KAREL program in memory
brk_pnt_no : a particular condition break point
ALL : clears all condition break points
Purpose: Clears specified condition break point(s) from the specified or default program.
A condition break point only affects the program in which it is set.
Examples: KCL> CLEAR BREAK CONDITION test_prog 3
KCL> CLEAR BREAK COND ALL
C.7
CLEAR BREAK PROGRAM command
Syntax: CLEAR BREAK PROGRAM < prog_name > ( brk_pnt_no | ALL)
where:
prog_name : the name of any KAREL program in memory
brk_pnt_no : a particular program break point
ALL : clears all break points
Purpose: Clears specified break point(s) from the specified or default program.
A break point only affects the program in which it is set.
Examples: KCL> CLEAR BREAK PROGRAM test_prog 3
KCL> CLEAR BREAK PROG ALL
C-8
MARRC75KR07091E Rev D
C. KCL COMMAND ALPHABETICAL DESCRIPTION
C.8
CLEAR DICT command
Syntax: CLEAR DICT dict_name <( lang_name | ALL)>
where:
dict_name : the name of any dictionary to be cleared
lang_name : the name of the language. The available choices are ENGLISH, JAPANESE, FRENCH,
GERMAN, SPANISH or DEFAULT.
ALL : clears the dictionary from all languages
Purpose: Clears a dictionary from the specified language or from all languages. If no language is
specified, it is cleared from the DEFAULT language only.
Examples: KCL> CLEAR DICT tpsy ENGLISH
KCL> CLEAR DICT tpsy
C.9
CLEAR PROGRAM command
Syntax: CLEAR PROGRAM < prog_name > <YES>
where:
prog_name : the name of any KAREL or teach pendant program in memory
YES : confirmation is not prompted
Purpose: Clears the program data from memory for the specified or default program.
Examples: KCL> CLEAR PROGRAM test_prog
Are you sure? YES
KCL> CLEAR PROG test_prog Y
C.10 CLEAR VARS command
Syntax: CLEAR VARS < prog_name > <YES>
where:
prog_name : the name of any KAREL or teach pendant program with variables
C-9
C. KCL COMMAND ALPHABETICAL DESCRIPTION
MARRC75KR07091E Rev D
YES : confirmation is not prompted
Purpose: Clears the variable and type data associated with the specified or default program from
memory.
Variables and types that are referenced by a loaded program are not cleared.
Examples: KCL> CLEAR VARS test_prog
Are you sure? YES
KCL> CLEAR VARS test_prog Y
C.11
COMPRESS DICT command
Syntax: COMPRESS DICT file_name
where:
file_name : the file name of the user dictionary you want to compress.
Purpose: Compresses a dictionary file from the default storage device, using the specified dictionary
name. The file type of the user dictionary must be ‘‘.UTX’’. The compressed dictionary file will have
the same file name as the user dictionary, and be of type ‘‘.TX’’.
See Also: Chapter 10 DICTIONARIES AND FORMS
Example: KCL> COMPRESS DICT tphcmneg
C.12
COMPRESS FORM command
Syntax: COMPRESS FORM < file_name >
where:
file_name : the file name of the form you want to compress.
Purpose: Compresses a form file from the default storage device using the specified form name. The
file type of the form must be ‘‘.FTX’’. A compressed dictionary file and variable file will be created.
The compressed dictionary file will have the same file name as the form file and be of type ".TX".
The variable file will have a four character file name, that is extracted from the form file name, and be
of type ‘‘.VR’’. If no form file name is specified, the name ‘‘FORM’’ is used.
See Also: Chapter 10 DICTIONARIES AND FORMS
Examples: KCL> COMPRESS FORM
C-10
MARRC75KR07091E Rev D
C. KCL COMMAND ALPHABETICAL DESCRIPTION
KCL> COMPRESS FORM mnpalteg
C.13
CONTINUE command
Syntax: CONTINUE <( prog_name ) | ALL)>
where:
prog_name : the name of any KAREL or teach pendant program which is a task
ALL : continues all paused tasks
Purpose: Continues program execution of the specified task that has been paused by a hold,
pause, or test run operation. If the program is aborted, the program execution is started at the first
executable line.
When a task is paused, the CYCLE START button on the operator panel has the same effect as
the KCL> CONTINUE command.
CONTINUE is a motion command; therefore, the device from which it is issued must have motion
control.
See Also: Refer to the $RMT_MASTER description in the FANUC Robotics Software Reference
Manual for more information about assigning motion control to a remote device.
Examples: KCL> CONTINUE test_prog
KCL> CONT ALL
C.14
COPY FILE command
Syntax: COPY <FILE> from_file_spec TO to_file_spec <OVERWRITE>
where:
from_file_spec : a valid file specification
to_file_spec : a valid file specification
OVERWRITE : specifies copy over (overwrite) an existing file
Purpose: Copies the contents of one file to another with overwrite option. Allows file transfers
between different devices and between the controller and a host system.
The wildcard character (*) can be used to replace from_file_spec ’s entire file name, the first part of
the file name, the last part of the file name, or both the first and last parts of the file name. The file
C-11
C. KCL COMMAND ALPHABETICAL DESCRIPTION
MARRC75KR07091E Rev D
type can also use the wildcard in the same manner. The wildcard character in the to_file_spec can
only replace the entire file name or the entire file type.
Examples: KCL> COPY flpy:\test.kl TO rdu:newtest.kl
KCL> COPY mc:\test_dir\test.kl TO mc:\test_dir\newtest.kl
KCL> COPY FILE flpy:\*.kl TO rd:*.kl
KCL> COPY *.* TO fr:
KCL> COPY FILE *.kl TO rd:\*.bak OVERWRITE
KCL> COPY FILE flpy:\*main*.kl TO rd:* OV
KCL> COPY mdb:*.tp TO mc:
C.15
CREATE VARIABLE command
Syntax: CREATE VARIABLE <[ prog_name ]> var_name <IN (CMOS | DRAM)> : data_type
where:
prog_name : the name of any KAREL or TP program
var_name:data_type : a valid variable name and data type
Purpose: Allows you to declare a variable that will be associated with the specified or default
program. You must specify a valid identifier for the var_name and a valid data_type .
Only one variable can be declared with the CREATE VAR command. You must enter the KCL>
SAVE VARS command to save the declared variable with the program variable data. Use the KCL>
SET VARIABLE command to assign a value to a variable.
The following data types are valid (user types are also supported): ARRAY OF BYTE, JOINTPOS,
ARRAY OF SHORT, JOINTPOS1 to JOINTPOS9, BOOLEAN, POSITION, REAL, CONFIG,
VECTOR, FILE, XYZWPR, XYZWPREXT, INTEGER
You can create multi-dimensional arrays of the above type. A maximum of 3 dimensions may be
specified. Paths may only be created from a user defined type.
By default, the variable will be created in temporary memory (in DRAM), and must be recreated
every power up. The value will always be reset to uninitialized.
If IN CMOS is specified the variable will be created in permanent memory. The variable’s value will
be recovered every time the controller is turned on.
See Also: SET VARIABLE command
C-12
MARRC75KR07091E Rev D
C. KCL COMMAND ALPHABETICAL DESCRIPTION
Examples: KCL> CREATE VAR [test_prog]count IN CMOS: INTEGER
KCL> CREATE VAR vec:ARRAY[3,2,4] OF VECTOR
C.16
DELETE FILE command
Syntax: DELETE FILE file_spec <YES>
where:
file_spec : a valid file specification
YES : confirmation is not prompted
Purpose: Deletes the specified file from the specified storage device. The wildcard character (*) can
be used to replace the entire file name, the first part of the file name, the last part of the file name, or
both the first and last parts of the file name. The file type can also use the wildcard in the same manner.
Examples: KCL> DELETE FILE testprog.pc
Are you sure? YES
KCL> DELETE FILE rd:\testprog.pc YES
KCL> DELETE FILE rd:\*.* Y
C.17
DELETE NODE command
Syntax: DELETE NODE <[ prog_name ]> var_name [node_index]
where:
prog_name : the name of any KAREL or TP program
var_name : the name of any variable of type PATH
[ node_index ] : a node in the path
Purpose: Deletes the specified node from the specified PATH variable. The PATH variable must be
loaded in memory. Enter the KCL> SAVE VARS command to make the change permanent.
Examples: KCL> DELETE NODE [test_prog]weld_pth[4]
KCL> DELETE NODE weld_pth[3]
C-13
C. KCL COMMAND ALPHABETICAL DESCRIPTION
MARRC75KR07091E Rev D
C.18
DELETE VARIABLE command
Syntax: DELETE VARIABLE <[ prog_name ]> var_name
where:
prog_name : the name of any KAREL or TP program with variables
var_name : the name of any program variable
Purpose: Deletes the specified variable from memory. A variable that is linked with loaded p-code
cannot be deleted. Enter the KCL> SAVE VARS command to make the change permanent.
Examples: KCL> DELETE VARIABLE [test_prog]weld_pth
KCL> DELETE VAR weld_pth
C.19
DIRECTORY command
Syntax: DIRECTORY < file_spec >
where:
file_spec : a valid file specification
Purpose: Displays a list of the files that are on a storage device. If file_spec is not specified,
directory information is displayed for all of the files stored on a specified device. The directory
information displayed includes the following:
The volume name of the device (if specified when the device was initialized)
The name of the subdirectory, if available
The names and types of files currently stored on the device and the sizes of the files in bytes
The number of files, the number of bytes left, and the number of bytes total, if available
The wildcard character (*) can be used to replace the entire file name, the first part of the file name,
the last part of the file name, or both the first and last parts of the file name. The file type can also
use the wildcard in the same manner.
Examples: KCL> DIRECTORY rd:
KCL> DIR *.kl
KCL> DIR *SPOT*.kl
C-14
MARRC75KR07091E Rev D
C. KCL COMMAND ALPHABETICAL DESCRIPTION
KCL> CD MC: \test_dir
Use the CD command to change to the KCL> DIR subdirectory before you use the DIR commandor
KCL> DIR \test_dir\*.* display the subdirectory contents without using the CD command.
C.20
DISABLE BREAK PROGRAM command
Syntax: DISABLE BREAK PROGRAM < prog_name > brk_pnt_no
where:
prog_name : the name of any KAREL or TP program in memory
brk_pnt_no : a particular program break point
Purpose: Disables the specified break point in the specified or default program.
Examples: KCL> DISABLE BREAK PROGRAM test_prog 3
KCL> DISABLE BREAK PROG 3
C.21
DISABLE CONDITION command
Syntax: DISABLE CONDITION < prog_name > condition_no
where:
prog_name : the name of any KAREL program in memory
condition_no : a particular condition
Purpose: Disables the specified condition in the specified or default program.
Examples: KCL> DISABLE CONDITION test_prog
KCL> DISABLE COND 3
C.22
DISMOUNT command
Syntax: DISMOUNT device_name:
where:
device_name : device to be dismounted
C-15
C. KCL COMMAND ALPHABETICAL DESCRIPTION
MARRC75KR07091E Rev D
Purpose: Dismounts a mounted storage device and indicates to the controller that a storage device is
no longer available for reading or writing data.
Example: KCL> DISMOUNT rd:
C.23
EDIT command
Syntax: EDIT < file_spec >
where:
file_spec : a valid file specification
Purpose: Provides an ASCII text editor which can be used for editing dictionary files, command
files and KAREL source files.
If file_spec is not specified, the default program name is used as the file name and the default file
type is .KL (KAREL source code).
If a previous editing session exists, then file_spec is ignored and the editing session is resumed.
Examples: KCL> EDIT startup.cf
KCL> ED
C.24
ENABLE BREAK PROGRAM
Syntax: ENABLE BREAK PROGRAM < prog_name > brk_pnt_no
where:
prog_name : the name of any KAREL or TP program in memory
brk_pnt_no : a particular program break point
Purpose: Enables the specified break point in the specified or default program.
Examples: KCL> ENABLE BREAK PROGRAM test_prog 3
KCL> ENABLE BREAK PROG 3
C.25
ENABLE CONDITION command
Syntax: ENABLE CONDITION < prog_name > condition_no
where:
C-16
MARRC75KR07091E Rev D
C. KCL COMMAND ALPHABETICAL DESCRIPTION
prog_name : the name of any KAREL program in memory
condition_no : a particular condition
Purpose: Enables the specified condition in the specified or default program.
Examples: KCL> ENABLE CONDITION test_prog
KCL> ENABLE COND 3
C.26
FORMAT command
Syntax: FORMAT device_name: < volume_name > <YES>
where:
device_name : the specified device to be initialized
volume_name : label for the device
YES : confirmation is not prompted
Purpose: Formats a specified device. A device must be formatted before storing files on it.
Examples: KCL> FORMAT rd:
Are you sure? YES
KCL> FORMAT rd: Y
C.27
HELP command
Syntax: HELP < command_name >
where:
command_name : a KCL command
Purpose: Displays on-line help for KCL commands. If you specify a command_name argument, the
required syntax and a brief description of the specified command is displayed.
Examples: KCL> HELP LOAD PROG
KCL> HELP
C-17
C. KCL COMMAND ALPHABETICAL DESCRIPTION
MARRC75KR07091E Rev D
C.28
HOLD command
Syntax: HOLD <( prog_name | ALL)>
where:
prog_name : the name of any KAREL or TP program
ALL : holds all executing programs
Purpose: Pauses the specified or default program that is being executed and holds motion at the
current position (after a normal deceleration).
Use the KCL> CONTINUE command or the CYCLE START button on the operator panel to resume
program execution.
Examples: KCL> HOLD test_prog
KCL> HO ALL
C.29
INSERT NODE command
Syntax: INSERT NODE <[ prog_name ]> var_name [node_index]
where:
prog_name : the name of any KAREL or TP program
var_name : the name of any variable of type PATH
[node_index] : a node in the path
Purpose: Inserts a node in front of the specified node in the PATH variable. The PATH variable
must be loaded in memory.
The inserted node index number is the node_index you specify and the inserted node value is
uninitialized. The index numbers for subsequent nodes are incremented by one. You must enter the
KCL> SAVE VARS command to make the change permanent.
Examples: KCL> INSERT NODE [test_prog]weld_pth[2]
KCL> INSERT NODE weld_pth[3]
C.30
LOAD ALL command
Syntax: LOAD ALL < file_name > <CONVERT>
C-18
MARRC75KR07091E Rev D
C. KCL COMMAND ALPHABETICAL DESCRIPTION
where:
file_name : a valid file name
CONVERT : converts variables to system definition
Purpose: Loads a p-code and variable file from the default storage device and default directory into
memory using the specified or default file name. The file types for the p-code and variable files are
assumed to be ‘‘.PC’’ and ‘‘.VR’’ respectively.
If file_name is not specified, the default program is used. If the default has not been set, then the
message, ‘‘Default program name not set,’’ will be displayed.
Examples: KCL> LOAD ALL test_prog
KCL> LOAD ALL
C.31
LOAD DICT command
Syntax: LOAD DICT file_name dict_name < lang_name >
where:
file_name : the name of the file to be loaded
dict_name : the name of any dictionary to be loaded. The name will be truncated to 4 characters.
lang_name : a particular language. The available choices are ENGLISH, JAPANESE, FRENCH,
GERMAN, SPANISH or DEFAULT.
Purpose: Loads a dictionary file from the default storage device and default directory into memory
using the specified file name. The file type is assumed to be ‘‘.TX.’’
See Also: Chapter 10 DICTIONARIES AND FORMS
Examples: KCL> LOAD DICT tpaleg tpal FRENCH
KCL> LOAD DICT tpaleg tpal
C.32
LOAD FORM command
Syntax: LOAD FORM < form_name >
where:
form_name : the name of the form to be loaded
C-19
C. KCL COMMAND ALPHABETICAL DESCRIPTION
MARRC75KR07091E Rev D
Purpose: Loads the specified form, from the default storage device, into memory. A form consists
of a compressed dictionary file and a variable file. If no name is specified, ’FORM.TX’ and
’FORM.VR’ are loaded.
If the specified form_name is greater than four characters, the first two characters are not used for
the dictionary name or the variable file name.
See Also: For more information on creating and using forms, refer to Chapter 10 DICTIONARIES
AND FORMS
Example: KCL> LOAD FORM
Loading FORM.TX with dictionary name FORM
Loading FORM.VR
KCL> LOAD FORM tpexameg
Loading TPEXAMEG.TX with dictionary name EXAM
Loading EXAM.VR
C.33
LOAD MASTER command
Syntax: LOAD MASTER < file_name > <CONVERT>
where:
file_name : a valid file name
CONVERT : converts variables to system definition
Purpose: Loads a mastering data file from the default storage device and default directory into
memory using the specified or default file name. The file type is assumed to be ‘‘.SV.’’
If file_name is not specified, the default file name, ‘‘SYSMAST.SV,’’ is used.
Example: KCL> LOAD MASTER
C.34
LOAD PROGRAM command
Syntax: LOAD PROGRAM < file_name >
where:
file_name : a valid file name
C-20
|
||
|
|
|