0% found this document useful (0 votes)
301 views

Fanuc Info

The document contains several sections about KAREL programming including: 1. Descriptions of common KAREL statements like SELECT, IF, FOR and their syntax. 2. Descriptions of built-in functions like SQRT, GET_TPE_PRM and procedures like SET_REAL_REG. 3. Descriptions of common system variables used for programming including $MNUFRAME, $MNUTOOLNUM and $MNUFRAMENUM.

Uploaded by

Yura Lomaka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
301 views

Fanuc Info

The document contains several sections about KAREL programming including: 1. Descriptions of common KAREL statements like SELECT, IF, FOR and their syntax. 2. Descriptions of built-in functions like SQRT, GET_TPE_PRM and procedures like SET_REAL_REG. 3. Descriptions of common system variables used for programming including $MNUFRAME, $MNUTOOLNUM and $MNUFRAMENUM.

Uploaded by

Yura Lomaka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 6

Вопросы:

1. Промоделировать WJNT и проверить в настройке конфиргурации системы как это


работает.

2. Разобраться с настройкой CSTPI - очередь программ и т.д.

CAD модель инструмента может быть импортирована в Roboguide только в формате


IGES.

Для управления скорости с PLC - настройка OVERRIDE SELECT SETUP

DIFFERENT

$MAXUALRMNUM
Minimum: Not available Maximum: Not available Default: Not available KCL/Data:
Not available Program: RW UIF: Not available CRTL: Not available Data Type:
INTEGER Memory: Not available
Name: Maximum Number of User-defined Alarm Messages that can be Defined
Description: Determines the size of the array $UALRM_MSG. Note that a controlled start is
required
to changed the size of the array. These messages are displayed by executing a UALM statement.
Power Up: Requires a controlled start to take effect.

Autobackup
$AUTOBACKUP.$DEVICE

While the robot is executing a program, it reads the lines ahead of the line currently being
executed (look-ahead execution).

$OVRD_RATE
Minimum: Not available Maximum: Not available Default: Not available KCL/Data:
Not available Program: RW UIF: Not available CRTL: Not available Data Type:
ULONG Memory: Not available
Name: Override change rate
Description: The value of $OVRD_RATE indicates the rate of changing override of 10%-100%.
For example, when $OVRD_RATE = 25, override is changed as follows. V.FINE - FINE - 1 - 2 -
3 - 4 - 5 - 10 - 25 - 50 - 75 - 100
Power Up: Changes to this variable take effect immediately.

FRAMES

$GROUP[1].$utool
Minimum: Not available Maximum: Not available Default: Not available KCL/Data:
Not available Program: RW UIF: Not available CRTL: Not available Data Type:
POSITION Memory: Not available
Name: Tool Coordinate System
Description: $utool is used by KAREL system only. For TPE user, the corresponding variable is
$MNUTOOL. $utool defines the location and orientation of the tool that is attached to the
faceplate.
The position in $utool is defined with respect to a fixed coordinate system on the robot faceplate
and is the origin of the TOOL FRAME. By default, the value of $utool is set to $NILP, which
means the position of the TCP is identical to the location and orientation of the faceplate
coordinate system. You must change the value of $utool to define the specific tool you are using.
Power Up: Effective with next motion

$GROUP[1].$uframe
Minimum: Not available Maximum: Not available Default: Not available KCL/Data:
Not available Program: RW UIF: Not available CRTL: Not available Data Type:
POSITION Memory: Not available
Name: User Coordinate Frame
Description: $uframe is used by KAREL system only. For the teach pendant programmer, the
corresponding variable is $MNUFRAME. $uframe is the position of a user frame of reference.
All programmed positions are defined with respect to $uframe. Any value you assign to $uframe
is defined with respect to the world coordinate system. By default, $uframe is identical to the
world coordinate system, meaning $uframe = $NILP.
Power Up: Effective with next motion

$MNUFRAME[1,6]
Minimum: NIL Maximum: NIL Default: NIL KCL/Data: RW Program: RW UIF:
Not available CRTL: Not available Data Type: POSITION Memory: Not available
Name: User Frame Array
Description: This system variables contains the positional value of the user frame used by the
teach pendant system. This is a two dimensional array. The inner dimension is the frame number
(1-6). The outer dimension is the group number (gnum). The frame number is
$MNUFRAMENUM[gnum].
When $MNUFRAMENUM[gnum] is between 1 and 6 the system uses the following userframe:
$MNUFRAME[gnum, $MNUFRAMENUM[gnum]] If $MNUFRAMENUM[gnum] is zero the
null frame is used. If $MNUFRAMENUM[gnum] is 14 $GROUP[gnum].$UFRAME is used.
Power Up: N/A
Screen: SETUP Frames

