Signals array

  • Hello fellas. I Have 4 output signals ($OUT[9], $OUT[10], $OUT[11], $OUT[12]). I use This signals with FOR statement. IT looks like:

    FOR i=1 TO 4

    $OUT[8+i] = TRUE


    I'm trying add This signals to array.

    SIGNALS[1] = $OUT[9]

    SIGNALS[2] = $OUT[10]

    SIGNALS[3] = $OUT[11]

    SIGNALS[4] = $OUT[12]

    Because I want get something like that:

    FOR i=1 TO 4



    But I dont know, which Type of array i must declared. Im trying BOOL but IT doesnt worka. Can anyone help me? Or IT is imposible?

  • AD
  • of course it does not work, that does not exist in KRL

    you can simply create another SIGNAL in addition to what you have, for example

    ; individual signals

    SIGNAL Bit0 $OUT[30]

    SIGNAL Bit1 $OUT[31]

    SIGNAL Bit2 $OUT[32]

    SIGNAL Bit3 $OUT[33]

    ; group signal

    SIGNAL Bits_0to3 $OUT[30] TO $OUT[33]

    then you can set or reset them one at a time using individual signals, or you can write to all of them at once using group signals such as

    Bits_0to3 = 0 ; reset all four outputs

    Bits_0to3 = 15 ; set all four outputs high
    Bits_0to3 = 9 ; set mixed data to outputs

    or in binary which is clearer in this case:

    Bits_0to3 = 'B0000' ; reset all four outputs

    Bits_0to3 = 'B1111' ; set all four outputs high

    Bits_0to3 = 'B1001' ; set mixed data to outputs

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account
Sign up for a new account in our community. It's easy!
Register a new account
Sign in
Already have an account? Sign in here.
Sign in Now