Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Axis in arrays

MartinH
2009-01-20
2009-02-11
  • MartinH - 2009-01-20

    Hi,

    I am new to CoDeSys but have done a fair bit of motion control in the past. I am using v2.3.9.4 and have four axis configured on a CAN Open Master as BL_Motion_IFA_V3004. I have had each of them working individually.

    I have defined them as an array to make the code tidier. I can get them all to enable, power up and report an error if I unplug the CAN, so the way I am addressing them appears to be ok. But...I can only get the first axis in the array to move, and this only when the other three are commented out of the code.

    If I change the code so there is only one axis it is only Axis[1] that I can get to move, the others (when using Read Axis Error) give ErrorID 65299.

    I am banging my head against the wall. I would like to remain using an array as otherwise I will have to repeat the code four times over to enable and check my axis.

    Anyone any ideas?

    Cheers in advance,

            Martin.
    
     

    Related

    Talk.ru: 1

  • B.Roth - 2009-01-23

    Hello Martin,

    this is the meaning of the error-message:

    16#FF13 65299 Sub-index does not exist

    with which function-blocks do you try to move the axis?

    General it is not a problem to use an array of Axis and also to use array of FBs in a loop.

    please send your application to our hotline:

    e hotline-motion@de.schneider-electric.com e

    we will check and help you

    Bruno Roth

     
  • MartinH - 2009-01-26

    Here is a cut down copy of my code. The Checking program appears to work but in Cycle_1 I can only get Axis[1] to work, and non of the others. I have since given up and done a long winded version, but it would be nice to get back to using arrays.

    Thanks for you interest, Martin.

    FourAxis2.pro [92.29 KiB]

     
  • mghosh79 - 2009-02-11

    You might be going into an endless loop.

    Try to guard your FOR loop using additional conditions

    , for example :


    IF bStart THEN

    Counter := 0;

    FOR iVar_1 :=1 TO 10 BY 1 DO
    
            Var1:=Var1+2;
    
    
    
            IF bInit THEN
    
                Counter := Counter + 1;
    
            END_IF
    
    END_FOR;
    

    END_IF


    Else , use a DO WHILE loop.

    Hope it helps.

     

Log in to post a comment.