$MNUTOOLNUM[2]
Minimum: 0x0 Maximum: 0x15 Default: 0 KCL/Data: RW Program: RW UIF: Not
available CRTL: Not available Data Type: INTEGER Memory: Not available
Name: User Tool Frame Number
Description: Used as the index into $MNUTOOL.
Power Up: N/A
Screen: SETUP Frames, TOOL teach pendant instruction

$MNUFRAMENUM[2]
Minimum: 0x0 Maximum: 0x15 Default: 0 KCL/Data: RW Program: RW UIF: Not
available CRTL: Not available Data Type: INTEGER Memory: Not available
Name: User Frame Number
Description: Used as the index into $MNUFRAME.
Power Up: N/A
Screen: SETUP Frames, teach pendant position programming
2

KAREL

SELECT ... ENDSELECT Statement


Purpose: Permits execution of one out of a series of statement sequences, depending on the value
of an INTEGER expression.
Syntax: SELECT case_val OF
CASE(value{,value}):
{statement}
{ CASE(value{, value}):
{statement} }
<ELSE:
{ statement }>
ENDSELECT
where:
case_val : an INTEGER expression
value : an INTEGER constant or literal
statement : a valid KAREL executable statement

GET_TPE_PRM Built-in Procedure


Purpose: Gets the values of the parameters when parameters are passed in a TPE CALL or
MACRO instruction.
Syntax : GET_TPE_PRM(param_no, data_type, int_value, real_value, str_value, status)
Input/Output Parameters:
[in] param_no :INTEGER
[out] data_type :INTEGER
[out] int_value :INTEGER
[out] real_value :REAL
[out] str_value :STRING
[out] status :INTEGER
%ENVIRONMENT Group :PBCORE
Details:
• param_no indicates the number of the parameter. There can be at most ten parameters.
• data_type indicates the data type for the parameter, as follows:
— 1 : INTEGER
— 2: REAL
— 3 : STRING
• int_value is the value of the parameter if the data_type is INTEGER.
• real_value is the value of the parameter if the data_type is REAL.
• str_value is the value of the parameter if the data_type is STRING.
• status explains the status of the attempted operation. If not equal to 0, then an error has
occurred.
• If the parameter designated by param_no does not exist, a status of 17042 is returned, which is
the
error message: "ROUT-042WARN TPE parameters do not exist." If this error is returned, confirm
the param_no and the parameter in the CALL or MACRO command in the main TPE program

SQRT Built-In Function


Purpose: Returns a REAL value that is the positive square root of the specified REAL argument
Syntax : SQRT(x)
Function Return Type :REAL
Input/Output Parameters :
[in] x : REAL
%ENVIRONMENT Group :SYSTEM
Details:
• x must not be negative. Otherwise, the program will be aborted with an error.
Example: The following example calculates the square root of the expression (a*a+b*b) and
indicates
that this is the hypotenuse of a triangle.
SQRT Built-In Function
c = SQRT(a*a+b*b)
WRITE (’The hypotenuse of the triangle is ’,c::6::2)

SET_REAL_REG Built-In Procedure


Purpose: Stores a REAL value in the specified register
Syntax : SET_REAL_REG(register_no, real_value, status)
Input/Output Parameters :
[in] register_no : INTEGER
[in] real_value : REAL
[out] status : INTEGER
%ENVIRONMENT Group :REGOPE
Details:
• register_no specifies the register into which real_value will be stored.
• status explains the status of the attempted operation. If not equal to 0, then an error occurred.
See Also: SET_INT_REG, GET_REAL_REG, GET_INT_REG Built-in Procedures

