• Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    How to deal with arrays ?

    Mervis
    2
    4
    348
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      ayone0518 last edited by

      Hello,
      I have questions about arrays to pass to ST programs and FBD programs.

      1. how to declare arrays on MervisIDE, such as MyVariables ARRAY[0..10] on INT ? I do not see any array related type in pull downs.
      2. according to my case, Mervis has specific array type of int, MultiIoInt data type. Are you supposed me to use this type when I want use array of integer ?

      thank you.

      Martin Kudláček 1 Reply Last reply Reply Quote 0
      • Martin Kudláček
        Martin Kudláček administrators @ayone0518 last edited by

        Hello @ayone0518,

        1. You almost got it right. The definition is this:
        VAR
           my_array: ARRAY[0..10] OF INT;
           my_prefilled_array: ARRAY[0..2] OF REAL := [ 1.123, 2.345, 3.456 ];
        END_VAR
        
        1. Since this is the first time I hear of this then no, use the standard ST definition :-)

        Best regards,
        Martin

        1 Reply Last reply Reply Quote 0
        • A
          ayone0518 last edited by

          Thank you Martin.
          I have one more question.
          Can I declare array as local variable on Mervis FBD UI ?
          It seems I can't do this on it.

          Martin Kudláček 1 Reply Last reply Reply Quote 0
          • Martin Kudláček
            Martin Kudláček administrators @ayone0518 last edited by

            Hello @ayone0518,
            no, the arrays cannot be defined in FBD.

            Best regards,
            Martin

            1 Reply Last reply Reply Quote 0
            • First post
              Last post