///// START OF VIDEO SCHEMA ///// ///// END OF VIDEO SCHEMA /////

How to Change Unit Height on Fanuc Robots via PLC

Learn to change the height of a unit load using the PTSETVAR program.
Change Unit Height - thumbnail
Listen to this article

In this article, we will be using PalletTool Turbo II to change the height of a unit load using the PTSETVAR program. If you ever need to modify the height of a unit load due to inconsistencies, then changing the height using the PLC would be a good option.

Before we start, if you want to learn about Fanuc robots and PalletTool Turbo II, check out the course Fanuc Robot Training 9: Advanced Pallet Data Techniques.

Let’s open the program and make some sense of the syntax.

Press SELECT.

Move the cursor down until you see the program PTSETVAR.

Press ENTER.

Fanuc Roboguide interface showing program list and the PTSETVAR option selected, with a robot model in the workspace.

Let’s make the screen wider so it’s easier to read the whole program.

Hold the SHIFT button and press DISP.

Press 5 for Single Wide.

Fanuc Roboguide interface selecting Single Wide display mode in the PTSETVAR program with a robot model in the workspace.

Now we can see what all of the arguments are.

Notice that lines 4–7 are the arguments that will need to be set up in order to change the variable and run the program.

Fanuc Roboguide interface with PTSETVAR program lines 4–7 highlighted to show unit height variable setup.

For your reference, lines 15–24 are used as an example for the number of drops.

Fanuc Roboguide interface displaying PTSETVAR lines 15–24 referencing the number of drops.

This program is very similar to PTGETVAR, but it has some differences that I will explain later.

Create a program

For now, let’s create a program for changing the unit load height.

Press SELECT.

Press F2 for CREATE.

Move the cursor down to Options/Keybd and press F5 for KEYBOARD.

For this example, I will call the name of this program ChangeHeight. Press EXIT.

Roboguide interface with software keyboard open, naming the "ChangeHeight" program for unit height modification.

Press F2 for DETAIL.

Press F1 for END. Press the NEXT button.

Press F1 for [INST].

Move the cursor down to 6 CALL.

Press 1 for CALL program.

Press F2 for MACRO.

Use the up arrow key to scroll up, which will save you some button presses.

Move the cursor up until you see the PTSETVAR program highlighted. Press the ENTER key.

Press F4 for [CHOICE].

Press 3 for String.

Press F5 for STRINGS.

Move the cursor down to Options/Keybd and press F5 for KEYBOARD.

Now, depending on which unit load you want to change, you will change the number at the end of the program. The program is called PMUL00x; the x denotes the number of the unit load. So, if I’m using unit load 1, the program would be PMUL001.

If I wanted to change the unit load to 10 the program would be called PMUL010.

I will be using PMUL001 for the purposes of this article.

Type PMUL001 and press EXIT.

Press F4 for [CHOICE].

Move the cursor down to 3 String and press ENTER.

Press F5 for STRINGS.

Move the cursor down to Options/Keybd and press F5 for KEYBOARD.

Type UL and press EXIT.

Press F4 for [CHOICE].

Move the cursor down to 2 Constant and press ENTER.

Type 0 and press ENTER.

Press F4 for [CHOICE].

Move the cursor down to 2 Constant and press ENTER.

Type 2 to indicate the variable is a REAL value. Then press ENTER.

Press F4 for [CHOICE].

Move the cursor down to 3 String and press ENTER.

Press F5 for STRINGS.

Move the cursor down to Options/Keybd and press F5 for KEYBOARD.

Type UNIT.HGT and press EXIT.

Press F4 for [CHOICE].

Move the cursor down to 3 String and press ENTER.

Press F5 for STRINGS.

Move the cursor down to Options/Keybd and press F5 for KEYBOARD.

Type 0 and press EXIT.

Now, we have a choice to make: we can either directly type the value in decimal format or we can use a numeric register. For the purposes of this article, we will use a numeric register so we can change the value while the robot is running.

Press F4 for [CHOICE].

Move the cursor to 1 R [ ] and press ENTER.

