简体   繁体   中英

Cx programmer-Structured text, Array assignement

i'm learning structured text, to program with Cx-programmer, an Omron software.

i' ve looked around but i can't find a way to assign multiple element to an array, i've tried this soluion, but it doesn't work,

this is Arrays declaration(internals variables):

Name              Data type   Initial value
SenCheck_Array      BOOL[8]     FALSE       
SEN                 INT[2]       0          

Array of INT:

     SEN[1...2]:=[1,2];

Array of BOOL:

      SenCheck_Array[0...7] := [ S_LF,S_LS,S_LH2O,S_LO,S_Col ,S_BAR,S_TAP,S_ET ] ;

The error is the same:

ERROR:  Missing ]

i succeded in assigning element singularly, but i need to assign them in a single line.

Any help is apreciated:)

PS: i'm using cx programmer educational edition.

Edit: This example (showing the declaration part of the SCL block code) is only valid for Siemens PLCs.

To initialize an array the values must be separated by a comma without square brackets:

CONST
    // Constants
    S_LF := TRUE;
    S_LS := FALSE;
    S_LH2O := FALSE;
    S_LO := FALSE;
    S_Col := TRUE;
    S_BAR := TRUE;
    S_TAP := TRUE;
    S_ET  := TRUE;
END_CONST

VAR
    // Static Variables
    SEN: ARRAY[1..2] OF INT := 1, 2;
    SenCheck_Array: ARRAY[0..7] OF BOOL := S_LF, S_LS, S_LH2O, S_LO, S_Col , S_BAR, S_TAP, S_ET;
END_VAR

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM