Simple project and IF command
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.
Did you define correct type of your variable? What is the error that IDE throws?
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".
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.
@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).