Hi
I had situation like on picture (sorry, i've lost screenshot from online connection), what is the reason that bit DB1.DBX0.3 was always in true, even though bit is reset in the same network. Variable DB1.DBX0.3 is used only in this network. Bit DB1.DBX0.3 is set by HMI, by pressing button (event Release).
Can somebody explain me, what could cause this strange behavior of plc program.
Program was corrected by throw away instruction P_TRIG
Hardware configuration is S7-1200 (V2.0) and touch panel KTP600 Basic mono.
I can think of a couple of ways this can happen, or more than a couple actually.
1. Least likely: somewhere you move a value into DB1.DBB0 divisible by 3.
2. More likely: most HMI panels set or reset with a certain amount of persistence from the PLC program's point of view. The program is responsible to reset the bit similar to what your image shows after detecting it was pressed.
3. Most likely, something else in the logic processed after network 12 (maybe in another FB/FC/OB) is turning the bit back on with a -(S)-
One way that seems more HMI manufacturer independent is to use a P-TRIG and ADD on each press of a button to generate a toggle action.
btn
-||---|p|----[ADD 1->X]---- // increment button state count
-[X==2]---[MOV 0->X]-- // detect toggle back to off from on
-[X==0]---(R)-- // reset plc_button_bit
-[X==1]---(S)-- // set plc_button_bit
plc_btn_bit
-------||------------[take action for button ON]--
plc_btn_bit
-------|/|-----------[take action for button OFF]--
I have yet to run across a PLC / HMI combo that does not handle this extremely well. There are no order of solve problems, and it is easy to troubleshoot. Push the button, increment the count. You can use the count or the button bit in the plc to set the values displayed on the button as well.
An FB to handle hmi button toggles like this works great so you only write the logic once
Helpful? Rate it.
Solved? Post it.