Non-Motion Instructions Lab: Difference between revisions

 
(2 intermediate revisions by the same user not shown)
Line 56:
 
== Counters and Conditional Loops ==
[[File:Loops Example.jpg|thumb|396x396px378x378px|When products are palletized, they are often wrapped in plastic before being loaded on trucks and shipped out. If you were to use a robot for wrapping the pallets, you would need to make many passes around it. Using loops, this can be done quickly without needing to teach a lot of similar points.|alt=]]
 
'''Prerequisite Knowledge:'''
Line 79:
* Register Instructions
* EDCMD (Insert)
*Copying Programs (SELECT Page)
 
'''All labs assume HandlingTool software.'''
{| class="wikitable"
|[[File:Pallet Registers.png|thumb]]
|
|Start by hitting the DATA key on the teach pendant’s keypad. This will open the DATA page.
 
The DATA page will open on whatever type was last viewed. We want to get to the Registers page but it may not yet be selected.
 
If you do not see a list of registers (of any type) you may be viewing the specific details of a single position register. In this case, hit the '''PREV''' key.
In the example to the left, we are viewing the “Pallet Registers” page. To change to Registers, select the softkey ['''TYPE'''] and choose the first option, “'''Registers'''”.
 
In the example to the left, we are viewing the “Pallet Registers” page. To change to Registers, select the softkey ['''TYPE'''] and choose the first option, “'''Registers'''”.
|-
|[[File:DATA Registers Open.png|thumb]]
|
|          
 
Line 100 ⟶ 105:
<br />
|-
|[[File:Data Registers Commenting.png|thumb]]
|
|
 
Line 112 ⟶ 117:
<br />
|-
|[[File:DATA registers Commented, Manually Entering Values.png|thumb]]
|
|Registers can be used without commenting them, but it is just easier to program when they have useful names.
 
Line 125 ⟶ 130:
<nowiki>*</nowiki>Data registers can contain values up to 10 to the power of 17, which comes out to be around 10 quadrillion.
|-
|[[File:Data Registers negative value entered.png|thumb]]
|
|Select your register’s contents once again. This time type '''-1''' and hit '''ENTER'''.
 
Line 150 ⟶ 155:
<br />
|-
|[[File:Mprog.png|thumb]]
|
|Add motion to your program that starts at home, reaches every point on the template sheet, and ends at home.
 
Line 169 ⟶ 174:
'''J PR[1:HOME] 100% FINE'''
|-
|[[File:Copying Program.png|thumb]]
|
|Now we want to leave this program alone and make a copy of it for the next part of the lab.
 
Line 192 ⟶ 197:
When prompted with “Copy OK?” hit '''YES.'''
|-
|[[File:Copied Program.png|thumb]]
|
|
 
Line 202 ⟶ 207:
This is an exact copy of the original motion program, and any changes we make to it won’t affect the original.
|-
|[[File:Inserting Lines.png|thumb]]
|
|The first thing we want to do is make this program loop. We’ll be using registers next to count the loops, and then add conditional instructions after that to stop after a certain number of loops through the program.
 
Line 211 ⟶ 216:
To insert a blank line, hit the '''EDCMD''' softkey and select '''INSERT.''' You will be prompted about how many lines you wish to add, but we only need one for now. Hit enter and a blank line will be added above the selected line.
|-
|[[File:Jmp LBL.png|thumb]]
|
|Inside that blank line, we want to add a JMP LBL[] instruction. To do so, hit the ['''INST'''] softkey and select '''JMP/LBL'''. Then you select “'''JMP LBL[]'''” and it will place that instruction into your blank line.
 
Line 218 ⟶ 223:
When this instruction is reached, it will jump to whatever line LBL[1] is on. We haven’t put LBL[1] on any lines yet, so it won’t work. We’ll do that next.
|-
|[[File:LBL.png|thumb]]
|
|'''Repeat''' the same process of adding a blank line and the non-motion instruction to place a LBL[] between the home instruction and our first point on line 2. Make sure to select the '''LBL'''[] instruction instead of JMP LBL []. When prompted, enter the value of '''1''' and hit '''ENTER.'''
 
Line 232 ⟶ 237:
Next we will make it conditional.
|-
|[[File:If operator menu.png|thumb]]
|
|Select that JMP LBL[1] line toward the end of your program.
 
Line 243 ⟶ 248:
Select it.
|-
|[[File:IF variable menu.png|thumb]]
|
|Next it will prompt you for the first variable to compare. We’ll be using your register for this, so select '''R[ ].''' It will prompt you for the register number. '''Type''' the number of the register you chose earlier and hit '''ENTER'''.
 
Line 256 ⟶ 261:
This will cause it to loop so long as your register is less than 3.
|-
|[[File:If instruction available.png|thumb]]
|
|
 
Line 272 ⟶ 277:
'''R[9] = R[9] + 1'''
|-
|[[File:Register instruction added now.png|thumb]]
|
|Now each time through the loop, your register’s value will go up by one. Eventually it will no longer be less than 3, and the program will no longer loop, simply ending with that last Joint move to HOME.
 
Line 280 ⟶ 285:
<br />
|-
|[[File:Setting up register as zero.png|thumb]]
|
|So lets add that instruction at the beginning, to “set up” our register.
 
Line 289 ⟶ 294:
This tidies up the variables so no matter what is in the register before you run the program, it will be a consistent, predictable value when you do.
|-
|[[File:Running from beginning.png|thumb]]
|
|Go ahead and run your program through from the beginning. It should run 3 times and then go home. STEP through the program to see what is happening too. You can switch to dual-view to watch it happen in real time by hitting the top right icon (far right on the blue bar), selecting the screen that isn’t your program, and hitting DATA.