RsLogix 5000 Basic Subroutine question

Hello all,

I'm working on a project. It's my first big project working on the RSLogix 5000. I have a long program and different functions. If I create different routines for different logic and then have another subroutine for all my outputs, would it work? If so how do I go about it? Also if I latch something in in routine and then try to unlatch it with another would it work? Also any references woud be appreciated. :unsure: o_O

Thank You 🤞🏻
 
You can use as many subroutines as you need, just be sure to call them from another routine that is running with the JSR instruction.

A routine that is marked as a the main routine in a program will be called every iteration. I typically call all my subroutines from this routine, but you're in no way limited to this.

As far as the latch and unlatch go, you can latch and unlatch a bit from any routine. Just make sure your logic for latch and unlatch isn't conflicting.
 
Also if I latch something in in routine and then try to unlatch it with another would it work?

Tags created at the 'Controller Tags' level can be used in any place in all tasks. Tags created in an individual program's 'Program Tags' can be used by any of the routines in that program. They will not be seen by the code in any other program. Be sure to keep the 'Program Tags' different than any in the 'Controller Tags'.
 
You can use as many subroutines as you need, just be sure to call them from another routine that is running with the JSR instruction.

A routine that is marked as a the main routine in a program will be called every iteration. I typically call all my subroutines from this routine, but you're in no way limited to this.

As far as the latch and unlatch go, you can latch and unlatch a bit from any routine. Just make sure your logic for latch and unlatch isn't conflicting.

Okay, so just to be clear... If I call the routine (from the main routine) with the logic I want and enable an ote, after it returns to my program and jumps to the next routine and I have the bit enabled (which has the same tag as the ote from the other routine) to control the output, I should be good? :unsure:

I apologize if I sound ignorant, just want to be sure :nodi:
 
Okay, so just to be clear... If I call the routine (from the main routine) with the logic I want and enable an ote, after it returns to my program and jumps to the next routine and I have the bit enabled (which has the same tag as the ote from the other routine) to control the output, I should be good?

Yes, all routines within one Program use variable tags listed in that program's 'Program Tags'. All the routines are working with the same tag.

If your setup has more than one 'Program' then each program can have its own set of 'Program Tags' which are seen by its own routines.

Now - this is different -

If a tag is set up in 'Controller Tags' then those tags can be seen and used by any routine in any program.
 
One more note

To prevent confusion, DO NOT create a tag in 'Program Tags' which is exactly the same as a tag in 'Controller Tags'. The system won't complain. But the operation probably won't be what you expect.
 

Similar Topics

i gone through rslogix 5000 sample program which comes with the software, but its tuff to coz iam new to rslogix 5000... Anybody suggess..some...
4
Replies
7,188
Views
Does anyone have a RSLogix 5000 Automation Interface Reference manual? I want to interface VB(VB6 or Visual Basic 2005 Express Edition) with...
2
Replies
10,861
Views
Bit of a weird one here maybe. One thing that may be relevant(?) Doing this on a non-activated copy of RSLogix while waiting for the activation...
8
Replies
294
Views
Hello, I am trying to view the Module Properties for my IF8 and OF8 analog cards in RSLogix 5000 / Studio 5000. However, when I click on either...
6
Replies
398
Views
I am sure someone has maybe done this before. I have a FactoryTalk ME application on one VM, and my PLC program on a different VM. Is it...
5
Replies
448
Views
Top