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

6a Roboguide Call - Jump - Label

Uploaded by

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

6a Roboguide Call - Jump - Label

Uploaded by

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

RoboGuide: Program Codes: Call, Jump, Label and If/Then

By: Matthew Jourden


Brighton High School
Brighton, MI
Calling Programs: Allows the operator to create Main Program that can run (Call) other programs. This reduces down the
lines of code an operator needs to look at when troubleshooting the workcell
Example: Main Program controls the following

Program 1: Turns on a Conveyer belt and picks up a part to place in a machine


Program 2: Runs the Machine
Program 3: Robot Removes part from Machine moves to a test Machines
Program 4: Runs Test Machine
Program 5: Places Part in a Accept Bin or Reject Bin

NOTE: Caution calling a Program to a Subprogram 1 then calling a Subprogram from Subprogram 1. This makes it difficult to sort
through the code during troubleshooting process

1. Open RoboGuide > Open BHS Fanuc Robotic Arm Workcell “Student Last Name”
2. Create a New Program called Shapes_”Student Last Name”
NOTE: On the Physical Robots we will use Program MAIN to be able to run in Cycle Start Mode (Production Mode with a
speed limit of 250 mm/sec)

3. Set UFrame and and Tool Frame > Insert Blank Space
4. Calling a Program
NOTE: This program will not set PR[1] (HOME) position because each of the shapes programs sets that. If operator was
to create this project from scratch knowing each program would be called then PR[1] (HOME) would be set in the main
program Shapes_”Student_Last_Name”
a. Select New Instruction > Select CALL > Select CALL PROGRAM

b. Add Remark: Program Shapes


c. Select NEW INSTRUCTION > SELECT CALL

Select NEW INSTRUCTION > Select CALL

d. .TP Program List will appear > Arrow Down to Rectangle_”Student_Last_Name” > Select Hardkey Enter

e. Insert Blank Space > Add Wait Statement for 1 second

f. Add Call commands and Wait Statements as shown

g. Run the Program in Continuous


NOTE: Operator can run in Continuous because the subprograms of the shapes has already been verified in Step Mode

SAVE Workcell
5. Label/Jump Commands

