Welp, I’m probably doing something stupid here, but this one has had me scratching my head for a couple days now. PLC I’m using is a ClickPLC with modbus TCP. I’m controlling a coil address, CXXXX using a momentary button in Ignition 7.9.3. I’m watching my control value change from 0 to 1 to 0 in the properties after pressing said button, and it’s turning the desired bit in my plc on. But the bit stays on, latched on.
In the Component Scripting of my momentary button, under the tab ‘Set Tag Value’, I am setting the desired tag I want to control. And setting it to the value of the button’s control value. Before this, I simply had it set to a value of 1. Neither will work correctly.
I mean…this should work…it shouldn’t be this trivial to get a predefined momentary button in the software to act as momentary button…is this a PLC issue maybe?? Or maybe I’m screwing up something modbus-wise…
Momentary buttons are minefields when using any query-response communication protocol. Such buttons must send a message to turn on the target when pressed, then send a separate message to turn off the target when released. Put those messages close together and you risk the underlying driver’s optimization (and possible lack of write verification) stomping on one message or the other. And the non-zero risk of packet loss / comm link breakage between one and the next.
In the short term, the best you can do is lengthen the minimum hold time to ensure the latter message is sufficiently later than the first to allow the first message to be fully processed and read back.
In the long term, you need to consider rewriting the PLC code to accept a set-tag operation that it clears itself. If you need reliable momentary operation, you need an arrangement that will transmit set-tag operations on a repeating interval, with the PLC noticing when they stop.
All modern PLCs use such protocols for their locally networked I/O gear, with repeating UDP packets or raw Ethernet frames, specifically because of this problem.
Thank you, I appreciate the response. I will try lengthening the minimum hold time for my button.
I still find it odd that the bit doesn’t actually get turned on till after I release the button. When the button is pressed, my control value is 1, bit in PLC is off. Release the button and the control value goes to zero, and at the same time the bit goes high. At first glance this made me think that maybe there was something I was goofing up.
Maybe this can all just be chalked up to comm issues I guess.
I have a simple standard momentary PB that works fine. The Control Value and Indicator Value are bound to a Boolean tag in a ControlLogix processor. On button click the value is pulsed on and then off in the plc as desired.
But I also wanted the button to close its popup window when clicked. So I went to the component scripting of the button and did a close window on actionPerformed. This broke the momentary pulse functionality. Now the button latches on the plc tag.
Momentary buttons are extraordinarily dangerous for a variety of reasons, but you’ve found a tricky one. On most platforms, the ‘mouse pressed’ event also triggers actionPerformed, so the window closes and shuts down the button before the ‘mouse released’ event occurs. The component therefore never gets a chance to send the separate message to reset the bit.
Consider replacing this momentary button with a standard button that simply sets the bit in its actionPerformed routine, just before closing the window, and letting the PLC reset it itself. Or for a more robust operation, increment an SINT tag (with odometer-style rollover) and have the PLC check for equality with a copy of it. Perform your logic in the PLC immediately after updating the copy. It is always best if any given coil or register is only written by one piece of logic.