Double Click

itjustme

Member
Join Date
Mar 2024
Location
Dallas
Posts
4
What is the simples way to do a double click of a button in a ladder logic. New here and I hope this has not been asked before.
 
First check to see if the HMI supports the double click event. Use that if it does.

I think I would use a sequencer. From a waiting state, look for a transition on from the HMI button to drive the sequencer to the next step.
From that step, look for a transition off from the HMI button to drive the sequencer to the next step.
From that step, look for a transition on from the HMI button to drive the sequencer to the next step, which will trigger whatever the double click is supposed to.
From that step, look for a transition off from the HMI button, to drive the sequencer to the waiting state.
There should be a watchdog timer to revert to waiting state if the sequence stays too long out of the waiting state.

That's an outline of how you might do it from an HMI button. Given the very real possibility of double events with a hard-wired button, it would hard to unambiguously implement one for that case unless you specified a rather long period between the two clicks.
 
using a AB PicoSoft PLC unit
looking to act like a double click on your mouse on a Banner Optical Touch Button for the output command
 
The basic principle will be to detect the rising edge of the discrete input twice within a set amount of time.

So if the PLC supports rising edge contact or oneshot instructions, use that to start a timer and a counter. Keep the timer running while it is timing, when the timer is done, reset the counter. Set the counter preset to 2. If the counter gets done, then the button was tapped twice, so you can use the counter done bit to drive the subsequent action.

How to implement that logic with your controller, I will have to leave to folks who have experience with it.
 
The problem with trying to capture a double click from a hard-wired input is that quite often you get multiple input events without realizing it. That's due to a phenomenon known as contact bounce. Search the forum for threads on the subject of "debounce inputs". If you were to look at the input signal with an oscilloscope you might see several voltage spikes each time a pushbutton gets pressed. Any of those spikes together with the troughs between them could be enough to register as separate pushbutton events. So your logic will need to filter out those false positives.
 
Generate a one shot on the button click
First click starts a short timer. Timer latches itself. If timer is timing and button pressed again on a One shot Rising, then output your double click bit. Put the output bit rung before the timer rung. You can break the latch on the timer also with the double click bit.

So xic button ONS OTE button_click
Xic button click xic button_TMR.TT OTE button_double_click
Xic button click xio button_double_click TON button_TMR, latch the xic button_Click with button_TMR.TT

Similar to Okie, but no counter needed
 
Don't need to latch a ton, use a tof.

This is the same as a two-hand button set, isn't it?
No. It's one button he want's to press twice, like double clicking a mouse.

I personally can't see a reason in automation to do that, especially with an Opto-Touch button, which are primarily used for Cycle Starting. Then again, I'm not the OP and have no clue as his purpose.

I also haven't seen a Pico (programmable relay) in many years. In fact, the only one I ever saw, I replaced with a ML1100. It fried and was also discontinued.

In a pinch, I have used one button with a counter to do two functions, but that was soon fixed.
 
Whichever type of timer used, the logic suggested by @robertmee is more or less the same; see the attached image. This assumes the "clicked" bit, B3:0/0 in the image, is a Set-and-Forget bit written with a value of 1 from an HMI, and the code clears its value to 0 to make it a one-shot; I am emulating the HMI by writing a 1 to B3:0.0 in online mode. For a physical button driving a PLC input, then run that input through a one-shot/rising-edge/pulse instruction and use the output of that instruction, as noted by @robertmee.

Caveats/Comments
  • The code in the image only counts double clicks; an actual process might do something else with the detection
  • The timer preset of 500ms, to detect the second click, is notional
  • Third and subsequent clicks beyond the second while the timers are still timing will be detected as additional double-clicks
    • This would require additional logic to prevent, if necessary
    • The TON case is simpler to fix as the detected double-click could reset the timer, although the TOF case is certainly doable
  • A physical input might require additional logic
    • I.e. to ensure a single press with bounce is not detected as a double-click
  • Detecting short vs. long presses might be preferable to single vs. double clicks
    • Input bounce still needs to be dealt with as now it causes a false short-press detection
 

Attachments

  • Untitled.png
    Untitled.png
    47 KB · Views: 12
Here is a simple one, the double click is a oneshot so only on for one scan if you need that bit sent to an HMI then you may have to latch it & either reset it with a timer or some other method as because it's only on for one scan the coms to/from the HMI may not see it. You could also do it with a counter set to a value of 2
 

Attachments

  • double click.png
    double click.png
    51.2 KB · Views: 12

Similar Topics

Hello. I have been working on my first plc project for a while now. I just ordered all the parts that I need and before I did that, I created the...
Replies
10
Views
2,035
Is there a simpler way to express a double click pattern in ladder-logic? Goals are: 1. One input X1 should trigger either output Y1 or output...
Replies
8
Views
2,896
I am using Step 7. I have to double click on the motion button to get it to work. The motion is a buffer stop, pretty simple. But the motion will...
Replies
1
Views
1,253
Hey guys. I've got a very simple command I want to run that needs to be in VB code. I want to trigger it when an item in a listbox is...
Replies
2
Views
2,916
i have direct logic 105 w/ a usb-serial cable with which i am trying to control led lights but i can't get dslaunch to open when i d-click the...
Replies
3
Views
1,671
Back
Top Bottom