Latching/unlatching relays in PLC logic

ValeoBill

Member
Join Date
Aug 2019
Location
Wasaga Beach, Ontario
Posts
87
I'd like to get some feedback on the use of latching/unlatching relays. (Something I've never used in my limited programming experience.) I've recently encountered machines where their use is is both plentiful and seemingly without any pattern. I've seem the same relay latched in multiple routines with only a single unlatch instruction and also the opposite; latched in one spot and unlatched in multiple rungs. Surely this is not the conventional or preferred method. My gut tells me I've met a programmer who is rather unique. I am humble enough to admit I could be completely wrong on this. NOTE: I'm dealing with the AB5000 platform. Not sure if this instruction set is used in other PLC software.
Any comments will, as always, be appreciated.
 
Sorry guys....I should have done a search BEFORE writing this post. I'll ask that the moderator(s) delete this ....I'll continue my search and post if further clarification is needed...
 
Well, it's not been deleted and there is controversy in some circles over latching/unlatching. I have heard some people say they do not use latch/unlatch but OR a relay round the logic that would set it and use another contact to "De latch" it, in reality this is still a latch but on one rung, some PLC's have what is called S/R so you latch it & de-latch it in the same rung. There is no problem in using latches in fact without them you could find it difficult to write a program. It can be confusing if latch & de-latch are used many times throughout a program, I tend to keep mine as simple as possible for example if you need to latch something in only use the bit in one section of code and use a different bit elsewhere, then use these bits in combinational logic to drive an output. I never latch/ de-latch outputs directly.
 
Well parky, l did read it, but answering it after he wants it deleted? life after retirement must be getting boring, same could be said for me responding, but l have better things to do as well, like watching my toenails grow, or maybe solo sailing or finish building my house, LOL
 
Last edited:
Yeah, lockdown is getting to me lol, also I miss the buzz of writing programs so find this site a bit of an antidote for my withdrawal symptoms. 🤾
 
Well parky, l did read it, but answering it after he wants it deleted? life after retirement must be getting boring, same could be said for me responding, but l have better things to do as well, like watching my toenails grow, or maybe solo sailing or finish building my house, LOL


What class of boat? dinghy or keelboat? maybe wind-/kite-surfer?
 
From my experience it is bad practice. I am learning how to program and I started with one of those trainers with a small AB PLC. I then took an unusual approach to simulate a real world machine by building a model railroad layout and using a PLC to control the trains. Most of the parts used to build the controls came from a prior job where they were scrapping equipment and I was allowed to take anything I wanted.



Where I ran into trouble programming is what I am writing relies heavy on sequence steps and I was latching bits to indicate when a step was complete. In addition, I was also latching and unlatching several outputs (which controls track power in sections) because as a routine was running its sequence, it is needed to energize and de-energize several outputs. I got to the point where I could not get the programs to run properly and I got stuck.



I reached out here about a year ago, the thread was called "Rslogix better way to control outputs in sequence"



I saved those threads on my computer, I got very good feedback and better ideas on how to avoid this problem. In addition, I was using a Micrologix 1000 and soon found I was low on memory so I had to decide what to do. (Aside from it being obsolete)



Since then I rebuilt my layout and upgraded to a Micrologix 1400 and re-writing all my programs. I am to the point where all my support routines are finished. I am getting ready to write my train operations routines. Two main things I did different this time is for my sequence of steps, I am using an integer value to only allow certain rungs to be true until it finishes its step.



Now I still have the issue of six outputs (track power) that have to be turned off and on a lot. There was a way posted by using a B3 value and the rungs would use a OTE for one bit and then the output would be true if any bit is energized. (this avoids latching/unlatching outputs) but in my case, I will have too many routines for this to be practical. I decided to use an integer value to energize the outputs that control track power. (a non-zero value in N7:XX energizes a track section) this way I can also track where in the program track power was energized. (say if ladder 12 is running, I would move a 1200 into N7, then later in the steps, 1210, etc..)



So far, what I am doing is working and that is thanks for the help here when I got stuck.


Mike
 
I have a 1984 mottle 33 (33 ft, not metres unfortunately, maybe some here could afford that (Peter ??), Australian, Joe Adams design). Fantastic boat for the price you can get them for, in my opinion nothing comes close to matching them in the price range, or add $100k and still can't match them, but of course the +$100k would look nicer inside, but match them for sailing and cruising l don't believe so.
Also l have built a yacht before, clocked a few miles solo, built the best auto pilot you could won't with Arduino (really it was designed by one of you guys from the USA Jack Edwards, but l got it to work (sorry Jack) and have improved it).
But, like all here l am interested in PLC's and am always looking to improve my skills. It's always interesting to see different approach's, but realistically, they generally seem in the end, if approached correctly, mostly seem to finish up similar.

