Different actions each time you press a button

Ve3Mike

Member
Join Date
Nov 2006
Location
Bowmanville
Posts
1
Hi, I am writing a PLC program that when you press the Start Button once it does a certain operation and one you press the button again it does another operation. Can anyone help me out with this? Thanks. I am using Relay Logic by the way.
 
Last edited:
Ve3Mike said:
Hi, I am writing a PLC program that when you press the Start Button once it does a certain operation and one you press the button again it does another operation. Can anyone help me out with this? Thanks. I am using Relay Logic by the way.

Did you mean to say you are using ladder logic? Relay logic is what is done when using relays, there is a difference.

You did not state enough details, since it is a start button will it just stop that operation?

OR is it more of an indexing button i.e. each time you press it another action is performed. Example: load part, press button, part is clamped and moved into position, an action occurs, operator checks part if OK then presses button and it moves to another position and another action occurs.....
 
I would use a sequencer, also called a drum on some PLCs. You did not state the brand of the PLC you are using so I'll give you a generic response that I hope will be helpful.

While a sequencer can support any number of outputs, I'll explain the general concept with a simple molding machine using four outputs.

Output A - Close mold
Output B - Open mold
Output C - Extend press ram
Output D - Retract press ram


There are five steps:
0 Mold open, ram retracted, machine ready for operation.
1 Close the Mold.
2 Extend the press ram to press material into the mold.
3 Retract the press ram.
4 Open the mold.

After the last step is completed the sequencer will wrap around to the first step.

Now we create a binary table to represent the state of the outputs for each of the steps of the molding machine.

STEP Output: A B C D Decimal Equiv.
0 0 0 0 0 0
1 1 0 0 0 8
2 1 0 1 0 10
3 1 0 0 1 9
4 0 1 0 0 4



A sequencer (or drum) is an instruction that will move each of the integer values, in this case, 0,8,10,9,4 to an output destination each time the step is advanced. You would program your push button to advance the sequencer. The output destination can be the IO output word of your PLC, or it can be an intermediate word and each bit of the intermediate word can be mapped to a PLC output.

----------------------------------------------------------

In the days before PLCs a round drum was often used for these kinds of operations. The drum was mounted next to an array of switches and switch operators called dogs were positioned around the drum in the proper locations to operate each of the swithces in sequence as the drum rotated into positon for each step.
 
Ve3Mike said:
Hi, I am writing a PLC program that when you press the Start Button once it does a certain operation and one you press the button again it does another operation. Can anyone help me out with this? Thanks. I am using Relay Logic by the way.
This is only my suggestion base on my understanding of your problem. I'm using S7 200 (222). Program in MAIN PROGRAM and use SHIFT REGISTER BIT, SHIFT A SINGLE DATA 1 to a memory bit (e.g. M1.0, M1.1, M1.2...etc) depending upon the number of N bits to be shifted. Then for every memory bit that is ON call a subroutine. For each subroutine that you call program any action that you want.

If your using S7 3OO program it in OB1 then call a block ( FB'S or FC'S) where you program the action you want to operate. Use FB'S if u need a data block.

If the action that u want is only a single output, no need to program it in the subroutine, just progrmam in the main prog. by connecting an output to the memory bit that is ON. But if the action that you want to operate is a program itself then, program it in the subroutine

SET- CSG
 
Last edited:
You have just described how most of all industrial machines/prpcesses operate--a sequence. Most machines accomnplish their goal via predefined steps, or sequence of operations. The difference between sequences is the actions performed in each step, and the condition defining the end of each step, and thus, the advancement to the next step.

In your case, the advancement to the next step will be the button, and possibly, other conditions as well.

We, six of us, as a group of programmers working for the same automation company, all use a standard sequencer for these machine control programs. Our boss came up with it years ago when he still wrote code. It's a good idea. We never start a program with a blank ladder, and we can all relatively easily troubleshoot each others programs because we all do the sequencer the same way.

Come up with a generic sequence program and use it.
 
Ve3Mike said:
Hi, I am writing a PLC program that when you press the Start Button once it does a certain operation and one you press the button again it does another operation. Can anyone help me out with this? Thanks. I am using Relay Logic by the way.
If you are talking about an action for every step, for s7 200 I used SCR ( Sequential Control Relay) or I used also S7 Graph to program a sequential operation in S7 300. A manual about S7 Grahp by SIEMENS will help you a lot.

set-csg
 
Some thoughts...

Using a counter, sequenser or flip/flop may be what you need, however there could be pitfalls to that type of setup causing an un-intended or unexpected operaton.

When running short on inputs for operator buttons, I usually use a selector switch to change "operational modes". Mode 1, all the buttons mean "This"; Mode 2, all the buttons mean "That".. Since the operator changes the mode intentionally, you have a better chance that he will be aware of what will happen by pressing the same button. Additionally and indicator light on or adjacent to the button would also be a good reminder.
 

Similar Topics

i have two plc 1. s7-1212dc/dc/dc ip; 192.168.0.1 2. s7-1500 1513-1pn ip; 192.168.3.2 i need to get data from plc1 to plc2. any idea how to do...
Replies
5
Views
112
What happens if you power up a 1783-MS10T with a Compact Flash card from a 1783-MS06T? Does it work, but with the "extra" ports unconfigured? If...
Replies
0
Views
74
Hi, I want to build a demo station to test devices and programs and I need some help with it. I want to connect GuardLogix, Piltzmulti and...
Replies
1
Views
149
Hello guys, I am new to this forum and have some problems with my PowerFlex755 EENET frequency inverter. I want to do a point to point...
Replies
9
Views
386
I want to establish a Profinet network in my production plant to connect multiple devices, including a PLC, HMI, and multiple Profinet-based...
Replies
19
Views
682
Back
Top Bottom