Indirect address on a %IW

bertrand42
2020-04-15
2020-04-15
  • bertrand42 - 2020-04-15

    FOR IIdx_IN := 0 TO 100 BY 1 DO
    APtrBCmdIn[IIdx_IN] := PtrAL_InData + IIdx_IN ;
    PtrBSrc := APtrBCmdIn[IIdx_IN];

    Tab[IIdx_IN]:=PtrBSrc^;
    

    END_FOR

    Declaration APtrBCmdIn: ARRAY[0.445] OF POINTER TO UINT;
    Tab: ARRAY[0..445] OF UINT;
    PtrAL_InData : POINTER TO UINT; // pointer to start address %IW -> ex: adr(%IW400)
    IIdx_IN : BYTE; // index

    My problem is that in the tab the values are informed both words......

    That is to say, first word of tab the value is correct, second word the value is not that expected, Third word value expected to the second word etc.

    Thank you for your help

    BR

     
  • i-campbell

    i-campbell - 2020-04-15

    Pointers are in bytes, so you will have to add 2 * IIdxIn.

     
  • bertrand42 - 2020-04-15

    Thanks for your answer,

    Does that mean I have to concat the data from two pointing addresses and put them in an int?

    And in my previous example what is the value of the second word?

     
  • i-campbell

    i-campbell - 2020-04-15

    All you need is:

    Tab AT %IW400 : ARRAY[0..445] OF UINT;

     
  • bertrand42 - 2020-04-15

    yes the %IW400 is 446 length UINT, the pb is not the length, my first post indicates my problem

     
  • i-campbell

    i-campbell - 2020-04-15

    I am lost. What are you trying to do?

     
  • bertrand42 - 2020-04-15

    I created an FB with enter a pointer on an address %IW (that's why I use adr (%IW400)). I want to collect the values of %IW400 a %IW845 in an integer table

     

Log in to post a comment.