Pushbutton for sequential outputs

Guido

Guest
G
Hi, I am working on a sample program. Push a button once, and light #1 turns on. Push the button again, light 1 turns off, and light 2 turns on, etc.
All of this I was trying to accomplish with simple bit logic, and I can do it with a counter, but I am trying to learn the bit logic. It's simple, but I'm stumped.
Thanks for any help.
Guido
 
So what does the etc. mean? At the third press of the pushbutton does light #2 go off and light #1 come back on? Do both lights go off? Does light #2 go off and light #3 go on?

There are several approaches. Search the site using the keyword 'flip-flop'.
 
More info

Steve Bailey said:
So what does the etc. mean? At the third press of the pushbutton does light #2 go off and light #1 come back on? Do both lights go off? Does light #2 go off and light #3 go on?

There are several approaches. Search the site using the keyword 'flip-flop'.

Hi,
yes, at the third press of the button light #2 goes off and light #3 goes on.

etc. means you keep pressing the button, and the next light turns on. I've got a OSR feeding a flip-flop for the input, but I'm trying to understand the logic necessary to keep expanding, with only this one input. It was explained to me by a German programmer as a cycle-step, using only logic bits, but he was using functional block diagrams on Siemens stuff, and I'm trying to adapt the little I've learned to ladder logic with Allen Bradley stuff.

Thanks, Guido
 
If you are using an AB plc then I suggest you use an SQO instruction. Assuming you are using a fixed IO PLC (like the ML1200) and button is on input I:1/0.

XIC I:1/0 SQO #N11:0 ffffh O:0.0 R6:0 10 0

The contents of the N11 file are
N11:0 = 0
N11:1 = 1
N11:2 = 2
N11:3 = 4
N11:4 = 8
N11:5 = 16
N11:6 = 32
N11:7 = 64
N11:8 = 128
N11:9 = 256
N11:10 = 512

Each time the button is pressed the sequencer will write the value from the next word of the N11 file to the output word. After the tenth word is written (the tenth light is on) the sequencer wraps back around to N11:1. If reset the sequencer resets to N11:0. Adjust accordingly for the number of lights.

You mentioned using a counter as a way you did not want to do it, but, since this is for the sake of learning, take a look again at the conter in conjunction with the DCD (decode) instruction, which takes a number 0-15 and turns on the matching bit in an output word.

XIC I:0/0 CTU C5:0 11 0
XIC C5:0/DN RES C5:0
DCD C5:0.ACC O:0.0

Another way is to start with a value of 1 in the output word and multiply the entire output word by two each time the button is pressed. Use a one-shot to make sure only one multiplication occurs for each button press. You need some limiting logic and reset logic - shouldn't be difficult for you to figure it out.
 

Similar Topics

Hey guys ! How do I use the pushbutton fucntion block and test it ? I put the FB on the worksheet, put the signal tags, but I dont know how to...
Replies
5
Views
630
Sorry for the basic question: On my HMI, I've created a button labelled SAVE to save the current values (distances in mm). It's not linked to any...
Replies
22
Views
2,260
Hi all, (This is with FTV SE v12) I am trying to use the Push Button -> Button and I would like to have the same color for the border and the...
Replies
9
Views
1,617
Hi all, (This is with FTV SE v12) I am trying to use the Push Button -> Button and I would like to have the same color for the border and the...
Replies
0
Views
1,086
Hi all - (Using Logix Designer 33.01, View Designer 8.01 on PV5310) I'm having trouble with pushbuttons either not appearing (in emulator or on...
Replies
3
Views
1,466
Back
Top Bottom