Very basic ladder logic question

imkzru

Member
Join Date
Jul 2008
Location
TN
Posts
5
I'm brand new to ladder logic and this is a simple question but for some ungodly reason I cannot get my head around this.

In a relay circuit, the circuit is drawn in the de-engerized state. When power is turned on the relays change state until the power is removed. Simple.
But this is where I'm confused in ladder logic. When a signal is put to an address is it a momentary signal or a constant signal?

With the image below, I will try to explain my issue.
ladder.bmp


Now if I give a signal to 000.00 it is going to close that contact and start the timer. But it is also going to open the NC contact since it is on the same address, correct? Now if the signal is a constant signal, the NC contact will stay open and this ladder will not work.
But if it is a momentary signal, then yes I understand how this would work to a point.

Once a signal is sent to the NO contact, the contact closes triggering the timer. Once the timer gets to the set time it sets a flag and moves to the next rung on the ladder. Since the tim001 is a NC it continues to the counter where after a count of 2k it closes the CNT002 contact. ok.

Why is there a NC contact address 000.00 hooked to the counter? If it is a return path to the top of the ladder the circuit would stop after a count of 1 since the other contact is open "as the signal is momentary", correct? Can anyone with a little understanding that I'm new to ladder logic try and assist please?
 
The input signal results in a constant state. There are instructions available which will fire only on the Turn-On or Turn-Off of a signal but these are not being used here.

The lower input to the counter is probably a 'reset'. it will reset when the NC is TRUE, that is, when 000.00 is OFF.
 
ok let me see if I got this correct.

a signal is sent to address 000.00. This closes the NO contact and opens the lower NC contact. The timmer starts to count and when it reaches it's set time it resets and starts to do it's thing again since it is still receiving a signal. This also sends a -1 count to the counter and the counter goes to 1999. This continues till the counter hits a count of 0 then it close's the CNT002 contact and turns on what ever is at address 010.00. it also resets the entire ladder to its defult state onced the single is removed. Correct?

So when reading ladder logic the single is a constant signal and not a momentary one as well.
 
You have it basically correct, though some PLCs show the counter as counting up from zero toward the preset.

Yes the state as represented by NO aand NC contacts is maintained as long as the input signal is constant.
 
Hopefully Ron will join us in this thread - as he explains this kind of stuff very well.

But in the meantime I'll take a stab at it. A common mistake, and its a mistake that is even taught by many instructors, is the idea that the PLC program emulates a relay circuit. The programming language uses the same kind of symbols you would find in a relay circuit, but the similarity ends there.

