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

Array of string definieren

2011-08-02
2011-08-03
  • rudolf-diesel - 2011-08-02

    Hallo codesys Speziallisten,
    ich will Displayteste in einen Array definieren. Leider kenn ich die syntax bei codesys nicht.

    Wo liegt der Fehler in meiner syntax?

    Text:= Array [1..2, 1..2] of String;

    Text:= (('AA', 'BB')
    ('CC', 'DD'));

    Gruß und Danke für eure Hilfe

     
  • Erik Böhm - 2011-08-02

    Moin

    Deklaration:

    strText: ARRAY[1..2,1..2] of String(20); <-- Das '=' fehlt und die Stringlänge ist definiert (Default sinds 80 Zeichen)

    Zugriff:

    strText[1,1] := 'Text 1,1';
    strText[1,2] := 'Text 1,2';
    strText[2,1] := 'Text 2,1';
    strText[2,2] := 'Text 2,2';

    Gruß Erik

    PS: F1 = Onlinehilfe

     
  • Tom2 - 2011-08-03

    ...du kannst auch bei der Deklaration schon das Array "befüllen"...

    DO_Name :       ARRAY [ 0..7 ] OF       STRING ( 30 ) :=        'Pumpe Solar' , 'Pumpe Warmwasser' , 'Pumpe Speicher' , 'Anzeige' ,
                                                                    'Reserve' ,     'Reserve' , 'Reserve' , 'Reserve' ;
    

    Grüße Tom

     

Log in to post a comment.