Let’s talk about mathematical operations in the allen bradley plc. There are four main operations which you can use when doing calculations in your plc program. Here is a basic overview of these operations. We get the same operations as we would in conventional programming languages as you may have guessed. We have addition, subtraction, multiplication and division operations which we can use in our plc programs.
What are the operations in plc programming?
MUL is one of the operations that can be used. It is important to note that constants are only allowed in one source value at a time. As it generally is quite pointless just multiplying two constant numeric values together over and over again. So be sure to make use of only one constant on your rung. MUL is the multiply operator and allows you to multiply two values together and store them in the Dest register.
DIV is the division operator and can be used for any division which you need to do. Depending on the dest type you could potentially have a rounded off value if it’s an integer or a value with decimal places if not.
ADD as you may have guessed is for addition in your plc programs. It too uses two source values and saves to a dest value.
SUB is subtraction and can be used to do subtraction calculations. Same as with add it uses two source values and yet again saves it to dest value.
We have put together a small example of what this might look like in your ladder diagram below. It should be quite simple to see how all this fits together if you look at the below diagram.
Example ladder diagram
plc programming mathematical operations
Some other plc programming resources which you can look at
Unlike conventional programming language paradigms which make use of some type of if else conditional type constructs. PLCs make use of a logical circuit type methodology called ladder. Ladder consists of rungs and branches which is used to add instructions to your plc programs. These allow of certain inputs and outputs on your plcs to be turned on and off with basic logic. Ladder is a graphical language which can be drawn with some logical form in order to control your plc unit.
What software do I need to program ladder?
Generally it is common to make use of some software which contains the ladder functions. Software such as rs logix is used to program ladder logic. Here is an example of ladder logic in rs logix.
Ladder example of a plc program
Some basic ladder stuff
Some of the most basic instructions can build quite awesome programs. Just with XIC, XIO and OTE you can build so many circuits. XIC is examine if closed. XIO examine if open and OTE is output energized. Outputs sit on the right side of your rungs on your ladder program. On the left is your inputs of your program. The left gets evaluated then executes your outputs. XIO will be evaluated when the switch is open. The easiest way to learn to program in ladder is to create your own little project and build it in the rs logix platform.
What do I need to learn next?
Start by learning a few ladder instructions there quite a few more such as ons,osf,osr, ton and more which will allow you to do more complex ladder programs later on and really improve your skills. Below are some more free plc programming resources which you can check out. The owner of the blog updates it with new tutorials all the time and gives a positive spin on the content.
Are you looking for a software development company as a long term partner?
Our review on our favorite software development company. Every now and then we like to give some company in the software and game development space a chance to shine. Which is why we have brought you this article on one of our favorite development companies.
One of the reasons we are reviewing software labs today is that they stand out from the rest for us as they don’t just provide excellent service to their clients and are also striving to educate everyone on the art of development. Completely for free. Software labs are a company which understands the value of knowledge. They encourages all people to have an understanding of software development. Software labs runs a tech blog as well. Where they provide free tutorials on plc programming, python programming, php development,machine learning,machine vision and game development.
History of software labs as a development company
Software labs was founded on the basis of not just building great software but also teaching individuals about software development. Software labs started in January of 2016 and has risen to the challenge. Although starting out as a company providing business solutions to many top end customers and then moving into other spaces. Such as artificial intelligence, machine vision, automation engineering and much more. It’s no doubt that software labs should be your partner of choice when wanting software developed or any form of development required.
Description of software lab’s services
Software labs has extensive experience in the machine learning and data science space. Boasting case studies from online casinos, stock market prediction and industrial controls for optimizing manufacturing.
With use cases of machine vision in the security industry, packing industry and others which require the ability to recognize objects through software.
Case studies in the plc programming business is vast automating machinery in production lines from chips suppliers to mining applications throughout africa.
Software labs prides themselves in their new found department in the game development space. Building gamification systems for the corporate world motivating employees to work harder and more efficiently.
Software labs as a pretoria software development company have provided hundreds of custom software solutions to businesses out of their pretoria based branch and have hundreds of satisfied customers.