Simple Single Button Latch/Unlatch "Circuit"?

fischeral

Member
Join Date
May 2015
Location
Colorado
Posts
4
I've used the simple momentary switch toggle logic for a few decades now. Now I need to find logic that allows the toggling to latch/unlatch a bit, while allowing emergency conditions to override/overwrite the toggles bit. And when the emergency condition is remedied, allow it to be toggled again and resume operation.

I've played with AND'ing and XOR'ing but these restart without the switch push. I considered "Lancies Alternators" but did not recognize a good solution there.

Any simple or elegant suggestions out there?
 
What PLC?

In general, for AB PLC's I use

XIC TheButton ONS TriggerOS BST XIO ToggleBit OTL ToggleBit OTE Dummy NXB XIO Dummy OTU ToggleBit BND

Then you just use a rung below it to forcibly unlatch for whatever conditions you want it to unlatch at.

The dummy bit doesn't have to be unique in the program, as it is only for in-run logic. The others must be unique.
 
Please let me waffle on about how I do boolean algebra.

Identify your inputs

A = rising edge of button I (debounce done elsewhere)
B = Previous State of output
C = override on
D = override off (Highest Priority)

Odentify your outputs
Q = output

Do a truth table

Code:
A B C D | Q
-----------
0 0 0 0 | 0
0 0 0 1 | 0
0 0 1 0 | 1
0 0 1 1 | 0
0 1 0 0 | 1
0 1 0 1 | 0
0 1 1 0 | 1
0 1 1 1 | 0
1 0 0 0 | 1
1 0 0 1 | 0
1 0 1 0 | 1
1 0 1 1 | 0
1 1 0 0 | 0
1 1 0 1 | 0
1 1 1 0 | 1
1 1 1 1 | 0

convert to karnaugh map
Code:
          CD
      00 01 11 10
     ------------
   00| 0  0  0  1
AB 01| 1  0  0  1
   11| 0  0  0  1
   10| 1  0  0  1

Now try to circle the bigest rectangles of 1s, so that all ones are in a circle. you can wrap around the bord like a ninja if you wish. In the above, I can circle a 1x4 rectange, and 2 2*1 rectangles.
convert your circles to boolean algebra

Code:
Q = (C AND NOT D) OR (NOT A AND B AND NOT D) OR (A AND NOT B AND NOT D)

you can stuff around with boolean algebra if you like to try and simplify, but the above works and is easy to implement with ladder. Note that B = Q, A = rising edge of I

Code:
 I                      A
XIC-ONS----------------OTE

 C   D                  Q
XIC-XIO----------------OTE
 A   Q   D   |
XIO-XIC-XIO--|
 A   Q   D   |
XIC-XIO-XIO--|
 
Note that in the above, I probably would have taken the XIO D, which is common to all branches, and put it after the branch.

Code:
 I                      A
XIC-ONS----------------OTE

 C              D       Q
XIC------------XIO-----OTE
 A   Q       |
XIO-XIC------|
 A   Q       |
XIC-XIO------|
 
First my apologies for my delayed response to all your considered replies, the plague struck the family. I will be testing out the suggestions on my AB 1500's. Thanks for waffling on, I rather enjoy listening to how experts think. A
 
AustralIan, that was very informative. I've never looked at logic with this boolean algebraic approach. I saved your post and look forward to applying it when i need it. Thank you.
 
Example of how I do on/off toggles. I know you said you had AB 1500's so just put an example of a bit you would use in logix500 for the permissive, and on command.

toggle1.jpg toggle2.jpg
 
The subject of toggling a bit with a single push-button has been discussed "at length" in many previous posts.

What many of the solutions suffer from is that the state of the bit may not be maintained during a power-cycle or mode-change of the PLC. Various manufacturers use different methods to achieve this.

In the Allen-Bradley world, all "non-retentive" (output) bits in a program are cleared during a "pre-scan", so any solution using OTE's to drive the toggled bit will surely fail to maintain its "on" state during a power-cycle.

Now some may argue that toggled bits should not be maintained on after a power-cycle, but my argument is that the PLC system should not be making that decision, it is up to the programmer to decide which toggled bits should stay on, and which should be reset.

