set - reset

Possibly because of my background in Process Control, I have the feeling that I use SET RESET more than the average machine builder. To keep things under control I have a reset FC which runs on power up and at the start of every new experiment and sets all I/O and Flags to a pre-defined state.

In my current project there is very little which runs cyclically, the basic process runs in several SFCs which use mainly SET RESET instructions and Alarms are always just SET. Following a Fault condition leading to an unplanned exit from the SFC, or another Fault condition, all conditions and Fault flags are thus preserved for investigation, but on restart for a new experiment everything is RESET back to the defined starting condition.
 
Leadfoot said:
After I had read a previous post on SET and RESET functions, I looked at a program I was writing using several of them. I noticed that if the SET was SET and power was turned off and turned back on that I still had a SET condition. This was true even over night. I was amazed.

As my PLC was getting power from a battery, and there is the possibility of the battery going dead, I added a first pass function to reset ALL of my SETS. Now everything starts with an operator input.

I came to this site looking for better ways to program. I must say I have already learned a great way to protect my company and customers equipment.

Ok so somehow you should have a paramiter that you can have "retenitave" SETs and "non-retenitave" SETs. Different manufactures handle this in different ways. But not all set/resets are going to stay "set" on a power cycle. Either you must choose the right ones for what you want, or configure them. READ YOUR MANUAL CAREFULLY.
 
I have found that some programmers don't understand the essence of SET and RESET. I believe this is because they don't understand the true nature of computer memory.

When you use SET and RESET it is EXACTLY like using the light switch in your kitchen.

If your wife tells you to turn on the kitchen light... of course, you jump up off your arse and do so! Then you go back to drinkin' your beer. As you sit there, tilting your head back shooting another big swallow, it suddenly occurs to you... you notice that you don't have to stay at the switch keeping the light on... it just stays on... and you keep drinkin' your beer.

Then, mid-gulp, you get one of those MGD-Moments... Gee, What if...

You run out to the garage and turn off the breaker to the kitchen lighting circuit. Immediately, of course, you hear your wife yell out, HEY!

You turn the breaker back on and listen for a moment... hmmm... no more yellin'.

So, you go back into the kitchen and see that the light is on. You ask your wife, What happened? She says, "The light! It went off and came back on... all by itself!"

Hmm..., you say, Imagine that! Oh... are you OK?
(That, "... are you OK?" is a standard, self-preservation measure used by many of the males in the species.)

Back to Planet-PLC...

A Memory-Bit in a PLC is like a wall switch. A Memory-Word is like a bank of wall switches.

There is a slight difference between PLCs and the wall switch example... wait for it.

A wall switch will respond to, and maintain, the last action applied. If the switch is off when the circuit breaker is opened then the switch will still be off when power is restored (assuming no one is messing with the switches). The same is true if the switch was off when power was killed.

Except for a slight difference in the analogy, memory bits act the same way.

A bit in PLC Memory will go ON if it is told to go ON. It will then stay ON until it is explicitly told to go OFF. This is just like a wall switch. Flip it on and it stays on. It will stay on until you flip it off. These are explicit actions... turn it on, or turn it off.

Now comes the slight difference in the example...

In the wall switch example, the power was killed to the wall switch (wall switch = memory-bit). The power being killed to the wall switch is synonymous to turning off the PLC.

Now... pay attention here... slight difference continued...

Turning off the PLC does NOT turn off the power to the memory bits (possible exceptions to be described). There is a battery in the PLC whose sole purpose is to keep those bits energized when the PLC is off. This is why the program is still there when you turn the PLC back on! Turning the PLC off does NOT make the PLC stupid... that only makes it inoperative.

Many PLCs have what are called Retentive Bits and Non-Retentive Bits.

In the case of the Retentive Bits, when the PLC is off, the battery power is always available (until such time that it craps out) to maintain the states of the bits.

In the case of the Non-Retentive Bits... this one I wonder about.

Let me describe something else first.

In a normal PLC rung, a certain combination of conditions is necessary to turn on the particular output.

Now... here is a subtle, but hugely important difference in the way that PC's and PLC's manage memory.

In a typical PC program, if a bunch of code causes a bit to be turned on, then the bit will go on and stay on until some other code turns it off.

In a typical PLC program, the output is handled a little bit differently.

If the bunch of code causes the bit to turn on, then fine... the bit turns on. The next time the particular bunch of code is examined, if the necessary combination does NOT exist, then the bit is told to turn off!

Can you get the drift of this?

In PLCs, for any given output bit, if there is NOT cause to turn on and keep on the bit, then the bit is turned off!