Label/Jump Commands: Labels can be placed in the program where the operator can Jump to that Label based on
conditional statements received from input, output or sensors. In order to Jump to a specific part of the program the
operator needs to set a Label [#]. It is recommended to add a remark/comment to identify the label number.
NOTE: It is not possible to jump between programs.

a. Place the Cursor on line 3 > Insert 1 Blank Line of code

b. Place Cursor on Line 4 > Select New Instruction > Select JMP/LBL > Select LBL [_]

Select NEW INSTRUCTION > Select JMP/LBL

c. Adding a Comment
a. Place Cursor on the Label Number > Press Hardkey Enter > Type in Comment: Start of Program
d. Place cursor at END command > Insert 1 Line above

e. Position Cursor on Line 16 > Select NEW INSTRUCTION > Select JMP/LBL > Select JMP LBL [_] > Arrow over between
braces > Set Value to 1

Place Cursor on Line 16


Set Register Value to 1

Select NEW
INSTRUCTION >
Select JMP/LBL

f. Add a comment Next to JMP LBL [1]: To Start of Program


NOTE: Arrow over to the number > Press Hardkey Enter
g. Run Program in Auto Mode Cycle Start Mode: Turn Off the Teach Pendent (Top Left Knob on the Teach Pendent) >
Press Play Button from the top of the menu to run the program in Auto Mode Cycle Start.
NOTE: This use of Jump/LBL created an infinite loop. The only way to stop this is to turn the robot off. In Roboguide
there is a Stop button next to the Play button. NOTE: when Stopped button is pressed the program will stop at the
line of whatever main program or subprogram the robot was executing.

Turn Off Teach Pendent: Teach Mode


Auto Mode Cycle Abort/Stop: Stops the
Start: Robot runs in Robot’s Cycle Start in
Auto Mode Auto Mode

6. Conditional Statement
Conditional Statements are If/Then statements that will make a comparison between two values (= , <, >, <=, >=, <> (not
equal) if the statement is TRUE then the program will execute the next line of code, If the condition statement is
false the program will ignore the next line of command.
NOTE:

Screen 1: IF/THEN Options Screen 2: IF/THEN Options

a. Insert 4 lines of code between Lines 15 and 16


b. Add a Remark for the Condition Statement: Checks if Code has run 4 times

c. Setting a Counter Variable: Variables are set as Registers. Operator may set registers to keep track of
various data points.
i. Registers Menu: Select Hardkey Data > Select Registers: Option 1

[TYPE] Softkey: Shows different


types of set information.
Previous tutorials used Position
Registers Menu > Softkey [TYPE] Register to set a home position

ii. Arrow over to R[1]: > Press Hardkey Enter > Select Options/KeyBD > Select Softkey Keyboard or F5>
Name: Loop Counter

Arrow over to Register [ ]


> Select Options/KeyBd
Select Keyboard Softkey Type Register Name: Loop Counter

iii. Select Hardkey EDIT to return to the Shapes Program


iv. Setting Loop Counter to Change by 1 each time through the program
1. Arrow Cursor to Line 17
2. Select NEW INSTRUCTION > Select Registers > Select … = … + …

Select … = … + …
3. Select R [_] > Select Keyboard > Set to 1

Cursor moves to next spot


to set a register or value

Set Register Value = 1

4. Cursor will move over to the next set of dots > Select R[_] > Set Value as 1

Select R[_]

5. Set value to change Loop Counter by: Select Constant > Set Value to 1

Set Change Value to 1


d. Conditional Statement:
i. Arrow to Line 18
ii. Select NEW INSTRUCTION > Select IF/SELECT > Select IF …. = ….

Select IF …. = ….
Selection Options for the
Left Side of the IF
Arrow Cursor to Line 18
Statement Conditions
iii. First set of … (left side of the =) Select R [_] > Set Value to 1
NOTE: It is recommended to set variable that is changing throughout the program first then set the
static value to stop at or abort second

Select R[_] Set Register Value = 1

iv. Set second set … (right side of the =) > Select Constant > Set to 4

Set Static Constant Value of 4


v. Setting Result if the Condition is TRUE
1. Select JMP LBL [_]

Select Constant > Set JMP LBL [_] = 2

Select JMP LBL[_]

2. Select Constant > Set JMP LBL# to 2


NOTE: There is not a Label 2 to Jump to yet. So, if the program is tested a Fault would occur
when this line is read.

Set JMP LBL [_] = 2

3. Setting Label 2:
a. Arrow Cursor to END Command
b. Select NEW INSTRUCTION > Select JMP/LBL > Select LBL [_]

3. Select NEW INSTRUCTION > Select LBL


[_]
2. Select JMP/LBL [_]

1. Set Cursor on [END]


c. Set LBL [_] Number to 2 > Place Cursor on LBL #2 > Add Comment (Press Hardkey
Command
Enter): Type “ENDS Program”

Set LBL[_] = 2 > Add Comment “ENDS Program”


e. Program should look as follows

f. Run the program in Continuous


g. After Program is complete > Check Register [1] Loop Counter
i. Select Hardkey DATA > Set [TYPE] to Option 1 Registers > Notice R[1] :Loop Counter = 4
Notice how the program runs 4 times and stops on the 4 this is because to R[1:Loop Counter]
Starting value of 0 runs the program Loop 0,1,2,3 then stops program
Optional: To have R[1: Loop Counter] Stop at 5 showing 4 times running change the starting value to 1
instead of 4 that way the program will Run the Loop 1,2,3,4 then stop as opposed

Notice the Value Changes from 0 to 4


h. Try Running the Program a 2nd Time
i. Program will only run infinitely because the IF/THEN will never become false since we are have
already reached 4 times through the loop in the first run of the program.
Change the IF/THEN comparison to a >= (greater than 4)

ii. Check Register DATA > Select Hardkey DATA


iii. Notice R[1]:LOOP Counter is now 5
iv. Fix: Set R[1]: LOOP COUNTER = 0 just after declaring UFRAME and TFRAME
Set the following lines of code

NOTE: Steps i. Adjusting Comparison in the IF/THEN and Step iv Setting R[1]:LOOP COUNTER to 0 are set to make sure the
counter has a starting point of 0 and a comparison that does not exceed 4 in case an operator stops the program in mid-cycle
and forgets to reset the robot or its registers.

v. Run the Program > Open Registers (Hardkey DATA) to see the numbers count as the program is
running

SAVE Workcell

Submission: Option 1: Show Teacher Operation of the Program


Option 2: Shoot a video of the program running and the code on the screen > Email/Share video with the teacher

You might also like