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. Fanuc 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

R[x]=PR[i,j] in non-motion macro

  • TitusLepic
  • September 21, 2023 at 11:31 PM
  • Thread is Resolved
  • TitusLepic
    Reactions Received
    112
    Trophies
    6
    Posts
    442
    • September 21, 2023 at 11:31 PM
    • #1

    What I'm trying to do:

    Read several PRs from the robot to my CompactLogix PLC on demand so that I can display them on an HMI (budget is $0, so can't use SNPX HMI unfortunately). The robot is running HandlingTool 7.70, so it doesn't support PRs via explicit messaging.

    My thought was to break each PR into 3 registers (only care about position, not rotation) and read those via explicit messaging into a REAL array in the PLC that the HMI can access. I'm using a DI over Ethernet/IP to trigger a macro that copies the PR positions into the registers.

    Code
    /PROG  RD_PR_POS      Macro
    /ATTR
    OWNER        = MNEDITOR;
    COMMENT        = "PRs to PLC";
    PROG_SIZE    = 657;
    CREATE        = DATE 23-09-21  TIME 15:52:52;
    MODIFIED    = DATE 23-09-21  TIME 15:52:52;
    FILE_NAME    = ;
    VERSION        = 0;
    LINE_COUNT    = 25;
    MEMORY_SIZE    = 929;
    PROTECT        = READ_WRITE;
    TCD:  STACK_SIZE    = 0,
          TASK_PRIORITY    = 50,
          TIME_SLICE    = 0,
          BUSY_LAMP_OFF    = 0,
          ABORT_REQUEST    = 0,
          PAUSE_REQUEST    = 0;
    DEFAULT_GROUP    = *,*,*,*,*;
    CONTROL_CODE    = 00000000 00000000;
    /APPL
    
    AUTO_SINGULARITY_HEADER;
      ENABLE_SINGULARITY_AVOIDANCE   : TRUE;
    /MN
       1:  R[59:rd_B1 Approach X]=PR[11,1:Bowl 1 Approach]    ;
       2:  R[60:rd_B1 Approach Y]=PR[11,2:Bowl 1 Approach]    ;
       3:  R[61:rd_B1 Approach Z]=PR[11,3:Bowl 1 Approach]    ;
       4:  R[62:rd_B1 Pick X]=PR[12,1:Bowl 1 Pick]    ;
       5:  R[63:rd_B1 Pick Y]=PR[12,2:Bowl 1 Pick]    ;
       6:  R[64:rd_B1 Pick Z]=PR[12,3:Bowl 1 Pick]    ;
       7:  R[65:rd_B2 Approach X]=PR[13,1:Bowl 2 Approach]    ;
       8:  R[66:rd_B2 Approach Y]=PR[13,2:Bowl 2 Approach]    ;
       9:  R[67:rd_B2 Approach Z]=PR[13,3:Bowl 2 Approach]    ;
      10:  R[68:rd_B2 Pick X]=PR[14,1:Bowl 2 Pick]    ;
      11:  R[69:rd_B2 Pick Y]=PR[14,2:Bowl 2 Pick]    ;
      12:  R[70:rd_B2 Pick Z]=PR[14,3:Bowl 2 Pick]    ;
      13:  R[71:rd_B3 Approach X]=PR[15,1:Bowl 3 Approach]    ;
      14:  R[72:rd_B3 Approach Y]=PR[15,2:Bowl 3 Approach]    ;
      15:  R[73:rd_B3 Approach Z]=PR[15,3:Bowl 3 Approach]    ;
      16:  R[74:rd_B3 Pick X]=PR[16,1:Bowl 3 Pick]    ;
      17:  R[75:rd_B3 Pick Y]=PR[16,2:Bowl 3 Pick]    ;
      18:  R[76:rd_B3 Pick Z]=PR[16,3:Bowl 3 Pick]    ;
      19:  R[77:rd_B4 Approach X]=PR[17,1:Bowl 4 Approach]    ;
      20:  R[78:rd_B4 Approach Y]=PR[17,2:Bowl 4 Approach]    ;
      21:  R[79:rd_B4 Approach Z]=PR[17,3:Bowl 4 Approach]    ;
      22:  R[80:rd_B4 Pick X]=PR[18,1:Bowl 4 Pick]    ;
      23:  R[81:rd_B4 Pick Y]=PR[18,2:Bowl 4 Pick]    ;
      24:  R[82:rd_B4 Pick Z]=PR[18,3:Bowl 4 Pick]    ;
      25:  DO[22:PR write done]=PULSE,1.0sec ;
    /POS
    /END
    Display More

    My problem is that if I give this macro a motion group *, I get an INTP-214 "Specified group not locked" error. If I give it a motion group of 1, I get INTP-105 "Run request failed" and PROG-040 "Already locked by other task" messages. I understand why this is happening, but am scratching my head trying to figure out how to get around it. It seems like there should be a much better solution than what I'm trying.

    Any suggestions?

  • Go to Best Answer
  • TitusLepic September 21, 2023 at 11:36 PM

    Changed the title of the thread from “Reading from PR in non-motion program” to “R[x]=PR[i,j] in non-motion macro”.
  • PnsStarter
    Reactions Received
    90
    Trophies
    6
    Posts
    325
    • September 21, 2023 at 11:43 PM
    • #2

    Hi

    have you tried

    No motion PR operate mode --> true

    (inside config menu)

    Backdate/TP-Tools: A small collection of tools that simplify the commissioning and programming of Fanuc robots. (github.com)

  • pdl
    Reactions Received
    266
    Trophies
    9
    Posts
    1,504
    • September 22, 2023 at 6:31 AM
    • #3
    Quote from PnsStarter

    Hi

    have you tried

    No motion PR operate mode --> true

    (inside config menu)

    That would be awesome and a great use of that feature, unfortunately that didn't come out until recently.

    If you want to run your program asynchronously, you could just use lock and unlock preg in the foreground and then jump over your code in the background if it's locked.

    Then there's always Karel...

  • PnsStarter
    Reactions Received
    90
    Trophies
    6
    Posts
    325
    • September 22, 2023 at 10:34 AM
    • Best Answer
    • #4

    Hi TitusLepic,

    another way might be to set a motion group allocated in your program again.

    And then setup your program to run as BG_LOGIC.

    This works! At least at R30iB(V8.20 5Groups,32Axis) and V9.40(only virtual tested;1Group,6Axis)

    Inside your BG_LOGIC you can handle the plc requests...

    best

    Backdate/TP-Tools: A small collection of tools that simplify the commissioning and programming of Fanuc robots. (github.com)

  • TitusLepic
    Reactions Received
    112
    Trophies
    6
    Posts
    442
    • September 22, 2023 at 4:46 PM
    • #5
    Quote from PnsStarter

    another way might be to set a motion group allocated in your program again.

    And then setup your program to run as BG_LOGIC.

    Thanks, for some reason I was under the impression that BGlogic programs couldn't have motion groups but testing in RG shows that that will work.

  • Shellmer
    Reactions Received
    52
    Trophies
    5
    Posts
    161
    • September 27, 2023 at 3:13 AM
    • #6

    Yeah, it's not very known but you can read and modify PR data values if you do it on BGLogic... for some reason it doesn't lock the group, but you must take care and ensure you will not be trying to move to that PR while you are modifying it or before the complete data has been transfered!

    I've used this a lot on vision equipments to get part coordinates from the next piece while robot is doing other stuff, that way robot does not need to wait before going for another piece, also to transfer GI data to registers after converting it to reals and use that data directly from registers on the motion program.

    Hope they never "fix" this behaviour, it is very handy, if this behaviour was not intended I still haven't found a single problem doing PR edits that way, and as far as I know, there are not another way to do PR edits and reads in second plane without stopping the robot motion completelly and then locking, doing your stuff and unlocking the group again.

    Sometimes coding on fanuc feels bad, as I am using hacky ways to do things that on other brands I just do not need to, but hey... it works, it's like when some languages or apis make a function deprecated but doesn't give an alternative way to do what the function does.

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
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • robodk
  • 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
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • robodk
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000
  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