code for 1 pushbutton and one light

I felt mildly embarrassed when I came accross this little question in an application that needs to examine a series of about 40 pushbuttons on an
operator interface panel. There is not enough space on the touch screen to add 40 more buttons for separate on / off control, and the program in the PLC has to be fairly fast, so I was disinclined from adding a whole bunch of logic to
examine each one separately.

What I came up with, that works like a charm, is a scheme in which a counter is incremented each program scan, and the counter value is used to build an indirect address to examine the state of each button in turn. And the toggling? The word value of the buttons is meshed through a bitwise exclusive OR with the word value of the pilot lights. I don't think I could make it short enough to be elegant for a single button, but it sure works nice when there are lots of them.

J Danforth
KVA Induction, Inc.
 
> Using Rslogix 5 I need to come up with the code for 1 pushbutton and one light.
>
> The way it works it :
> Push the button once and the light turns on, push it again and the light turns off.
>
> Thanks guys, I am just looking for hints.

I was just going through the end of the year summary and noticed your question. I only went through a few of the replys but didnt notice any truely efective or efficient ways. What your asking about to me is one of the true advantages of a plc. Almost any other direct I\O operations can be handled useing simple relay logic. The reasons that this issue is not as simple as as it seems, is that you cant press a button for one plc scan or for relay logic you cant press it fast enough to only turn it on. The plc offers a transitional input that allows it to be on for one scan only. Usually looks something like this -/p/- or -/^/- for a positive transition and -/n/- for a negative transitional input.
I have seen the use of data registers to keep up with the state but that is easy to get off track and too confusing for most of your electricians. Not to mention register overflow. Anyway a simple, failproof, easily understood solution that I have incorporated in thousands of "push on push off" situations is this.

pb lamp lamp off lamp
-/P/----/-/-------/-/-----( )
lamp /
-/ /---------

pb lamp lamp off
-/P/--/ /--------( )
 
Top