User-Defined Data Types

martino
2012-10-15
2012-10-16
  • martino - 2012-10-15

    I'm very new to Structured Text and dealing with user-defined data types. I've looked online and on the codesys manual, and from what i've read, it seems like this should work:

    TYPE HistoryArr :
    STRUCT
    BaseRequested:REAL;
    BaseActual:REAL;
    AngleRequested:REAL;
    AngleActual:REAL;
    DateAndTime:DT;
    END_STRUCT
    END_TYPE

    Codesys wants me to declare HistoryArr.. What type would I declare this as? eg. WORD, INT, etc

     
  • shooter - 2012-10-16

    in your POU you say :
    VAR
    history array[1..10] of Historyarr;
    END_VAR

    in the ST you write for example

    history[1].anglerequested :=setangle;

    it works the same as when you say array of INT but now the whole structure can be used.

     

    Related

    Talk.ru: 1

  • martino - 2012-10-16

    Thanks, This helps a lot
    Also I should note that I was declaring the TYPE and STRUCT in the ST code, but realized I was supposed to add it in the Data Types Tab

     

Log in to post a comment.