CODESYS ST syntax question

aliazzz
2018-10-07
2018-10-07
  • aliazzz

    aliazzz - 2018-10-07

    Hi There!

    The following code seem clean and legal...

    FOR uiDiCh := 0 TO cuiMaxAmmount DO
    Β  Β axDInValue[uiDiCh] := THIS^._abyIntRxBuf[7].uiDiCh;
    END_FOR
    

    But the compiler states that bitaccess (_abyIntRxBuf[7].xyz) a literal or symbolic integer constant...
    Thus, I have to rewrite the code into;

    Β  Β axDInValue[0] := THIS^._abyIntRxBuf[7].0;
    Β  Β axDInValue[1] := THIS^._abyIntRxBuf[7].1;
    Β  Β axDInValue[2] := THIS^._abyIntRxBuf[7].2;
    Β  Β axDInValue[3] := THIS^._abyIntRxBuf[7].3;
    Β  Β ..
    

    Has someone got any suggestions to solve this in a few lines of code instead of copying it the "dumb" way?

     

    Related

    Talk.ru: 1
    Talk.ru: 2
    Talk.ru: 3
    Talk.ru: 7

  • josepmariarams - 2018-10-07

    Axdinvalue[0]:=(_abyintrxbufer[7] and shl(1,i))<>0)

    Sent from my Moto G (5S) Plus using Tapatalk

     

    Related

    Talk.ru: 7

  • aliazzz

    aliazzz - 2018-10-07

    NICE => the anwser is always easy in hindsight....

     

Log in to post a comment.