Basic RSLogix 500 help

PLCNewf

Member
Join Date
Jul 2014
Location
Canada
Posts
3
Hello everyone,

I am very new to programming, and brand new to Allen Bradley. I am mucking my way through learning the software and things are moving along. However, I am stuck trying to figure out subroutines.

My ultimate goal is to have a subroutine that I can call on throughout my main program that, when activated (by a pushbutton, for example), will activate an output for a set amount of time.

My issue:
I activate the JSR command (ex: jump to U3) and whatever is in File 3 will remain active, even when the JSR is de-activated. I put just an output on a rung, for example, and the output would remain on permanently.

I'm sure it is something simple... any advice?

Thanks in advance.
 
I have being troubleshooting with various logic. I tried just a normally open contact (push button) to enable the JSR. I also tried timer logic to keep the JSR active for 2 seconds (using TON or RTO timers with their EN or DN bits).
 
If you only Jump to that Subroutine (JSR) when the button is pushed the processor will scan that routine only as long as the button is pushed. So if the routine has an OTE that is true due to its logic, as soon as the processor stops scanning the routine the last state of the OTE is held. That is because the processor will not examine the logic to determine if the OTE should be a 1 or a 0.

I hope that helps. If you post your program (zip it first) we could give you a better idea on what is going on.
 
Okay, I think I know where you are going with this. I'm away from the program at the moment, but will pick up where I left off tomorrow and can post what I am working with.

Basically, the subroutine will only continue to be scanned as long as the JSR remains active... Meaning I will have to put logic in the subroutine to make the output false, before the JSR is de-activated?

Thanks for the replies.
 
Why have conditional subroutines? Just call it unconditionally, with the "JSR" instruction the only instruction on the rung. You stumbled onto the main reason why you shouldn't.
Its also makes troubleshooting difficult.
 
Last edited:
Basically, the subroutine will only continue to be scanned as long as the JSR remains active... Meaning I will have to put logic in the subroutine to make the output false, before the JSR is de-activated.

That is correct. The subroutine only gets executed when the JSR is active.

Another thing that you can do is have a different place where those outputs get turned off. Usually I find it poor practice to have outputs being latched/unlatched in multiple locations (harder to track down odd behavior) but there can be valid reasons to do that.
 
Why have conditional subroutines? Just call it unconditionally, with the "JSR" instruction the only instruction on the rung. You stumbled onto the main reason why you shouldn't.
Its also makes troubleshooting difficult.

You can also use that same bit that you would have used for calling the subroutine to be in series with each line of the subroutine you previously were conditionally calling.
 
You can also use that same bit that you would have used for calling the subroutine to be in series with each line of the subroutine you previously were conditionally calling.

This makes a lot of clutter.
I'd recommend using a MCR:
https://www.courses.psu.edu/e_met/e_met430_jar14/prgflo/mcr.html

Also, you could place a MCR/MOV after the subroutine section that wipes the bits used in the subroutine if the subroutine's requirements are not met;
I'm partial to a (MOV) (Source - 0) (Destination - B153:0/0) (Length - 64) where B153 is the Binary register used for the Subroutine.

Food for thought, let me know if it's wrong and I'll correct.
 
Subroutines are intended for Duplicate functionality throughout the code.
They should also be ALWAYS executed, or else your Outputs will appear to "Latch," as you're experiencing.
**Note** I have also done in the past (with great success) to process Emergency Stops in the system. "Stop Processing this Subroutine, and enter a Fault Subroutine instead"

That being said, you should then figure out "Input Parameters" and "Output Parameters" for Subroutines.
You will pass your Push-button as an Input
You will pass your "Light" as an Output
You will pass your Working Area data (Timers, Counters...) as an Input and Output (Timers and Counters MUST be In and Out, or else the time values will not save)
 

Similar Topics

I would like to find a reference guide, website, book, whatever to help me navigate the concepts of bits in a PLC program. I have been...
Replies
4
Views
1,461
Hello all, The title explains what I need, how can I setup WinCC V14 and RSLogix Emulate500 so I can read/write values from the HMI to the PLC...
Replies
7
Views
3,005
Hello all! Can anyone give me a basic run down on how to set up a simple speed control ladder program with RSLOGIX 500? I have exp. with this...
Replies
5
Views
5,055
I am just learning VB and all I want to do is make a button change a value (B3:0/0). I am using Visual Basic 2005 Express Edition, and have RSLinx...
Replies
2
Views
3,039
People, I have used AB quiet a lot but I never used the RSLogix 500 >> Tools >> Visual Basic feature. Would anybody be kind enough to enlight me...
Replies
1
Views
3,952
Back
Top Bottom