# Using IF with Position Register

• Hi.I would like to set a maximum range for the values of X, Y, Z, W, P, R.

Something like:

IF PR[5,1]>155 AND <175 , JMP LBL(22)

! WRONG VALUE

UALM[2]

LBL[22]

IF doesn't work with Position Register.

How could i do that?

• ## panic modeJun 5th 2023

• You are missing a part.

IF PR[5,1]>155 AND PR[5,1]<175 , JMP LBL(22)

This wont work with RJ and earlier.

(the mixed logic solution of Hermann will work fine too.)

• The command "IF" doesn't work with Position Register.

The problem is not the syntax.

This:

IF PR[5,1]>155 AND <175 , JMP LBL(22)

is just an example of the logic I would like to use, but I don't have the option to use IF with PR.

This:
IF ((PR[5,1]>155) AND (PR[5,1] <175)) , JMP LBL(22)

Or this:

IF (PR[5,1]>155 AND PR[5,1]<175),JMP LBL(22)

are not options because I don't have the option to use IF with PRs.

Thank you for your attention and answers, but my question is precisely whether there is a way to use IF with PR. Or another similar command for Fanuc robots (R30iB)

• " I don't have the option to use IF with PRs."

What makes you think so? This ability is not an option.

The syntax provided works on R30iA and R30iB.

Are you editing on the robot teach pendant or in PC text editor?

What are your regional settings for decimal separator? Is it . or , ?

• Are you trying to do this on a non motion program (No groups assigned)? Or on a paint robot?

Check out the Fanuc position converter I wrote here!

• Hermann's answer would be a solution. Thank you Hermann. But the problem is that I will need many Registers and I have few available. For each PR would need 6 registers (x, y, z, w, p, r).

Is there another way to do this?

• Sergei:

Robot M20iB/25, HandlingPRO, R30iB
Editing in ROBOGUIDE from a robot backup.
Decimal separator is "."

Nation: Is a motion program.