Are there any push bottons that are momentary. I need a button that I can use to momentarily set a bit in a PLC with out having to add logic to get the PLC to reset the bit. ie. start/stop a motor with a start button and a stop button. Thanks


There is no button that is inherently momentary but you can very easily construct one. Follow these steps:

  1. Create or identify a SQLTag that is linked to the PLC bit register through FactorySQL

  2. Place a button on a window. (I would suggest a 2-state toggle button as this will provide very vivid feedback once properly configured, but any object that has the mousePressed and mouseReleased events will work.)

  3. Right click the button and select Configure Actions (Ctrl-J)

  4. Under the event tree on the left-hand side, expand the mouse node

  5. Select mousePressed on the left and then the Set Tag Value tab on the right.

  6. Select the Set Tag Value radio button.

  7. Enter the SQLTag reference in the Set This Tag textbox.

  8. Enter a value of 1 in the To This Value textbox.

  9. Select mouseReleased on the left and then the Set Tag Value tab on the right.

  10. Repeat steps 6 & 7 above.

  11. Enter a value of 0 in the To This Value textbox.

This will set the bit when the button is pressed and reset it when the button is released.

To animate the button, link the button’s Current State property to the SQLTag you used above. This will toggle the button’s color in direct relation to the SQLTag value.

I would also recommend altering your PLC code to reset this bit at the end of every scan in the rare, but possible, case that the bit is set but not reset because of communication errors.

There actually is a button that does this - its called the Timer Button. It sets a bit on press, and then resets it some time later (like 2 seconds later). You could also make your own that worked on mousePress and mouseRelease like suggested above.

Either of these aproaches is a little bit dangerous, though, because they rely on timing to be effective.

Learned something new again… :blush:

I’ve tried using the mouse pressed and release. It works ok, but it throws up an error message. It says something like, a newer value written.

Thats an error that FactorySQL gave you in versions earlier than 4.0.3 when it received more than 1 write requests for the same OPC address very quickly. FactorySQL now simply writes all of your requests in order. What version of FactorySQL are you using?

Looks like I am using v4.0.0
Is there a newer version to download on your web site?

I upgraded the factory SQL and it did take care of the error message.