Help required in understanding an indirect addressing method

PLCGurus.NET Live & Interactive Forum PLC Questions and Answers Rockwell, Allen-Bradley, Stratix Help required in understanding an indirect addressing method

Tagged: 

  • This topic has 3 replies, 3 voices, and was last updated 4 years ago by StixoffireKen S.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #4113
    arunkumar.daraArun Kumar Dara
    Participant
      Karma: 28
      Rank: Padawan

      Hi,

      Here is the present statement used in code:

      INPUT_DATA_SYNC_OUT[24] := AENTR1:2:I.Ch0Data;

      How do I use an indirect address in “AENTR1:2:I.Ch0Data”.

      I wanted to use an indirect address like this “AENTR1:[yVar]:I.Ch[xVar]Data”. Is this possible?

      Thank you,

      Arun Kumar D

      #4114
      datipton3David Tipton
      Participant
        Karma: 27
        Rank: Padawan

        Hello Arun,

        What are you trying to accomplish with the indirect addressing? Looks like you want to turn on bit 24 of your output array when Aentr1:module 2: input 0 turns on, is this correct?

        Best Regards,
        David Tipton

        #4128
        arunkumar.daraArun Kumar Dara
        Participant
          Karma: 28
          Rank: Padawan

          Dear David,

          Actually, In my application, I need to send all the Analog Input Values from one controller to another controller. Presently I have 40 Analog Input and I wrote 40 lines of code to copy the data into an array of DINT. So I thought of using indirect addressing and a FOR..LOOP to copy all Analog Input values into an array of DINT. After this by using a message instruction, I can transfer the DINT array to another controller.

          I’m just curious to learn how to implement the indeirect method and For Loop.

          Best Regards,

          Arun Kumar D

           

          #4144
          StixoffireKen S
          Participant
            Karma: 172
            Rank: Jedi

            The problem you have is really indirect access of the property which to my understanding you cannot do.

            So basically you seem to want to iteratively assign an actual Tag to an Indexed Variable.
            If I was writing code in .NET I would need to form the object name and then get a reference to the actual object.
            You are building a name with a string , but your assignment needs a literal .. Reason being is you have the difference between a run time and a design time compile operation as your code executes on an indexed variable it is a run time (the index is not known until the code runs) , if it is literal it is design time and the way that compiles to the processor is different.
            I am not aware of any way that this works in structured text or in ladder , I know you can pass an object by reference for example in a GSV command  but it is limited to certain parameters of status  and not the actual tag data such as what you are trying to acquire.

            You could try to Alias but again this is not code , perhaps if you write an external application to create your tags for you and then you can import them .. Not sure if that is something viable for you – just a suggestion.

          Viewing 4 posts - 1 through 4 (of 4 total)
          • You must be logged in to reply to this topic.