By far the simplest method of achieving this, and it doesn't need any fancy logic, is to use a COUNTER, driven directly by the push-button, the necessary one-shot of the push-button is inherent in the way the counter works. A counter is not reset at power-on, its data is "retentive".

Bit 0 of the counter's accumulator value is the toggled bit, since the counter alternately goes odd/even. The programmer can then decide whether he wants to retain the toggled bit through a power-cycle, or any other reason (E.Stop, etc.). If he wants it retained, he does nothing, if he wants it reset, he programs a RES instruction to reset the counter whenever he wants it reset.

Using a counter means the same "toggle" logic is used throughout the program, regardless of whether retention is either required, or not.

2017-04-06_113309.jpg
 
Please clarify your statement.

no machine is allowed to resume production after an e-stop condition,
NFPA79 and oshe regs.

When you state emergency conditions, what do you mean?

you must get with safety, engineering, maintenance, production and do a risk assessment.

Pressing a stop button to stop the automatic cycle is no issue, press start to restart.

When you say emergency condition, that's totally different.
you must identify what has happened, what the machine status is, part status,
maintenance that must be done and safety procedures, injury risk during maintenance, how to restart the machine, start up risk.

a risk assessment must be done for every condition, it' not as simple as you stated.

james
 
Please clarify your statement.

no machine is allowed to resume production after an e-stop condition,
NFPA79 and oshe regs.

When you state emergency conditions, what do you mean?

you must get with safety, engineering, maintenance, production and do a risk assessment.

Pressing a stop button to stop the automatic cycle is no issue, press start to restart.

When you say emergency condition, that's totally different.
you must identify what has happened, what the machine status is, part status,
maintenance that must be done and safety procedures, injury risk during maintenance, how to restart the machine, start up risk.

a risk assessment must be done for every condition, it' not as simple as you stated.

james

I was talking in general about toggled bits - not "Start/Stop" controls. I don't like "toggled bits" controlling my machine per se, but there are occasions when a toggled bit needs to be reset on power-cycle, and occasions where they must not be.

Of course there is more to it, my posted method isn't everything, just the core of what is required in a real application.

I was simply offering a solution where the PLC does not reset toggled bits as part of its "start-up" procedures, leaving the programmer to make the decision, based on what each toggled bit is used for, the risk assessments are done, and their job as programmer is to make the code fit the specifications, etc.

Many people don't even consider what happens when "the lights go out", and how the PLC recovers from the situation, they just take a "healthy" status from their external safety/e.stop circuits, and allow operators to re-start the process or machine. As an example, if an operator is allowed to turn cooling water spray off and on at will, e.g. for visual ispection, then that bit should be retained through a power-cycle.

There are other, some say better, ways to turn something ON and OFF from a HMI, for example, programming 2 buttons that are inversely enabled from the state of the bit that is turned on and off - this is not "toggling" from the same button, so you can easily use Latch and Unlatch instructions from the 2 buttons. Most PLCs remember the state of latched bits on power-cycle.

All I'm saying is that if toggled bits are used, and I'm not even suggesting that they should be, then the PLC should not interfere with the state of them - the program should remember everything from where the power went off.
 
Last edited:

Similar Topics

I need to have an array tag that contains string data from a csv file. The csv file needs to be imported once per day. Is there any simple way to...
Replies
3
Views
1,797
Hi all, Writng a FB in ST on Beckhoff TC for a pulser which turns on and off on a cycle, is paused by turning bControlInput to FALSE, but resumes...
Replies
4
Views
103
I'm trying to build my Classic Step 7 programming skills this weekend. I get stuck on little things that are not covered in YouTube tutorials. I'm...
Replies
7
Views
248
I have a program that does a 7 second "scan" sensor calibration routine whenever a setting (setting is called assistance level or "AL" and ranges...
Replies
3
Views
174
Hi all, I have a simple question that I have overcomplicated and gotten stuck on. I have a variable, we can call it "light" that I need to stay...
Replies
4
Views
216
Back
Top Bottom