Instead of thinking of ---] [--- as a relay contact, think of it as testing to see if a bit is a 1. Likewise ---]\[--- is not a normally closed contact, its an instruction that tests the addressed bit to see if it is a 0.

Likewise, timers and counters are not actuals timers and coutners, they are instruction that operate on a particular memory address. A Timer address refers to a set of memory locations that records the number of time units that have passed since the timer instruction input became true (in the case of the Omron PLC it is tenths of a second), a preset time, and a status bit that indicates if the preset time has elapsed or not. The counter address is a set of memory addresses that store the current count, the preset count, and a status bit that is set to 1 when the current count is equal to or greater than the preset.

You have hardwired a switch to input 0 of what I am assuming is an Omron PLC (although the brand doesn't matter so much for the principle involved.) When you turn on that switch a small current flows through an opto-isolator in the PLC hardware, which turns on a transistor. At the beginning of the PLC scan the processor will issue hardware instructions that will transfer the state of those transistors into memory. Now througout the scan of the PLC program, it is this memory which is accessed, read, and modified.

So, to read the first rung,
If bit 000.00 = 0 and if the timer 001 status bit = 0 then execute timer 001 to record time. (If bit 000.00 =1 or the timer status bit = 1 then the rung is false and the timer instruction will reset the status bit and elapsed time in memory).

To read the second rung,
If bit Timer 001 status = 0 then count up counter 002.
If bit 000.00 = 0 then reset counter 002.

And the third rung,
If Counter 002 done status bit = 1 then write a 1 to bit 010.00.

Once the PLC has completed its scan, the processor will then execute a series of instruction that copies the output memory to a set of output transistors. These transistors will opeate either higher power output tansistors, triacs, or relays, depending on the kind of PLC you have.

Then the PLC starts the scan over again by copying the state of the input transistors to memory.

Learn to think of the PLC program as operating on the state of memory bits, not as NO and NC contacts as treating the intructions like contacts is guaranteed to cause confusions down the road.
 
Last edited:
Greetings Alaric ...



Hopefully Ron will join us in this thread - as he explains this kind of stuff very well.



thank you for the kind compliment ...


But in the meantime I'll take a stab at it. A common mistake, and its a mistake that is even taught by many instructors, is the idea that the PLC program emulates a relay circuit. The programming language uses the same kind of symbols you would find in a relay circuit, but the similarity ends there.

Instead of thinking of ---] [--- as a relay contact, think of it as testing to see if a bit is a 1. Likewise ---]\[--- is not a normally closed contact, its an instruction that tests the addressed bit to see if it is a 0.



and you’ve done a good job of explaining the “secret handshake” on the bits ... there’s quite a lot about this subject that’s covered in the “Sample Lessons - Email Quizzes” area on my website ... going over the questions and answers there will probably be helpful for our new friend ...



personally I’m not familiar with the specific programming software that he’s using - but the information so far seems to make sense ...



except ...



So, to read the first rung,
If bit 000.00 = 0 and if the timer 001 status bit = 0 then execute timer 001 to record time. (If bit 000.00 =1 or the timer status bit = 1 then the rung is false and the timer instruction will reset the status bit and elapsed time in memory).



I think there are a couple of typos in that - probably from Copy-and-Paste errors ...



try this instead ...


If bit 000.00 = 1 (ONE) and if the timer 001 status bit = 0 then execute timer 001 to record time. (If bit 000.00 = 0 (ZERO) or the timer status bit = 1 then the rung is false and the timer instruction will reset the status bit and elapsed time in memory).



wish I had more time to play ... duty calls ...
 
Last edited:
Ron Beaufort said:
If bit 000.00 = 1 (ONE) and if the timer 001 status bit = 0 then execute timer 001 to record time. (If bit 000.00 = 0 (ZERO) or the timer status bit = 1 then the rung is false and the timer instruction will reset the status bit and elapsed time in memory).

OOOOOOOOOOPS. That what the hell I get for not proof reading. Thanks Ron for catching that.
 
Sorry it has taken me so long to reply. I kinda got sidetracked.

Yes when I went through the apprenticeship and they quickly went over ladder logic, it was taught as relay logic more than anything. This was 13 years ago, so yes I am trying to unlearn what I didn't really know to begin with. Let me see if I can run through this one more time and see if I can get a little closer.

During the PLC scan, if the PLC sees a bit set of a 1 at address 000.00, it stores that bit set at the preassigned address in memory, then moves on to the Tim001 and sees a bit set of a 0 and starts the timer. Once the timer reaches the preset time of the timer, it sets a flag then resets. The counter, if I am thinking of it correctly, would be something along the lines of if Tim001=flag, then start, for lack of programming knowledge. The counter will start counting because it sees the flag, either up or down, depending on what counter you are using. Once the counter has satisfied its condition, it closes CNT002. I am still confused of why there is a normally closed contact hooked to the counter because of the fact once you set address 000.00 to high equalling one, you would open that contact. To clarify, I am not running any software. This actually came from one book of many that I have. I have been an electrician for many, many years working along side of PLC's, but I never knew how to write or decipher the ladder logic of the PLC. That was always done for me by engineers and I am trying to learn this because I don't like not knowing something that pertains to my field. I would like to thank Ron for the link, and I will take the time to read all information contained within that link. I would like to thank everyone else that has responded to this thread with kindness and a willingness to help. It is most appreciated.
 
if I had a nickel for every time I've heard this story ...

yes I am trying to unlearn what I didn't really know to begin with.



trust me - that is a VERY common complaint ... it’s hard to learn the “good stuff” when your head has been crammed full of junk ...



During the PLC scan, if the PLC sees a bit set of a 1 at address 000.00, it stores that bit ...



hold it - hold it right there ... you need to separate the “scan cycle” into three separate parts ... then do them in the right order ... step ONE ... step TWO ... step THREE ... your latest attempt is “mixing up” the various steps ... the stuff I wrote in this thread should help - as well as the lessons I mentioned earlier ... do NOT despair ... once you know the secret handshake it’s a LOT easier to decipher than the way you were originally taught - and it works EVERY TIME ...



it always boils down to a simple question - like: do I have current here? ... it’s always a simple answer: yes or no ... then what’s in the bit/box? ... a one or a zero ... does the instruction (XIC) see a one? ... yes or no ... if it DOES then the instruction is true ... if it does NOT, then the instruction is false ... and so on and so on ...



To clarify, I am not running any software. This actually came from one book of many that I have.



do you have any hardware available that you can actually experiment with? ... I’ll be honest, learning this stuff ONLY from a “book” is a HARD way to go about it ... have you been to www.thelearningpit.com yet? ... the exercises there have helped a lot of people ...



I have been an electrician for many, many years working along side of PLC's, but I never knew how to write or decipher the ladder logic of the PLC.



you’re not alone ... the vast majority of my students fit right into that same boat ...



I would like to thank Ron for the link, and I will take the time to read all information contained within that link.



after you’ve read it, call me up if you still have questions ... I’ve got more time to talk than I do to type ...



I would like to thank everyone else that has responded to this thread with kindness and a willingness to help. It is most appreciated.



I know that I speak for myself and for all of my distinguished colleagues when I say “you’re quite welcome - that’s what we’re here for” ...

we wish you the best ... and welcome to the forum ...
 
Basically, opening the switch connected at input 0 will cause the repeating timer to stop timing and the counter to reset. Assuming this is an Omron CJ or CP series PLC , the counter counts 2000 5 second time periods, or 10,000 seconds. This is not uncommon since the timer itself can only count 999.9 seconds.
 
Greetings panic mode ...



my distinguished colleague Alaric must be “away from his desk” as they say ... but personally, I think that he got it right ...



since we don’t know for certain exactly what type of hardware the original sketch is supposed to represent, I think that we’re working on the assumption (gosh, I hate that word) that the timer works “sort-of-kind-of” like a TON in an Allen-Bradley system ... in that case:



following your suggestion and closing (not opening) the electrical circuit for the switch (the actual field device) attached to bit 000.00 should cause a current flow - and put a ONE in the bit/box associated with that address ... that’s done during Step 1 ...



then on Step 2, when the processor executes the XIC instruction for 000.00 on the first rung, the XIC instruction would be evaluated as TRUE ... this would tend to make the timer RUN ... (again assuming that the timer works like an Allen-Bradley TON) ...



on the other hand, opening the electrical circuit for the switch (the actual field device) attached to bit 000.00 should interrupt the current flow - and put a ZERO in the bit/box associated with that address ... again, during Step 1 ...



then on Step 2, when the processor executes the XIC instruction for 000.00 on the first rung, the XIC instruction would be evaluated as FALSE ... this would tend to STOP the timer - as Alaric said ... (again I’m assuming that the timer works like an Allen-Bradley TON) ...



based on what you’ve posted, I’ve got a hunch that you just missed the word “STOP (timing)” in Alaric’s Post #10 ... or did you have a different take on how this particular timer might work? ...
 
Last edited:
I was addressing this concern of imkzru, explaining that opening the switch resets the counter as well as stopping the timer - the apparent function of the logic is to time a longer time period than the timer could normally handle.

imkzru said:
I am still confused of why there is a normally closed contact hooked to the counter because of the fact once you set address 000.00 to high equalling one, you would open that contact.


Assuming (as Ron alluded,that word is fraught with peril) that this is an Omron PLC, which it looks like it might be from the form and addresses, then the timer instruction times when the rung is true and resets automatically when the rung is false. In that sense its like an AB TON instruction.

There are differences from the AB TON, namely the Omron timer time base is fixed at .1s, there is no EN or TT bit, and it starts its time at the preset and decrements to zero, setting the completion flag bit when the accumulator = 0. But as far as reading this logic goes we can treat it the same.
 
I'm not sure what PLC this was written for as it is just a basic PLC book and it does not say. Most of what I will be personally working with are AB slc-500 as that's all we use. "We = Who I work for".

I do have one other question though.

During the first step of the PLC scan it checks all the inputs. Step two it executes the programming and step three it changes the outputs. "No I did not take into account of any input or output offsets or adjustments".

But with this on the first rung, if a bit is set to high in address 000.00, when does the timer start?

Does it start as soon as that rung is true "step 1 of the plc scan"?
Does it start when the PLC executes its programming? "step"
Or in step 3 when it changes the outputs?

I'm asking due to "beside the fact I do not know" the timer sets an internal flag in memmory. Does the internal bit/flag count as an output or are outputs just the screw terminals?

Yes the whole purpose of this circuit is to overcome the 999.9 second cap on the timer with a count set of 2k on the counter, it would make whatever is hooked to address 010.00 come on after roughly 2.77 hours or 10,000 seconds.
 
Last edited:
I think your idea of 'step 3 when it changes the outputs' is a little skewed. As Ron and others have explained, in a typical PLC (there are exceptions), the sequence is as follows:

Determine the physical state of all inputs and update the Input Image table (in memory) with 1's or 0's depending on current flow into each Input point. So, if the physical input has current flow (or voltage present) that's associated to MEMORY address 000.00, then a value of '1' gets written to 000.00. For the rest of the PLC scan and update of outputs, 000.00 will remain '1', no matter what happens to the physical input attached to that point (we are assuming that the program itself isn't writing a '0' into that memory location).

After the above, the PLC scans the logic. It IMMEDIATELY updates the memory addresses whether internal or associated to outputs. So, if you have an output address of 100.00, and the logic is true with an OTE of 100.00, then MEMORY location 100.00 IMMEDIATELY gets a '1' written to it. Any subsequent rungs of logic that examine that location will see a '1', regardless of the fact that you haven't gotten to the end of the PLC scan to physically update the Ouput point associated with that address.

After the Scan, the PLC now examines all the addresses associated with physical outputs and updates them. So, from above, if 100.00 still has a '1' in it from all the PLC logic scanning, the physical output associated with 100.00 is turned on or energized.
 

Similar Topics

Im looking to hook up a 3 wire PNP photocell to an Allen Bradley 1746IV 16 module. Ive watched videos about hooking up DC sensors, but they show...
Replies
3
Views
2,871
I finally have my test/learning bed set up at home. I understand logic and programming, there are some holes in my basic electronics knowledge...
Replies
6
Views
3,345
Hello, I have an application where I will need to use the Serial port in a L55 CPU, and I can go about it in two ways, but both require me to...
Replies
2
Views
1,473
Hello, Forgive the basic question, but I've been having a hard time finding a clear answer to this online or otherwise. I'd really appreciate any...
Replies
10
Views
2,179
I will apologize in advance for this question. In a PLC scan I understand the inputs are read, then the PLC carries out a scan out the logic and...
Replies
11
Views
4,098
Back
Top Bottom