Author Topic: How To Emulate a Momentary Button  (Read 2692 times)

usapatriotforlife

  • Newbie
  • *
  • Posts: 39
    • View Profile
How To Emulate a Momentary Button
« on: September 24, 2013, 12:21:36 AM »
I have an address called "Alarms_Clear_DAQ" in a PLC.  When I view the PLCAddressValue in a basic label it shows as "FALSE".  The PLC is programmed to clear an alarm bit in another register when Alarms_Clear_DAQ is momentarily set and then cleared.  Everything works as expected if I put a MomentaryButton on to my form, make sure output type is set to "MomentarySet", put "Alarms_Clear_DAQ" for the PLCAddressClick value, and then click the MomentaryButton with the mouse.

However, I want to simulate clearing that value in code and not with a button that has to be clicked.  What is the best way to simulate a Momentary button in code?  Thanks.

(I've tried using a basiclabel with PLCAddressValue set to "Alarms_Clear_DAQ" and a timer control set to 300 ms.  I thought I could just set "basiclable1.value = "True" and then after the timer "ticked", set it back to "False", but that didn't work in my testing.)

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: How To Emulate a Momentary Button
« Reply #1 on: September 24, 2013, 02:55:25 AM »
The most reliable way would be to set the bit in code, then unlatch/reset it in the PLC:

EthernetIPforCLXCom1.write("Alarms_Clear_DAQ",1)

usapatriotforlife

  • Newbie
  • *
  • Posts: 39
    • View Profile
Re: How To Emulate a Momentary Button
« Reply #2 on: September 24, 2013, 07:17:42 AM »
Thank you. I will try that today. 

usapatriotforlife

  • Newbie
  • *
  • Posts: 39
    • View Profile
Re: How To Emulate a Momentary Button
« Reply #3 on: September 25, 2013, 08:54:38 PM »
Archie,

Your suggestion worked perfectly.  Thank you so much for all of your help.