In the wall switch example, this would mean that the switch is replaced by a momentary pushbutton and that you had to continuously hold that pushbutton, so as to provide "cause", to provide light so that your wife could eat her dinner. (Hopefully, she will have enough patience to do the same for you. You, are only looking forward to Hamburger Helper with a beer while she, of course, has a seven-course what-cha-ma-call-it, with a full bottle of wine.)

Now, with respect to the Non-Retentive Memory Bits...

In some cases, those particular bits are simply NOT wired to the battery back-up. In other cases, where Retentive and Non-Retentive can be declared, those are obviously connected to the battery. In that case, it is then a "house-keeping" issue on the part of the processor.

That is, in the first scan, after power-on, those bits that are declared as Non-Retentive are turned off before the processor begins to run code.

So, I'm having one of those wonderful MGD-Moments now... I wonder if I left any threads hanging loose.

Come back and hit me if I did. I'll try to square it up.
 
Excellent analogy as usual, Terry... (y)

Terry Woods said:
In the wall switch example, this would mean that the switch is replaced by a momentary pushbutton and that you had to continuously hold that pushbutton, so as to provide "cause", to provide light so that your wife could eat her dinner.
The only thing you missed was the 'scan' part, where you persistently ask her "Still want it on?... Still want it on?... Still want it on?"... ;)

🍻

-Eric
 
elevmike said:
Eric,

Actually you ask her do you want it off? Do you want it off? Do you want it off?......
I guess you're more used to hearing a negative response to questions?... ;)

🍻

-Eric
 
"...the switch is replaced by a momentary pushbutton and that you had to continuously hold that pushbutton, so as to provide "cause", to provide light..."

That represents the "scan", even though I didn't say as much.
 
sapoleon said:
PART 1
just a philosophical question. why is normaly not recomended the use of set and reset instrctions?
...
is there really a reason?
...

sapoleon said:
PART 2
...
i also hear that there are some issues in how these instructions are managed in some plc's.

Terry, you have again written a fantastic example for a technical question. I beleive your example explains quite good the PART 2 of the original question but it is my understanding that PART 1 is the one giving most problems to "the next guy" that tries to troubleshoot the darn thing.

In fact if a guy tackles the way PLCs handle Sets and Resets he by then should fully understand how to put them in his programs.

Lets see another version of your situation.

The wife is having a great lunch in the dinner room and Terry is having his second helping of liquid steak. Or was it his fourth?

Anyway, as in a program using many Set and Reset functions, there are 10 Terry in 10 different rooms of the house all having there wall switch connected to ONE SINGLE LIGHT BULB.

Hey! That make 10 Terry, 20 beers, 10 wall switches but only one freak'n lightbulb.

For no apparent reasons (maybee he just ran out of steak) the light goes out!

"TERRY .... THE LIGHT"

That's when it hits the fan.

The light start to go ON and OFF like crazy. Of course this is a badly writen program. Who would have problems with a well writen one?

Sometimes the only way to figure which Terry is playng with them switches is to handcuff them one by one until there is only one left.

Then if those lights still go On and Off sit down and have another steak.

Conclusions: Only use Terry with great care. To many of them will make you go blind. (light joke)
 
As my PLC was getting power from a battery, and there is the possibility of the battery going dead, I added a first pass function to reset ALL of my SETS. Now everything starts with an operator input.
If the PLC is battery powered use a power failure relay to reset all sets - this is what I normally use.

In my PLC of choice. I have the option of using "KEEP" which is a latching relay that is one function and it is all together in the same rung or "SET" and "RSET" which can be separated. I use them both extensively for, dare I say it, control of YD starters etc etc. Also useful for controlling motorised circuit breakers in conjunction with timers. Most useful functions but use with caution. The program will only work - or not work - as well as the programmer has written it.

I can use normal I/O which will automatically reset on loss of power to the PLC or memory retentive bits that will retain state on loss of power to the PLC. Both very useful.

Actually you ask her do you want it off? Do you want it off? Do you want it off?......

Maybe I want it off, I want it off, I want it off followed by no, you have to be joking, I am too tired.

Or a variety of other variations.
 
I actually was using a KEEP function that stayed on.

I will RE-READ that programming manual AGAIN and see what it says about the power on reset. I do not remember anything about power on reset conditions.

I am not liking the way the programming manuals I have diseminate information. I think they are written for SEASONED programmers not analog repairmen like me.
 
I actually was using a KEEP function that stayed on.

