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

Is there a way to set the value of an SR string register in a TP program?

  • Tarnarmour
  • November 20, 2024 at 6:58 PM
  • Thread is Resolved
  • Tarnarmour
    Reactions Received
    1
    Posts
    26
    • November 20, 2024 at 6:58 PM
    • #1

    I'd just like to know if I can set a SR in a TP program, something like:
    SR[1] = 'ABC' ;

    If that's impossible, I'd like to describe what I'd like to use this for to see if there are any simpler methods for accomplishing it.

    I'm writing a system that generates TP code, translating it from some other easier to work with language into .LS files. One feature that I need is to be able to start concurrently running processes that run in a loop. I'm going to do this by writing a TP program called `START_LOOP` that looks like this:

    Code
    ! START_LOOP - start running a program in a loop
    LBL[1]
    CALL <program name>
    WAIT <sleep time>
    JMP LBL[1]

    I will then run this START_LOOP function as follows:

    RUN START_LOOP

    Ideally, I would like to pass the <program name> in as an argument to START_LOOP, like this:

    RUN START_LOOP 'MY_PROGRAM'

    but you can't pass strings in as arguments. Instead, I was thinking of doing something like this:

    Code
    SR[1] = 'MY_PROGRAM'
    RUN START_LOOP(1)

    And then START_LOOP could use the argument as the index of a string register:

    CALL SR[AR[1]]

    But apparently you can't do this either, because you can't set string registers programmatically?

  • asdf
    Reactions Received
    7
    Trophies
    1
    Posts
    45
    • November 20, 2024 at 9:19 PM
    • Best Answer
    • #2

    You can't directly write a string literal to an SR. You can pass a string literal as an argument to a subprogram, then write that argument to a string register

    Code
    write a tp program named something like SET_STRING with just this line:
    1:  SR[AR[2]]=AR[1]
    
    
    Then call like so:
    1st argument is the string literal 
    2nd argument is String Register to write to
    
    Call SET_STRING('myString',1)
  • Tarnarmour November 21, 2024 at 12:15 AM

    Selected a post as the best answer.
  • Tarnarmour
    Reactions Received
    1
    Posts
    26
    • November 21, 2024 at 12:16 AM
    • #3

    Thank you, that's fixed it! Very unintuitive to me that I can sometimes pass a string as an argument, and can set SR's by referencing AR's, but not set them directly. I suppose the designers of the TP language have some ineffable plan.

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

Tags

  • Fanuc
  • REGISTER
  • Program Control
  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