Recycling code, RSLogix 5000.

Elcan

Lifetime Supporting Member
Join Date
Apr 2008
Location
NC
Posts
935
Hi all,
I'm creating my very first RSLogix 5000 project.
This project involves several dozens of motors. I'm trying to figure out what is the best way of reusing the start-stop code (or any code in general).
So far I just copied the rungs and modified the tags, but maybe there's a better approach around there. What about using arrays for the motor tags?
I will appreciate your comments from you seasoned guys.

Thanks!
 
UDTs, not arrays.

UDTs are user data types. You create them to represent common properties of your machine. In the case of a motor (lets assume reversing on a VFD), your UDT may consist of:

FwdPB
RevPB
FwdCommand
RevCommand
FwdStatus
RevStatus
RunAlarm
MotorOL
MotorAmps
etc.

You define each of these data types in your UDT. For example, FwdPB would be discrete, MotorAmps REAL, etc.

Now, you create your tag and assign it of type Motor. Say PumpA. To access each part in your logic it would be PumpA.MotorAmps or PumpA.FwdCommand. Then it's fairly painless to cut/paste logic and just do a replace of the tag.
 
Last edited:
Thank you very much for your responses.
Could be the idea to use add-on instructions(AOI) and UDTs?
 
Elcan said:
Thank you very much for your responses.
Could be the idea to use add-on instructions(AOI) and UDTs?

Yes, you can create an AOI taking a UDT as a parameter (or several, if you need, or any combination of UDT's and basic types). I do this often over here, mostly because I converted a bunch of subroutines (pre Version 16.x) to AOI's, and didn't want to change my types.

Here is a Non-UDT sample version of a motor starter with timers etc from the Rockwell web site... Look up
Motor Sequence Starter with timers to start & stop
on the first page of .. well, can't link directly there, but look up samplecode.rockwellautomation.com, pick PLC, ControlLogix, and AOI's.
 
Last edited:
Maybe consider using Program Tags in place of Controller Tags as another method.

AOI, UDT and PRogram Tags can all be ways to help do what you need.

OG
 
Thank you for your replies!
I think I will define a UDT for the motor and all its related tags, then I will use an AOI having the motor tag as its only parameter.
I have a doubt, tough. I think that in my case I have to define the motor tag in the AOI as InOut (am I right), so my question is if I have to use additional code for the outputs (for example the motor enable bit). I read somewhere else in the forum, regarding the AOIs: "Output parameters, you might want to tag directly to a physical output, so passing by value eliminates extra copy logic to convert the reference output to a physical output." (this is yours rdrast)
 

Similar Topics

Good day All, Are there ways to recycle exhausted air bank into air receivers?
Replies
12
Views
2,543
:( I have a problem with a timer that does not time out but keeps cycling. I have this timer's N.C. Done bit in the rung as well the next timer I...
Replies
3
Views
2,135
Hello, I am trying to read a barcode scanner input using a cognex dataman 280 barcode reader, store it another string, the compare with another...
Replies
1
Views
62
Hi there, I'm new to plc programming and was wondering why I get this error code when I run my simulation for these temperature sensors? What I'm...
Replies
2
Views
85
Hi All, Someone at work has put a PLC system on my desk, that's just been taken off an idle production line. He said "It's an S7 PLC. We don't...
Replies
10
Views
284
Back
Top Bottom