Categories

5 Tips for Getting Started in RSLogix 5000

5 Tips for Getting Started in RSLogix 5000

RSLogix 5000 is very intuitive and easy to use PLC programming software used for Allen-Bradley PLCs. There are a few tips and tricks that are very useful to know starting out, especially if coming from a different PLC programming language. These will help increase efficiency, improve code structure, and avoid time-consuming downloads when commissioning.

Set up Quick Keys for the Ladder Editor 

Clicking around to build the Ladder code for PLCs can be time consuming. Rockwell has keyboard shortcuts to minimize mouse usage and increase productivity, however, this is not enabled by default. To enable keyboard shortcuts, navigate to Tools > Options and check Enable Quick Key. Custom quick keys can be selected under Configure.

Photo of RSLogix 5000 Ladder Editor Quick Keys

Note that when quick keys are enabled, Enter must be pushed in order to type a tag name in an instruction if a quick key is assigned to the letter the tagname starts with. I like to keep B, R, I, and S clear because most of my tags are booleans, reals, integers, or strings and I prefix them with the first letter of the tag type. When you inevitably forget to hit enter before typing the tag which starts with a quick key, just press ctrl-Z until all extra instructions are removed. 

Create Enumerations 

RSLogix does not have a built-in structure for enumerations. However, one can easily be created to make code more readable in state machines, machine modes, and anything else that has an integer state. Start by creating a User-Defined Data Type with each state of the enumeration created as an INT: 

Photo of Creating Enumerations in RSLogix 5000

Declare an instance of this User-Defined Data type in a parameters area that is applicable to where you need the enumeration. In this example, it is declared in Controller tags to allow it to be accessed from anywhere.  

Photo of RSLogix 5000 Enumeration Values

Once created, set the initial value of each state to the desired enumeration value, then set the tag as a constant. 

Anytime the mode is accessed in the PLC, it can be set or compared using this tag. 

Image of RSLogix 5000 Tag

Prevent Inputs and Outputs from Changing Mid-scan 

Allen-Bradley PLCs continuously scan IO while the logic is being evaluated. This can cause faster reaction times when code is written to accommodate it. Yet depending on how the logic is written, it can also cause edge cases and odd behavior from a machine. Having consistent IO data for the entire scan simplifies logic and helps prevent edge cases. Remapping IO also has the added benefit of allowing custom tag names for each IO point. To start, create a program with a subroutine for mapping inputs and one for mapping outputs. 

Image of creating a program with a subroutine for mapping inputs and outputsĀ 
 
Within R_01_ReadInputs, write the IO point to the variable for it. 

Image of writing IO point in RSLogix 5000

Within R_60_WriteOutputs, tie the variable to the IO point associated to it. 

Image of tieing IO point in RSLogix 5000
 
Then, call the R_01_ReadInputs subroutine before calling any logic, and call R_60_WriteOutputs after all logic is complete. Use the locally defined variables in the logic, and all IO will have the same value throughout the scan. 

AOI and Data types cannot be changed online 

Add-on instructions can be extremely useful for creating multiple instances of the same logic within RSLogix 5000. They have true function features, including instance memory, input and output variables, and the ability to define multiple instances. This makes AOIs great for writing modular reusable code. However, it is often crucial to be able to make online changes to avoid interrupting machine use, and any changes made to an AOI cannot be done online. A redownload and PLC stop is required! Therefore, make sure to either 1) Start commissioning by thoroughly testing all AOI logic, or 2) Use AOIs only for simple logic that requires very little testing. 

User-Defined Data Types are also very useful when writing modular code, allowing for easy linking to HMI faceplates, and organization of data. As with AOIs, any modifications to Data Types also requires a redownload and restart of the PLC. 

Flash All Lights with One Piece of Logic

Flashing lights in ladder logic requires a two timers and three lines of code. In order to reduce the amount of times that this logic has to be repeated, a global variable can be defined which will flash all the lights simultaneously with one piece of logic. 

Image of flashing all lights with one piece of ladder logic

Learn more about DMC's Allen-Bradley PLC expertise.

Comments

Jonathan Hale
# Jonathan Hale
Thank you for the handy enumeration technique! I am baffled how such a fancy software as Studio 5000 could omit such a basic tool for good programming practice. Your workaround is pretty handy, although it does not have the enforcement that a language feature for enumerated types would have.

Post a comment

Name (required)

Email (required)

CAPTCHA image
Enter the code shown above:

Categories

Related Blog Posts