String parameter to routine

  • Place your Ad here!
  • How you have it would work, at least partially. However the problem is that you can't assign string registers directly. Also in the IF statement you can't compare to a string literal.

    You have to create a string assignment macro to do the assignment.

    So to make your program work you would have to do the following:

       1: CALL GRIPPER('Open')    ;

    And then in gripper:

    Which would have to call STR_ASSIGN for the IF statement in GRIPPER to work.

       1:  !SR[1] stores what was passed in. ;
       1:  SR[1]=AR[1]    ;

    Check out the Fanuc position converter I wrote here! Now open source!

    Check out my example Fanuc Ethernet/IP Explicit Messaging program here!

  • Another option similar to what Nation posted would be to set some String Registers equal to the strings you are looking for and compare them to the AR . I manually set SR[2] & SR[3] to OPEN and CLOSE in the DATA window. Then I ran a program that called the program below and it would jump to LBL[1] or LBL[2] depending on what string was passed to this program.

    2: IF SR[2]=AR[1],JMP LBL[1] ;
    3: IF SR[3]=AR[1],JMP LBL[2] ;
    4: ;
    5: ;
    6: LBL[1] ;
    7: ;
    8: ;
    9: ;
    10: ;
    11: LBL[2] ;
    12: ;
    13: ;
    14: ;
    15: ;

    Edited once, last by DaveP ().

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account
Sign up for a new account in our community. It's easy!
Register a new account
Sign in
Already have an account? Sign in here.
Sign in Now

Advertising from our partners