Logix Programming Instructions Every Tech Needs to Know, Part I

Image by Brandon Cooper

Learning to program anything takes time and effort. The more investment that you make, the greater the return.

When I have set out to embark on learning a new system, I first browse through other people’s code in the system to learn the standard way of doing things, the common instructions, if you will.

I then print out the help files and parameter lists for those instructions and read them until I understand them.

In this article, I want to look beyond the basic XIO, XIC instructions and look at a few others that may be of use to you if you are becoming familiar with ControlLogix programming.

The following are just a few of my go-to instructions and favorites. Maybe they will be of use to you as well.

CPT (Compute Instruction)

In the following illustration I’m using an ADD (Addition) block, then a DIV (Division) block and then a MUL (Multiplication) block to come to a result of an average profit of selling cars per day for the last four days.

There is certainly nothing wrong with doing logic in this manner. In fact, it is very easy to follow and very organized.

Image by Brandon Cooper

However, for the sake of efficiency and in general just another way to approach this is to use a CPT (compute) instruction.

In the expression of the Compute instruction, you can do complex math equations in the single instruction. Since this may be a little more difficult to troubleshoot, good rung comments would be a good practice to follow in this scenario.

As you can see in this screenshot, the slash is used for division and the asterisk is used for multiplication. The help documentation in Studio 5000 will help further if needed.

Image by Brandon Cooper

ABS (Absolute Instruction)

Another instruction that will come in handy is the ABS or absolute value instruction.

A typical use of this instruction would be, as shown below, to create an alarm based on the signal difference of two separate transmitters that are designed to measure the same variable.

Using the SUB (subtract) instruction, I subtract the value of one transmitter from the other transmitter. It doesn’t matter which one you subtract from the other, because you then use the ABS instruction to make the value positive.

Now that the absolute value is positive, you can then use a GRT (greater than) instruction to create the signal difference alarm at whatever value you choose.

 Image by Brandon Cooper

Conclusion

As referenced in the opening of this article, a great way to learn to program is to look at what other people have previously done.

Take some time to look through the programs available to you, the example projects in your studio 5000 library and there are many tutorials online for Rockwell products.

Then set yourself up an emulator system or test system and have fun!

Written by Brandon Cooper
Senior Controls Engineer and Freelance Writer

Have a question? Join our community of pros to take part in the discussion! You'll also find all of our automation courses at TheAutomationSchool.com.

Sponsor and Advertise: Get your product or service in front of our 75K followers while also supporting independent automation journalism by sponsoring or advertising with us! Learn more in our Media Guide here, or contact us using this form.

Brandon Cooper
 

LEAVE A REPLY

Please enter your comment!
Please enter your name here