You stated that the PLC is powered by 24VDC. I assume the DC stayed on and the AC power failed. This would mean that the PLC was still powered and the KEEP fuction would remain active. That is why I use a power failure relay into the PLC to reset the latch.

If I am misunderstanding you, please repost.

What brand of PLC are you using? Sounds like it may be Omron. If so, a normal internal bit will be reset if the power to the PLC is removed. If a HR bit they are memory retentive if the power to the PLC is removed.
 
Last edited:
Pierre...

You were certainly right that I only covered the part that I did (wow, is that a truth, or what?).

But, your description gave me an idea as to how to determine which SET caused the last Light-ON. (not the first or any intermediaries)

If each switch controlled a particular bit-value in a control word then, you could see the last switch that caused the Light-ON.

Switch(SET)-A => V100 = 1
Switch(SET)-B => V100 = 2
Switch(SET)-C => V100 = 4
etc...

Then, the light is controlled by V100. If V100 is greater than "0" then turn the Light ON.

To see what the last SET was, simply read the value of V100.

Of course, there has to be some sort of coordination between the specific SETs and the value in V100.

In that case, troubleshooting becomes a case of back-tracking.
Find the last SET by looking at V100.

There may have been several, but you can work backwards.

Just a thought.
 
retentive memories

Leadfoot said:
After I had read a previous post on SET and RESET functions, I looked at a program I was writing using several of them. I noticed that if the SET was SET and power was turned off and turned back on that I still had a SET condition. This was true even over night. I was amazed.

As my PLC was getting power from a battery, and there is the possibility of the battery going dead, I added a first pass function to reset ALL of my SETS. Now everything starts with an operator input.

I came to this site looking for better ways to program. I must say I have already learned a great way to protect my company and customers equipment.
in the hardware catalog doublclik to the cpu and clik to the retentive memory tab. you can determine the bits couters and timers to be stored if a power up occurs
 
Seal v.s. latch/unlatch...

I'll use a tradtitionl seal whenever possible. However, sometimes the OTL/OTU is more convenient as in the case where you have a complex set of conditions that either set or reset the bit, more over reset. It's more difficult to understand a complicated seal break than a reset unless you program another rung OTE to break the seal.

I also find OTL/OTU pairs convenient to keep track of process sequenceing. We don't often run into power outages so that's not a big concern. I'm one of those that liek the OTL/OTU combination and I often use them to identify events by doing something like...

|---[event set conditions]-----[ONS]-------(OTL)--|
|---[event reset conditions]---[ONS]-------(OTU)--|

I do have a HUGE problem with OTL/OTU pairs being spread out. Some of our OEM programming contains OTLs in one file and the corresponding OTU in another time zone! That sucks.

One last thing that realy caught my on in this thread...

darrenj said:
here is a perfect example of when NOT to use latch/unlatch!

A plant just put in a pallet strapper, There was a plblem with the straps so one of the guys flicked it over to manual and went in to fix (I know a little stupid..he should have pushed the EM stop) When he was in there he walked in front of an eye and the arm came out and hit him in the head..It moves slow so no big deal..I looked at the program and it was FULL of latched bits..So halfway thru the sequence even tho it was in man mode it was waiting for the eye to be blocked to move.. The programmer never Unlatched his bits when going from auto to hand..

First off, no he should not have hit the EM stop. IMO, EM stops are to protect human life in an emergency. If he was going to break the plane of moving equipment, he should have locked out. Just that simple. Too many people are injured or killed every day because they don't lock out. I don't give a rat's a$$ about the process if, as part of my regular duties, I'm required to stick my hand in a machine. I want to be damn sure that I'm gonna go home with 10 fingers and 10 toes.

The issue of resetting the bits is secondary.
 

Similar Topics

Hi, i am using DVP-14SS2 PLC, after program written to plc, when power is reset, plc doesn't run. always need to connect to pc for the run mode.
Replies
0
Views
38
Hi need help why this “failure 5 emergency stop “ appears at every startup in the morning ? Have to shut off main switch at least 10 times on...
Replies
19
Views
351
I was loading a program onto an XE1e2 PLC and it got stuck on these two windows and won't progress. It won't let me connect from the PC to reload...
Replies
0
Views
91
Hi all, i have recieved some 4RF Aprisa SR+ ethernet radios from a customer to configure. Issue is that they are used and have non-default...
Replies
0
Views
101
Hi Guys, I have a 1769-L24-QBFCB1 that has the OK light flashing on the embedded counter module. The manual states it is a resettable fault, but...
Replies
0
Views
116
Back
Top Bottom