Pick a register and press ENTER. I will be using numeric register 191 for this article.

Roboguide interface showing the "ChangeHeight" program calling PTSETVAR to dynamically adjust the unit load’s height.

Now, let’s open a triple window to see if our code works.

Hold the SHIFT key and press the DISP key.

Move the cursor down to 3 Triple and press ENTER.

Let’s use the top right screen for the register value.

Either press the DISP key until the top screen header is in black or, if you have a touch screen, you can press the spot on the screen.

Press the DATA key.

Move down to line 191.

Give the register a description.

Give the register a value. I will set this value to 150mm.

Now, we will set the bottom right screen to be the Karel variable so that we can see if it changes correctly.

Press the DISP key until the header is black, or click on the bottom right screen.

Press the SELECT key.

Move the cursor down until you see the until load you are wanting to change the height of. Press ENTER. I will be changing unit load 001.

Now press the DATA key. Select F1 for Type. Choose KAREL Vars.

Put the cursor on line 1 UL and press ENTER.

Move the cursor down to line 4 UNIT and press ENTER.

This is the variable we will be changing.

Roboguide interface with the ChangeHeight program and numeric register 191 set to 150.001mm for unit height adjustment.

Test the program

Now, let’s run the program and see if the HGT variable changes correctly.

Unfortunately, the variable didn’t change correctly.

Roboguide interface displaying "ChangeHeight" program, numeric register, and a Fanuc robot near a conveyor.

Our error is that we need it in decimal format. Change the numeric register to 150.001 and run it again.

Notice that it changed correctly. This is because the robot doesn’t like it due to not having a decimal point 150.0. The robot just converts this to an integer. So we need to give it a value that will work. Hence 150.001.

Roboguide with Fanuc robot placing boxes on a conveyor, using the ChangeHeight program to adjust their height.

If you're interested in working with Fanuc robots, you can check out the Fanuc Robot Training course series. Start with the basics and work your way up to the advanced level.

Upload the program to Roboguide

Now, we need to upload this program to Roboguide if you are using PalletPro.

Click on File then upload.

Roboguide interface with "ChangeHeight" program open, numeric register shown, and "File" menu for uploading PMUL001.

Change Upload From: to Workcell Robot Controller.

While PMUL001 is selected, click upload. Then click OK.

Roboguide interface uploading PMUL001 from the Workcell Robot Controller with “ChangeHeight” open and a Fanuc robot.

Now, let’s call our program in the main loop.

Press SELECT.

Move the cursor down to the MAIN program and press ENTER.

Move the cursor down to line 8 and insert a blank line using the EDCMD.

Use the [ INST ] key to call our new program.

Move the cursor down to the CHANGEHEIGHT and press ENTER.

Roboguide MAIN program with a "ChangeHeight" call at line 8 for adjusting unit load height.

Run the program

Now, let’s run the cell.

Play with numeric register 191 to see that the height of the box changes. You should note that the graphics will not change dynamically. This is just to illustrate the change. You should exercise caution if you are ever-changing this value on the fly.

Notice the height change.

Fanuc robot placing boxes on a conveyor with updated heights after running the ChangeHeight program in Roboguide software.

When you restart the cell, the graphics will update to the last value you changed.

Summary

In this article, we learned how to change the height of a unit load using the PTSETVAR program in PalletTool Turbo II.

If you want to learn more about robotics, we have several courses for you. Check out realpars.com/courses and under Skill Paths, filter for Robotics.

If you're a plant manager and think your team could benefit from robotics training, check out realpars.com/business. Add your contact info, and our team will quickly get in touch to see how we can help your team develop their skills.

FAQS

Frequently asked questions

What is PTSETVAR, and why is it important to change unit height?
How do I configure a numeric register for changing the unit load height?
Can I adjust the unit height on the fly while the robot is running?
Why does the robot require a decimal point for the height value?
What’s the difference between PTSETVAR and PTGETVAR?

Learn from Industry Experts

Start your learning journey today!
With a 7-day trial, then 35/month
Start Learning for Free