If anyone is interested dribbling about sailing l'm more than interested in a PM, like most guys here (or the very occasional lady (name) that comes to this site, if they can be believed) l have a varied interests, PLC's are just a great one to keep the brain cells ticking.

I can only wish/hope you people in America are able to get some control over Covid like Australia and New Zealand (my birth place) have, but it worries me the approach you's and England have taken towards this.

l hope no one that you love are/or have been infected, or worse. Best wish from down under.
 
Last edited:
there are pros and cons to using latch / unlatch bits.
at one facility, we used them all the time, step 1 latch, step 2 latch, step 3 latch, and so on. this was for a specific plant and we had our reasons.
when the cycle was completed, we unlatched the bits only in one location. when the machine stopped, we knew where the issue was.

the use of multiple latch bits (say b3/1) or multiple unlatch of the same bit is a bad practice. I had to reprogram one machine that had 14 latch (b3/1) and 18 unlatch locations for the same bit. when the machine stopped, this bit was latched. how do you debug a program like that? there were other instances of this in the same program. after I reprogrammed the machine, downtime went from 20-30 hours per 80 hour week to less than 16 hours because maintenance could debug the program and fix the issue.
james
 
Like any tool, it is all how you use it. There is nothing inherently wrong or bad about latches. They serve a purpose. I use them from time to time.

I understand the use of multiples latches or unlatches on a single bit. Again, it may serve a purpose when NOT using latches would make the program more complicated. But of course, anytime you use multiple destructive outputs you are making it more difficult to troubleshoot.

I am always working on other people's equipment so my focus is usually on trying to make the program easier for them to understand as opposed to making it most efficient.

If latches are programmed properly, there is nothing wrong with them. And of course, document everything!

OG
 
James I agree with you, however, providing you use them in the right way there should be no problem, some years ago I had to re-program a system where the original engineer had used a number of bits many times by latching then unlatching in many program blocks, this proved to be a nightmare as it would lock up & only a re-boot would put it right. I did use bits almost like a bit sequencer but ensured that latched bits were unlatched within the same code. To be honest, if done properly then there should be no problem. After all, Siemens came up with system blocks that was essentially a step sequencer using flags, although they were not latched as such, because they would be enabled but then the jumps around the logic the bits stayed on so effectively "latched". I have seen ones that keep the bits on but use the succeeding bit to effectively disable the controlling logic. i.e. bits 0 to 32 are turned on sequentially as a step sequence and stay on until end of sequence. the succeeding bit is NOT ANDED with the preceding code to disable the output bit.
Used extensively in Germany I believe
 
parky,

I agree they are useful when used in the right way.
I was referring to a 500 rung program that had 14 latch bits of lets say b3/1 and 18 unlatch bits of the same bit used through out the program. when the machine faulted, the bit was set and no indication of where it was set in the program. how is a maintenance person going to figure out where the issue occurred? this was not one of those places. when the program was rewritten, we only had 1 latch and 1 unlatch per fault, telling us exactly where the issue was.
james
 
That is exactly my point, try to latch & unlatch in the space of a few rungs, if you need to latch the same function again use another bit, and example may be where you need an output to energise 5 or 6 times during a process then use 5 or 6 separate latches to drive it if the logic requires 5 or 6 different combinations, that way you could see which latch logic is the one controlling it at that time, maybe not efficient as a multiple rung latch, but better than latch/unlatch one bit throughout the program.
 
Last edited:

Similar Topics

Nubee question on latching and unlatching relays I have a customer with a Data center configured like below: What I am trying to do is: If...
Replies
1
Views
2,794
I am looking at some AB RSLogix5000 controllogix code. A very simplified sample of code written within the same ladder...
Replies
14
Views
3,069
Hello everyone. I'm new to TwinCat 2 and was wondering if someone can tell me the AB equivalent of a TwinCat Latch and Unlatch? Also, is the...
Replies
5
Views
2,360
Hello again, everyone. Could anyone help me understand the best way to handle state transitions in ladder logic programs with Studio 5000? I...
Replies
9
Views
3,237
I am having a problem with unlatching bits locking up. This on a SLC 500 series 5/04 processor.This is not happening all the time. I was wondering...
Replies
2
Views
2,810
Back
Top Bottom