532,016 active members*
3,314 visitors online*
Register for free
Login
IndustryArena Forum > Community Club House > Machinist Hangout > Checking sign of numeric value in fanuc macro
Results 1 to 4 of 4
  1. #1
    Member
    Join Date
    Nov 2020
    Posts
    2

    Unhappy Checking sign of numeric value in fanuc macro

    Hello, I need to check the sign +/- of a value in any register of a fanuc oi cnc macro.
    (Maybe using an "IF" type expression) i.e.: IF #500EQ(?) GOTO...
    It seems like it should be simple but I'm stumped.

  2. #2
    Registered
    Join Date
    Feb 2011
    Posts
    317

    Re: Checking sign of numeric value in fanuc macro

    What are you trying to check
    are you trying find the value of the macro number or is a specific number that you want the program to goto xxxx ?

    Hello, I need to check the sign +/- of a value in any register of a fanuc oi cnc macro.
    (Maybe using an "IF" type expression) i.e.: IF #500EQ(?) GOTO...
    It seems like it should be simple but I'm stumped.

  3. #3
    Registered
    Join Date
    Apr 2011
    Posts
    662

    Re: Checking sign of numeric value in fanuc macro

    Here is what you need to do:

    N10 IF[#500 LT 0]GOTO 100
    N20 IF[#500 GT 0]GOTO 200
    N30 IF[#500 EQ 0]GOTO 40
    N40 (This line will run if #500 is 000.0000)
    N100 (This line will run if #500 is -000.0001or less)
    N200 (This line will run if #500 is 000.0001or more)

  4. #4
    Member
    Join Date
    Nov 2020
    Posts
    2

    Re: Checking sign of numeric value in fanuc macro

    Thanks drdos, That should work. I really appreciate it. I'll try it as soon as I can.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •