Wincc flexible button (help)

Avatar_41

Member
Join Date
Aug 2019
Location
Istanbul
Posts
96
Hello to everyone. I change the value of a "PQW" with a button in Wincc flexible. The code of the button is defined as M102.0. Value reset address is defined as M101.2. What I want is that when I press the button, the value (8) I set is transferred to "PQW", and when I take my hand off the button, the "PQW" value is "0". I tried a lot, but the value sometimes changes in a ridiculous way, but most of the time it doesn't, I couldn't make sense of it. I guess something is wrong or missing on the HMI or the code but I don't quite understand. Can you please help? Or can you suggest alternative solutions? The 1st image is the code I wrote, the 2nd image is the button Press feature, the 3rd image is the button release feature.
I've added the 4th picture to be more descriptive

Ekran Alıntısı 1_102548.PNG Ekran Alıntısı 2_102516.PNG Ekran Alıntısı3_102526.PNG IMG_20220508_003522.png
 
Last edited:
This is a general answer.


The PLC reads the HMI tags in cycles, every so many milliseconds or seconds. So what value will those tags have between reads?


Which PLC, which HMI, which Platform, which version?
 
This is a general answer.


The PLC reads the HMI tags in cycles, every so many milliseconds or seconds. So what value will those tags have between reads?


Which PLC, which HMI, which Platform, which version?

values ​​are 100ms. is set to.
CPU 315-2 pn/dp
HMI multi panel 277-8'touch
Simatic maneger v5.5
 
Hi guys. I don't do this job professionally and I don't make any money. I just want to learn. I asked if you could offer alternative solutions for this, Actually. I have reviewed a project before and PQW was used there, I do not know exactly what the difference is with QW. How can I do what I want? is there anyone who can give information about it?
 
I do not work at all with Instruction List so this just a guess, you want to load the value 8 when a physical input AND an HMI button is pressed.
I understand that you want the value 8 to be transferred to PQW for as long as an HMI button is pressed, doing that in real time is a problem. You need to buffer the event/value to produce consistent output. The PLC writes to the *peripheral* output every scan, hopefully only once, while it reads the value every 100ms so if the scan is 10ms it needs to have the same value for 10 scans before it reads the button press again to update the value.

Have the button press event copy the value to memory and the button release copy 0, and write from that memory to the output. In that case writing to PQW is pointless but OK, just beats the purpose of immediate write.
PQW addresses the output directly and QW addresses the "process image" which is updated every cycle.

Edit: buffering the button event means latching/unlatching the bit.

I replied on my phone so typos and other mistakes are possible.
 
Last edited:
Sorry, I couldn't see your scrrenshots all that well on my phone. I now see you are suing Setbit for your button event.



Am I reading the code correctly, you are setting and resetting both bits at the same time?
What will happen if I0.2 is true while M102.0 and M101.2 are set?
 
Last edited:
I would only write 1s to memory from the HMI-driven bits, and have the PLC assign the value of 0 when the PLC detects the 1. That is called "Set and forget."


So, in your case:

  • SET: HMI button press triggers a write of a 1 to M102.0
    • FORGET: HMI never writes a 0 to M102.0 e.g. on the button release
  • PLC Network 3
    • detects 1 in M102.0 AND I10.2, and
    • does not follow the JNB, and
    • writes the 8 to the PQW, and
    • writes a 0 into M102.0,
      • because the HMI FORGETs about M102.0 after the button press
  • SET: HMI Button release triggers a write of a 1 to M101.2
    • FORGET: HMI never writes a 0 to M101.2
  • PLC Network 4
    • detects 1 in M101.2, and
    • does not follow the JNB, and
    • writes the 0 to the PQW, and
    • writes a 0 into M101.2
      • because the HMI FORGETs about M101.2 after the button press
 
Update: it might be better to not reset the value of M102.0 to 0 in Network 3 if M102.0 is 1 and I10.2 is also 1, but do that reset that in Network 4 on the button release. However, we will want to reset the value of M102.0 on Network 3 if I10.2 is 0.


E.g. Network 3 could be like this:

Code:
      A     "Robot_EPS_on_HMI"         M102.0
      JNB   _002
      A     "Robot Home Pozisyonda"    I10.2
      JNB   _004
      L     8
      CAW
      T     PQW   13
      JU    _002
_004: R     "Robot_EPS_on_HMI"         M102.0
_002: NOP   0
Network 4 would need to have [R M102.0] and [R M101.2] instructions added after the CAW and before label _003.


Caveats

  • I do not know STL well, so there may be errors in the above, but I hope the general approach is obvious
    • i.e. set and forget
    • i.e. for HMI target bits, HMI writes 1s; PLC writes 0s.
  • The [JNB _002] is not necessary, it only prevents clearing the value of M102.0 to 0 when it is already 0
  • I assume [R ... M102.0] is how to assign 0 to the value of M102.0.
 

Similar Topics

I have attached a screen shot of Button Event in WinCC flexible project . I understand when the button is clicked EX_RT_11_12_Visibilty will be...
Replies
1
Views
1,545
Hi all, Looking for some guidance on how to set up passwording a button. Have tried everything but it fails to work. Know I'm missing something...
Replies
17
Views
5,964
I need to log a collection of data on the press of a button, I'm not finding the help files particularly useful for what i'm trying to achieve. I...
Replies
6
Views
4,815
I've created an alarm list, and when new alarms come in they blink until they are acknowledged and removed when operator resets. At the top of the...
Replies
5
Views
4,716
Hi, Im sitting here trying to create my own buttons and click able pictures in WinCC.. But im getting really tired of this now.. there is no...
Replies
0
Views
3,528
Back
Top Bottom