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

    Simple project and IF command

    Mervis
    2
    4
    1584
    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.
    • W
      wizro_pl last edited by wizro_pl

      HI,

      Is there possible to use IF in simple project program .fbd
      For example in .ST code it looks:

      PROGRAM main
      	
      	INIT
      		vars.moje:=FALSE; //its external variable
      	END_INIT
      
      (*program's body*)
      
      IF (vars.moje<>hw.$Neuron L20x_DI_3.09$) THEN
      	vars.moje:=hw.$Neuron L20x_DI_3.09$;
      	hw.$Neuron L20x_RO_2.01$ := hw.$Neuron L20x_DI_3.09$;
      
      END_IF;
      
      
      END_PROGRAM
      

      how to use IF in program .fbd ? (why is not possible to add .st program in simple project? in previus version it was possible).

      IF is really useful when you want to use MERVIS and MODBUS (controlled also from other application i.e. Domoticz.) in the same time.

      best regards,
      Dariusz

      T 1 Reply Last reply Reply Quote 0
      • T
        tomas_hora administrators @wizro_pl last edited by

        @wizro_pl ST stands for Structured Text, a 'programming language' for PLCs. I suggest taking a look at the help in Mervis or a online tutorial or at least wiki.

        Did you define correct type of your variable? What is the error that IDE throws?

        1 Reply Last reply Reply Quote 0
        • W
          wizro_pl last edited by

          This program is ok as a .st.
          The question is how to use IF in program type .fbd when you using wizard mode and function blocks.
          I didn't find any block called IF. All of block need to set something but in my case I want to set variable only when condition is met.

          in this example relay output is set only when input was changed. In this scenario I could change a state of relay RO_2.01 also from MODBUS and Mervis will leave this change until input DI_3.09 isn't change.

          I would like to have this same functionality when I'm using SIMPLE PROJECT and BLOCKS. Is it possible ? Which block should I use? I coudn't find block "IF".
          0_1484576387868_upload-8016a43c-5710-4b33-9ff7-ffe46847e13b

          It is s the way how I tried to find workaround but without results.
          When I set RO_2.01 thru the MODBUS immediately MERVIS override this state.

          T 1 Reply Last reply Reply Quote 0
          • T
            tomas_hora administrators @wizro_pl last edited by

            @wizro_pl Ok, sorry now I understand. You can use any of the comparsion functions (taken from the help): GT > decreasing sequence, GE >= Monotonous decreasing sequence, EQ = Equality ,LE <= Monotonous increasing sequence, LT < Increasing sequence, NE <> Inequality

            Writing your own function blocks is taken as a advanced function so the user actually know what is doing. But actually the only thing that is simple mode doing is that it automatically generates variable, which you can do also by right click on the device using the autogen.

            Of course Mervis changes that. You have to choose which is the default access to the IOs. It is not a good idea to control output from two points without letting know each other about the change. But if you really want to, you can set the variable to be written only on change (right click on the device on the modbus channel and make custom).

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