# PLC Program to do Mathematical Functions

«
»

This is a PLC Program to do Mathematical Functions.

Problem Description

Implement various mathematical functions in PLC using Ladder Diagram programming language.

Problem Solution
• Use all the Math Instructions to implement various Mathematical Arithmetic Functions.
• Use SUB to subtract one piece of data from another.
• Use MUL to multiply one piece of data by another.
• Use DIV to divide one piece of data by another.
• Use SQR to find the square root of a piece of data.
• Use NEG to change the sign of a piece of data.
PLC Program

Here is PLC program to do Mathematical Functions, along with program explanation and run time test cases.

```List of Inputs and Outputs
I:1/0		= Input to Add				(Input)
I:1/1		= Input to Subtract			(Input)
I:1/2		= Input to Multiply			(Input)
I:1/3		= Input to Divide			(Input)
I:1/4		= Input to find Square Root		(Input)
I:1/5		= Input to change the sign of a Number	(Input)
N:7/0 to N:7/9	= Integer Number Location		(Input)
O:6		= Display				(Output)```
Program Description
• Program is very clear to understand.
• N7:0 to N7:9 contain Integers of which operation is to be performed.
• In the ADD instruction, data of N7:0 and N7:1 are added and sent to destination which is Display with output address O:6.
• Similarly all other operations are performed.
• Though, we must know that the answers stored in the destination are in Hexadecimal form, hence we have to convert this data into BCD form and then send it to display output O:6.

Sanfoundry Global Education & Learning Series – PLC Algorithms.
To practice all PLC programs, here is complete set of 100+ PLC Problems and Solutions. 