Sign in to follow this  
Followers 0
mikey431

OTE command in RXLogix 500

8 posts in this topic

I just start to learn PLC programming and ladder logic is pretty new to me. Here is my question. If a bit that is energized by OTE command under true input condition, does it still retain the value when the input condition is no longer true ? if it does indeed retain it value, does it retain value when the program terminates assuming the input conditions will never true again? If it does not, is there any way we can do implementing the idea of a output bit will retain its value until the input condition is true again and change that outout bit? Hope this makes sense. Im using Rslogix 500. Thank y'all.

Share this post


Link to post
Share on other sites
Think of an OTE instruction as a relay coil. When energized (true input logic), it writes a one to the address. When de-energized (false input logic) it writes a 0 to the address. If you want to retain the value of a bit address, you can use OTL and OTU to write 1 or 0 to the same address. OTL (output latch) will write a one to the address when true, and do nothing when false. OTU (output unlatch) will write a zero to the address when scanned true and do nothing when false. Addresses that are only updated by OTL and OTU instructions will retain their state even after power is cycled to the allen-bradley PLC. Edited by OkiePC

Share this post


Link to post
Share on other sites
The OTE insturuction turns on the bit when the rung is true, it turns it off when the rung is false. The next question is a bit more complicated. If the program terminates, the bit will remain set in memory - because the program is not running or doing anyting to reset it. If you put the processor in program mode and observed the state of the bit, it will remain in what ever state it was in when the program ended.. However, as soon as you put the processor back in run mode, it will perform a pre-scan and it will reset the bit on the OTE instruction. Then on subsequent program scans it will again set/clear the bit according to the rung condition. To turn a bit on and have it remain on even if the rung goes false or even when the program terminates and restarts, use the OTL (latch) instruction. When you use the OTL intstruction, you also use an OTU (unlatch) instruction to clear the bit when the rung conditions are true. There is also a first scan bit (Bit S:1/15 in a SLC/MicroLogix) that is true for only the first scan of a program. You can use this bit to reset any unwanted latched bits. In some PLCs latch and unlatch instructions must be programmed to certian addresses in order to be retentive through a power off-power on cycle. In the AB PLC this is not the case, but you should be aware of it for when you do encounter other PLCs. Expand and zoon the attached image to see an example with explanations. Edited by Alaric

Share this post


Link to post
Share on other sites
If you are familiar with 'normal' programming it may be easier to think of ladder logic that way. for example with OTE: XIC SW1 XIC SW2 OTE M1 is actually: if (SW1 and SW2)=1 then  M1=1 else  M1=0 endif and another with OTL: XIC SW1 XIC SW2 OTL M1 is actually: if (SW1 and SW2)=1 then  M1=1 endif and another with OTU: XIC SW1 XIC SW2 OTU M1 is actually: if (SW1 and SW2)=1 then  M1=0 endif The whole program runs from start to finish with each scan which is somewhat different to 'normal' programming but as you can see if the above bits of code don't get run (i.e a subroutine that isn't called) then the they don't change. There is nothing special about Ladder Logic, it's just often easier to understand than 10 lines of 'if', 'and', 'or' etc. It is just a normal computer with a normal program.

Share this post


Link to post
Share on other sites
I do have 'normal' programming background and to me ladder logic programming is similiar but not the same.Thank you all. I love this forum already !!!

Share this post


Link to post
Share on other sites
in the attachment image, first example, did u use 2 buttons for stop and start or use 1 button for both? I'm confused because you said " As soon as the start button is pressed and the rung becomes false",if it is true then why we need the "pump stop button" XIO condition ? In the last example , as far as i understand the "First Pass" should turn on the fan on first scan since that's whole purpose of using it ? Is there any tricky stuff here that I dont understand? Thanks

Share this post


Link to post
Share on other sites
Sorry, that should read "As soon as the STOP button is pressed" . Think of a motor control circuit with momentary start/stop button. Pressing the start button energizes the relay. The relay closes, and one of the contacts on the relay is wired around the start button to hold the relay on after the button is released. The relay holds itself on through this contact until power flow to the coil is interrupted by pressing the stop button, which is wired to interrupt the power flow when pressed. This is standard control wiring on magnetic contactors - the advantage being that it will turn off when power is interrupted, and stay off, until it is intentionally restarted. The software mimics that function. The last rung just shows another way you might do the rung before it. Both of those rungs turn the fan offl, the OTU instruction sets the bit to 0. For example, if you had a piece of equipment that you wanted to start back up automatically after a power failure, but only if it was running when power failed, such as a ventillation fan, then you would use the OTL and OTU instruction pair shown in the two rungs before the last rung. If however, you wanted it to not start after a power failure, but had programmed it whith OTL/OTU, then you have to put in the first pass on the OTU to turn the bit OFF on power up. - Ignore the comment on the next to the last rung. RSLogix puts in the same comment on all rungs with the same output address - since its on the last rung, its also on the next to the last rung (unless you change the comment default setting, which I did not do).

Share this post


Link to post
Share on other sites
I think that what you are asking for here is the logic for what is called a flip-flop. I have a reading lamp on my bedstand at home where if you touch the base the lamp turns on. Remove a hand, then touch the base again and it turns off. Inside the lamp is a chip that has a flip-flop on it, which is an arrangement of four logic gates cross connected in such a way that an input turns on the lamp. Remove the input, and the gates set themselves so that next time the input comes on, the lamp will go off. Look at the attached image. The logic is arranged so that instead of looking at the state of the input, we look at the rising edge of the input to create a pulse called a one-shot. The one-shot (B255/2) is true for only a single scan of the PLC. To make it true again for another single scan, the input bit has to turn off, and then turn on again. The one shot will change the state of B255/3 in the next rung: if it iss off it will turn it on, or, if it is on it will turn it off. I := NOT I However, the AB PLC has a handy instruction that can be used for the same purpose. The instruction is the CTU counter instruction. The counter builds in a one-shot so that it only upcounts on false to true rung transtions. In binary numbers, the least significant bit of an even number is 0, while for an odd number it is a 1. So everytime we increment a number, the least significant bit changes state. So if I program the following two rungs: XIC BUTTON CTU C5:0 0 0 XIC C5:0.ACC/0 OTE O:0/0 Then when I press the BUTTON the first time, the counter increments to 1, setting the least signifanct bit of the counter accumulator. This bit turns on the output. Now if I press the BUTTON again, the counter increments to 2, clearning the least significant bit of the counter accumulator, and turning off the output. We dont' need to concern ourselves with the actual value of the counter accumulator, or or even with counter roll over (thats the beaurty of 2s compliment binary numbers). Since we dont care what the state of the timer DN bit is, I programmed a PREset of 0. If we want to make sure that when the PLC powers up, the output will always be off use the First pass bit to reset the counter. XIC S:1/15 RES C5:0 Is that what you were asking? Edited by Alaric

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0