Problem of programming

  • program name:BROL1
    1: !MAIN WELDING PROG
    2: LBL[1]
    3: L P[1] 100mm/sec CNT100
    4: L P[2] 100mm/sec CNT100
    5: LBL[2]
    3: L P[3] 100mm/sec CNT100
    4: L P[4] 100mm/sec CNT100
    2: LBL[3]
    3: L P[5] 100mm/sec CNT100
    4: L P[6] 100mm/sec CNT100
    [END]


    program name:BROL2
    1: !TEST WELDING PROG
    2: CALL BROL1[LBL1-LBL2]
    [END]


    Above BROL2 program call BROL1. But I just want it to work at the label intervals I specify. How to enter a formula after CALL BROL1. Or how else I can solve this programming problem. There is a RJ2 robot that needs a lot of programming, and the same program needs to be called by many different programs for different source points. As a result, the robot's memory is not enough.

  • Place your Ad here!
  • What I would do is


    program name:BROL1
    1: !MAIN WELDING PROG
    2: IF AR[1] = 1, JMP LBL [1]
    3: IF AR[1] = 2, JMP LBL [2] ---> etc, OR use SELECT instruction
    4: LBL[1]
    5: L P[1] 100mm/sec CNT100
    6: L P[2] 100mm/sec CNT100
    7: LBL[2]
    8: L P[3] 100mm/sec CNT100
    9: L P[4] 100mm/sec CNT100
    10: LBL[3]
    11: L P[5] 100mm/sec CNT100
    12: L P[6] 100mm/sec CNT100
    [END]



    program name:BROL2
    1: !TEST WELDING PROG
    2: CALL BROL1(1) ---> or 2 or 3 etc
    [END]

  • You can use an indirect reference for the JMP to make it very easy to jump to the LBL. The CALL would be the same as rafahil suggested


    BROL2 program
    ! TEST WELDING PROG
    CALL BROL1(1) ---> or 2 or 3 etc


    Make sure you BROL1 program has a JMP to the end of the program after the moves so it doesn't continue on to the next LBL


    BROL1 program


    JMP LBL[AR[1]] Jumps to the label number in AR[1]


    LBL[1]
    L P[1] ...
    L P[2] ...
    JMP LBL[999]


    LBL[2]
    ...
    ...
    JMP LBL[999]

  • Thank you very much for the answers.
    CALL BROL1(1) ---> or 2 or 3 etc I do not want this section to run only from the first point to the first point. I want For example: CALL BROL1(LBL4 To LBL45) I want to run the lines in this label range. I want the program to run lines between LBL4 and LBL45. Between LBL4 and LBL45
    Respects...

  • You would have to add checks before every label on whether or not to exit. And call BROL1 with 2 arguments.


    For Example:


    Another method would be to just call the single argument BROL1 program multiple times. This might cause jitters in the path though.


    Code
    !This code runs from label 3 to 45, and uses R[10] to keep track of where you are
    R[10:start lbl]=3
    R[11:end lbl]=45
    LBL[1] ;
    CALL BROL1(R[10])
    R[10]=R[10]+1
    IF R[10]<R[11], JMP LBL[1]

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

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

  • IMHO the jump labels are getting way to complex here. Just break it up into seperate programs and call the ones you want.


    The person who is stuck troubleshooting your code at 3 AM will thank you.


    Sent from my SM-G930V using Tapatalk


  • IMHO the jump labels are getting way to complex here. Just break it up into seperate programs and call the ones you want.


    I agree with you to an extent, but I feel like this isn't that complicated yet. If you add a header describing what each argument does I think you would be fine.



    The person who is stuck troubleshooting your code at 3 AM will thank you.


    This is a good point though. You can make the code clever and concise, but in doing so you typically sacrifice code maintainability. If the guy at 3am isn't as strong a programmer as you are, you will likely be the one that gets called into the plant at 3am.

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

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

  • In order to add the argument numbers after the name program in the call instruction:
    - Move the cursor AFTER the name of the program of the CALL instruction .... (in the same line)
    - Then press [CHOICE]
    - Select Constant, and it will add a "(Constant)" after the program name. --> CALL BROL1 (Constant)
    - Replace the word Constant with the number that you need. --> CALL BROL1 (#)
    - Repeat the same (Move the cursor after...) to add the second constant. --> CALL BROL1 (#,Constant)


    You should get something like
    1: CALL BROL1 (#,#)

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