1. Home
    1. Dashboard
    2. Search
  2. Forum
    1. Unresolved Threads
    2. Members
      1. Recent Activities
      2. Users Online
      3. Team Members
      4. Search Members
      5. Trophys
  3. Articles
  4. Blog
  5. Videos
  6. Jobs
  7. Shop
    1. Orders
  • Login or register
  • Search
This Thread
  • Everywhere
  • This Thread
  • This Forum
  • Articles
  • Pages
  • Forum
  • Blog Articles
  • Products
  • More Options
  1. Robotforum - Support and discussion community for industrial robots and cobots
  2. Forum
  3. Industrial Robot Support and Discussion Center
  4. ABB Robot Forum
Your browser does not support videos RoboDK Software for simulation and programming
Visit our Mainsponsor
IRBCAM
Robotics Channel
Robotics Training
Advertise in robotics
Sponsored Ads

Array Of Proc in ABB

  • cpanchal
  • April 12, 2024 at 6:07 PM
  • Thread is Resolved
  • cpanchal
    Trophies
    1
    Posts
    8
    • April 12, 2024 at 6:07 PM
    • #1

    So I am trying to create a loop to select programs in abb but i am having trouble creating an array of procedures.

    Here is the declaration and in the proc calls i am getting data reference error for the first index.

    CONST num NUM_STYLES = 7;

    PERS num styleNumbers{NUM_STYLES} := [20, 21, 22, 40, 41, 42, 10];

    PERS num styleFunctions{NUM_STYLES} := [Proc20, Proc21, Proc22, Proc40, Proc41, Proc42, Proc10];

    Can anyone tell is there any other datatype or way to create something like this.

  • Fubini April 12, 2024 at 6:19 PM

    Approved the thread.
  • Lemster68
    Reactions Received
    301
    Trophies
    9
    Posts
    2,485
    Blog Articles
    7
    • April 12, 2024 at 6:27 PM
    • #2

    You did not post what code is causing errors. Anyway, I have a feeling that you would benefit from reading this:

    Blog Article

    Rapid 201: Set yourself ahead of the crowd.

    How to call by variable, and how not to.

    Here a programmer hard coded the routine name to a string to be used in a Call by variable. It pretty much defeats the purpose of using a Call by Variable and creates extra steps as well. There are two ways to use a call by variable: 1. %MyRoutine%; where the string between the percent signs is the name of the routine to run. 2. CallByVar "MainTyp", nProg; The number value is automatically converted to a string and concatenated onto the…
    Lemster68
    March 9, 2020 at 6:20 PM
  • cpanchal
    Trophies
    1
    Posts
    8
    • April 12, 2024 at 7:31 PM
    • #3

    Lemster68 I want to create a for loop to select programs based on the input from plc which will select the program from the arrays that i have created instead of doing test case method this can be little shorter and cleaner since i have a lot of programs that i want to add to the list. but the array for calling the programs doesnot allow me since its not a number but does not take string either. For PERS num styleFunctions{NUM_STYLES} := [Proc20, Proc21, Proc22, Proc40, Proc41, Proc42, Proc10]; this I am talking about the procs are subroutines that i want to call.

  • Gilldur
    Reactions Received
    9
    Trophies
    3
    Posts
    39
    • April 13, 2024 at 8:01 AM
    • #4

    There are a few ways to do this in my mind.

    PERS string sProcs{7}:=["Proc20", "Proc21, "Proc22", "Proc40", "Proc41", "Proc42", "Proc10"];

    Lets say you have the names in a string array.

    You could call them through late binding.

    The syntax for proc call is a string inside % symbols.

    %"Proc22"%;
    But you could also write it like:

    %sProcs{1}%;

    You could also combine a base string with a number.

    %"Proc"+ValToStr(22)%;

    There is also an instruction that does this in the system called CallByVar

    From the manual:

    Example 1
    reg1 := 2;
    CallByVar "proc", reg1;
    The procedure proc2 is called.

    Hope this helps.

  • palmeida
    Reactions Received
    1
    Trophies
    3
    Posts
    18
    • April 15, 2024 at 1:09 PM
    • #5

    So you have procedures with the same name just different suffix at the end, take at look about Dynamic procedure call CallByVar in the manual "RAPID Instructions, Functions and Data types", it lets you use a name and a numeric value which you can use from your array to call a proc.

  • cpanchal April 15, 2024 at 4:23 PM

    Selected a post as the best answer.
  • cpanchal
    Trophies
    1
    Posts
    8
    • April 15, 2024 at 4:50 PM
    • #6

    Gilldur So if I am using string right and I want to call the procs according to the index this would work or not ?

    FOR i FROM 1 TO NUM_STYLES DO

    IF giStyleSelect = styleNumbers{i} THEN

    SETGO goStyleEcho, styleNumbers{i};

    styleFunctions{i}:="";

    styleFound := TRUE;

    BREAK;

    ENDIF

    ENDFOR the only part from this code that i need to make sure is that it will get the data styleFunctions{i}:=""; and call the proc

  • Lemster68
    Reactions Received
    301
    Trophies
    9
    Posts
    2,485
    Blog Articles
    7
    • April 15, 2024 at 5:11 PM
    • #7
    Quote from cpanchal

    CONST num NUM_STYLES = 7;

    PERS num styleNumbers{NUM_STYLES} := [20, 21, 22, 40, 41, 42, 10];

    PERS num styleFunctions{NUM_STYLES} := [Proc20, Proc21, Proc22, Proc40, Proc41, Proc42, Proc10];

    It has occurred to me (I think) today that you think that you have declared a new datatype with the declaration CONST num NUM_STYLES:=7; Because I see the other PERS num styleNumbers(NUM_STYLES):= ....

    That is not how it works. The num after the type (VAR, PERS, CONST) is the datatype, already present in rapid.

Advertising from our partners

IRBCAM
Robotics Channel
Robotics Training
Advertise in robotics
Advertise in Robotics
Advertise in Robotics

Job Postings

  • Anyware Robotics is hiring!

    yzhou377 February 23, 2025 at 4:54 AM
  • How to see your Job Posting (search or recruit) here in Robot-Forum.com

    Werner Hampel November 18, 2021 at 3:44 PM
Your browser does not support videos RoboDK Software for simulation and programming

Tag Cloud

  • abb
  • Backup
  • calibration
  • Communication
  • CRX
  • DCS
  • dx100
  • dx200
  • error
  • Ethernet
  • Ethernet IP
  • external axis
  • Fanuc
  • help
  • hmi
  • I/O
  • irc5
  • IRVIsion
  • karel
  • kawasaki
  • KRC2
  • KRC4
  • KRC 4
  • krc5
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000

Thread Tag Cloud

  • abb
  • Backup
  • calibration
  • Communication
  • CRX
  • DCS
  • dx100
  • dx200
  • error
  • Ethernet
  • Ethernet IP
  • external axis
  • Fanuc
  • help
  • hmi
  • I/O
  • irc5
  • IRVIsion
  • karel
  • kawasaki
  • KRC2
  • KRC4
  • KRC 4
  • krc5
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000

Similar Threads

  • Production Queue / Machine Priority

    • ColoradoTaco
    • August 23, 2023 at 7:14 PM
    • General Discussion of Industrial Robots Only
  • KRL Styleguide

    • Hes
    • October 29, 2022 at 1:10 PM
    • KUKA Robot Forum
  • Manufacturer Terms

    • 95devils
    • April 6, 2022 at 9:40 PM
    • General Discussion of Industrial Robots Only
  • Bit of a coding Conundrum

    • Ash
    • January 31, 2022 at 6:25 PM
    • KUKA Robot Forum

Tags

  • abb
  • RAPID
  • Rapid programming
  1. Privacy Policy
  2. Legal Notice
Powered by WoltLab Suite™
As a registered Member:
* You will see no Google advertising
* You can translate posts into your local language
* You can ask questions or help the community with your knowledge
* You can thank the authors for their help
* You can receive notifications of replies or new topics on request
* We do not sell your data - we promise

JOIN OUR GREAT ROBOTICS COMMUNITY.
Don’t have an account yet? Register yourself now and be a part of our community!
Register Yourself Lost Password
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on Google Play
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on the App Store
Download