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

    How to deal with arrays ?

    Scheduled Pinned Locked Moved Mervis
    4 Posts 2 Posters 1.3k Views
    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áčekM 1 Reply Last reply
      Reply Quote 0
      • Martin KudláčekM
        Martin Kudláček @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áčekM 1 Reply Last reply
          Reply Quote 0
          • Martin KudláčekM
            Martin Kudláček @ayone0518
            last edited by

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

            Best regards,
            Martin

            1 Reply Last reply
            Reply Quote 0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • First post
              Last post