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 ADD to add one piece of data to another.
  • 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)

Ladder Diagram to implement mathematical arithmetic functionsplc-program-mathematical-functions-01

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.


If you find any mistake above, kindly email to [email protected]

Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.