FOR...ENDFOR Statement
Purpose: Looping construct based on an INTEGER counter
Syntax : FOR count = initial || TO | DOWNTO || final
DO{stmnt} ENDFOR
where:
[in]count :INTEGER variable
[in]initial :INTEGER expression
[in]final :INTEGER expression
[in]stmnt :executable KAREL statement
Details:
􀁺 Initially, count is set to the value of initial and final is evaluated. For each iteration, count is
compared to final.
􀁺 If TO is used, count is incremented for each loop iteration.
􀁺 If DOWNTO is used, count is decremented for each loop iteration.
􀁺 If count is greater than final using TO, stmnt is never executed.
􀁺 If count is less than final using DOWNTO, stmnt is never executed on the first iteration.
􀁺 If the comparison does not fail on the first iteration, the FOR loop will be executed for the
number of
times that equals ABS( final - initial) + 1.
􀁺 If final = initial , the loop is executed once.
􀁺 initial is evaluated prior to entering the loop. Therefore, changing the values of initial and final
during loop execution has no effect on the number of iterations performed.
􀁺 The value of count on exit from the loop is uninitialized.
􀁺 Never issue a GO TO statement in a FOR loop. If a GO TO statement causes the program to
exit a
FOR loop, the program might be aborted with a ``Run time stack overflow'' error.
􀁺 Never include a GO TO label in a FOR loop. Entering a FOR loop by a GO TO statement
usually
causes the program to be aborted with a ``Run time stack underflow'' error when the ENDFOR
statement is encountered.
􀁺 The program will not be translated if count is a system variable or ARRAY element.
See Also: Appendix E , ``Syntax Diagrams,'' for additional syntax information.
Example: Refer to the following sections for detailed program examples:
Section B.4 , "Position Data Set and Condition Handlers Program" (PTH_MOVE.KL)
Section B.5 , "Listing Files and Programs and Manipulating Strings" (LIST_EX.KL)
Section B.8 , "Manipulating Values of Dynamically Displayed Variables" (CHG_DATA.KL)
Section B.9 , "Displaying a List From a Dictionary File" (DCLST_EX.KL)
Section B.11 , "Applying Offsets to a Copied Teach Pendant Program" (CPY_TP.KL)

IF ... ENDIF Statement


Purpose: Executes a sequence of statements if a BOOLEAN expression is TRUE; an alternate
sequence can be executed if the condition is FALSE.
Syntax : IF bool_exp THEN
{ true_stmnt } < ELSE
{ false_stmnt } >ENDIF
where:
bool_exp : BOOLEAN
true_stmnt : An executable KAREL statement
false_stmnt : An executable KAREL statement
A–178
MARRC75KR07091E Rev G A. KAREL LANGUAGE ALPHABETICAL
DESCRIPTION
Details:
• If bool_exp evaluates to TRUE, the statements contained in the true_stmnt are executed.
Execution then continues with the first statement after the ENDIF.
• If bool_exp evaluates to FALSE and no ELSE clause is specified, execution skips directly to
the first statement after the ENDIF.
• If bool_exp evaluates to FALSE and an ELSE clause is specified, the statements contained in
the
false_stmnt are executed. Execution then continues with the first statement after the ENDIF.
• IF statements can be nested in either true_stmnt or false_stmnt .
TRUNC(x) returnes the value of x after any fractional part has been removed.
For example, if x = 2.5, the .5 is removed and a value of 2 is returned.
ROUND(X) returns the value of half adjust x. For example, if x = 2.5, a value of 3
is returned.

CURPOS Built-In Function


Purpose: Returns the current Cartesian position of the tool center point (TCP) for the specified
group
of axes even if one of the axes is in an overtravel
Syntax : CURPOS(axis_limit_mask, ovr_trv_mask <,group_no>)
Function Return Type :XYZWPREXT
Input/Output Parameters :
[out] axis_limit_mask :INTEGER
[out] ovr_trv_mask :INTEGER
[in] group_no :INTEGER
%ENVIRONMENT Group :SYSTEM
Details:
• If group_no is omitted, the default group for the program is assumed.
• If group_no is specified, it must be in the range of 1 to the total number of groups defined on
the controller.
• The group must be kinematic.
• Returns the current position of the tool center point (TCP) relative to the current value of the
system variable $UFRAME for the specified group.
• axis_limit_mask specifies which axes are outside the axis limits.
• ovr_trv_mask specifies which axes are in overtravel.
Note axis_limit_mask and ovr_trv_mask are not available in this release and will be ignored if
set.
See Also: Chapter 8 POSITION DATA
Example: Refer to Section B.5 ,"Using Register Built-ins," for a detailed program example.
Section B.5 ,"Using Register Built-ins" (REG_EX.KL)
Section B.1 , "Setting Up Digital Output Ports for Monitoring" (DOUT_EX.KL)

Enable the listing of KAREL programs


Enable the listing of KAREL programs by setting the $KAREL_ENB system variable to 1. Open
the SYSTEM Variables screen (Menu→NEXT→SYSTEM→Variables), and scroll down to
$KAREL_ENB. Press ENTER, and change the value to 1. The modification is immediate, you do
not need to restart the controller.

You might also like