start/stop using one push button

james84

Member
Join Date
Apr 2010
Location
melbourne
Posts
16
hi guys,

i have just started learning plc programming and stuck with one tutorial question.

question is:

using DIFU create a programe to start and stop motor using same push button.

can any one give me some idea???????

thanks in advance.........
 
James, you have asked the number one most asked question in this forum. Spend some time searching for the term "flip flop".
 
Greetings James and welcome to the forum. We don't do homework for you but we will help you.

The problem sounds simple enough on the surface, when we push a button we want the output to be the opposite of what it was, ie,

if button then output = not output

If only it were that simple. The first difficulty we encounter when trying to solve this problem is that the PLC can complete dozens of scans while a button is being pressed. Even if the operator is really fast, he is slower than the PLC. Even Wyatt Earp doesn't stand a chance. The output will change state ever scan and the final state of the output would be indeterminate. So what we need is a way to program that we don't want to respond to the button state, just the initial pressing of the button.

The DIFU, or differential up, instruction will turn on its addressed bit on the rising edge of the input. The bit remains on for only a single scan of the PLC. This is called a one shot. After that the bit will go false and remain false until the input goes false and then true again. One shots are incredibly useful and you will find that they have thousands of applications. Note that even though Omron calls it differential up, other PLC makers may call the equivalent a one-shot, or a one-shot-rising or a one-shot-falling (DIFD).

If input A has a push button wired to it, this rung will create a one shot pulse at bit B that will be true for one scan only when button A is pressed.

A
--] [----------+----+
|DIFU|
+----+
|B |
+----+



Lest I do all of your homework for you and you learn nothing, I'm not going to complete the ladder, rather, lets express what we want to have happen in words.

If b and not output then turn on the output.
If b and output then turn off the output.


This takes care of describing what happens when a pulse causes the output to change state. The rest of the time, the times when we don't have a pulse (ie, the time between the instant the button is pushed and the instant it is pushed again), we want the output to remain in whatever state it was in. We can express that this way:

If !b and output the leave the output on.
If !b and not output then leave the output off.


The first two statements can be expressed in Boolean math as
C = (B AND NOT C)

The second two statements can be expressed as
C = (NOT B AND C)

Combining the two we get

C = (B AND NOT C) OR (NOT B AND C)

I hope that helps.
 
Last edited:
The forum world would be a much less populated place if plc manufacturers added a "toggle" output instruction....

example, in A-B world ---(T)--|, executed for a false to true rung transistion, of course !

no more homework posts.....
 
The forum world would be a much less populated place if plc manufacturers added a "toggle" output instruction....

example, in A-B world ---(T)--|, executed for a false to true rung transistion, of course !

no more homework posts.....

Make sure it has a build-in de-bounce filter setting.
 
Last edited:
I don't remember who posted it. Several years ago, someone posted using the PB as the input for a counter and using the ".0" bit of the counter as the Start/Stop for the motor.
I loved it and have been using it ever since.
 
I don't remember who posted it. Several years ago, someone posted using the PB as the input for a counter and using the ".0" bit of the counter as the Start/Stop for the motor.
I loved it and have been using it ever since.
This looks elegant at first glance, but:
- Not every PLC allows bit-level access to word data.
- The counter must be reset sometimes to prevent saturation or overfill. This is simple unless the abovementioned limitation applies.

Actually, bit toggle may be programmed using only 4 contacts + the bit coil.
Hint: with toggle condition active, the bit switches to opposite state, with toggle condition inactive it self-retains.
 
The forum world would be a much less populated place if plc manufacturers added a "toggle" output instruction....

example, in A-B world ---(T)--|, executed for a false to true rung transistion, of course !

no more homework posts.....

The point of the training exercise is not the toggle itself but to increase understanding about the scan, its possible uses and intricacies.
 
The forum world would be a much less populated place if plc manufacturers added a "toggle" output instruction....

example, in A-B world ---(T)--|, executed for a false to true rung transistion, of course !

no more homework posts.....


FYI - the Honeywell HC900 has a Toggle Block - it uses function block programming only.
 
One of our forum members, Doug_P has an animated avatar that shows a simple flip flop that will work with most PLCs.

image.php


This flip flop can be programmed on pretty much all PLCs. Assuming P is an unbuffered push button input it cannot be guaranteed to always work on a ControlLogix platform - most of the time it will work but there could be instances when the CLX IO updates between the first and second rung of Doug's flip flop.

I've been more partial to the Counter.ACC/0 method the last few years to create toggles. I don't bother with counter roll over, it will go on toggling just fine - if it is an issue then unconditionally unlatch counter.acc/14 and it will never roll over. With the counter.acc/0 method you also need to program something so the toggle is in the right state at go to run conditions.

However the OP is working with an Omron PLC and had to use the DIFU instruction. Maybe for the fun of it our Omron gurus could point out how to use the LSB of a counter and whether roll over is an issue or not.
 
Last edited:
Please find attached the sreen shot for your reference.
Thanks in advance for your better understanding.


its very simple to build/use.

Nagaraj.

ON_OFF_PB.jpg
 
Greetings Naag_slet.

Thank you for posting that. I see one problem with it however. Lets start with CTU1.ACC = 0. When the button is pressed CTU1.ACC increments to 1. The bit On_Latch is turned on in rung 71. When the button is pressed again CTU1.ACC increments to 2. The bit On_Latch is turned off by rung 72. So far so good. Next time the button is pressed CTU1.ACC increments to 3. The counter is then reset in rung 73. The bit On_Latch however does not change state. To get the bit On_Latch to turn back on the button must be pressed again. Each time there after when the bit is turned off the button must then be pressed twice to get the bit to turn back on. This is not a true toggle.

This counter method is much simpler

Button
---] [-----------+-CTU-------------+-(CU)-
|Counter ToggleCTR+-(DN)-
|Preset 0|
|Accum 0|
+-----------------+

ToggleCTR.ACC.0 OUT
---] [---------------------------( )---


The least significant bit of a binary number changes state whenever the number increments. It doesn't matter if the binary is positive or negative or if it rolls over.
When ToggleCTR.ACC is an even number ToggleCTR.ACC.0 is 0.
When ToggleCTR.ACC is an odd number ToggleCTR.ACC.0 is 1.

Hope that helps.
 

Similar Topics

Good Morning , I would like to start a Powerflex 525 with a N.O. Start Pushbutton , and when the N.O. Start Pushbutton is released I would...
Replies
3
Views
1,623
Hello everyone. I'm new to the forum. I have a problem with the encoder and PID. We need to turn an encoder controlled rollover. I am using...
Replies
1
Views
1,397
Hello I am trying to make a program work with a sqo instruction .The process has 5 steps ,and a starting step of zero.There should be 8 sec...
Replies
17
Views
1,033
Good morning to everyone on the forum and happy new year. I'm trying to use the following functions in sysmac studio, because I need to enable one...
Replies
1
Views
323
Hello, I am trying to detect when the PLC changes from STOP to START mode. This can be considered an edge case scenario, but I would to analyze...
Replies
4
Views
1,552
Back
Top Bottom