@Giamba or maybe @Martin-Kudláček, i'm using this program to control my dali controler which working fine now except from the switch function.
When i push my my mometary switch on HMI and keep pushing it the light slowly increases or decreases at the next push. That's all working fine. But the switch function does work fine trough the g on the sel_0. Only problem is that when i start the plc the light is off (is ok) but the input on sel_0 is true so that results in no output on the sel_0. When i keep pushing the switch on the hmi the light increases on the output of the b30 counter but not on the output of the sel_0. Only when i realease the button the sel_0 output wil be the same as the output on the BD30 counter. After the sel_0 is high on the output and the lamp is on. i can switch the lamp on/off with a short push, no problem.
What i need is : Long push > increase or decrease light (even if the plc is just turned on) short push > turn light on/off.
Can anyone help me with this funtion to work fine?

Many regrards,