Modulus Operation in PLC Programming (MOD Block) - OpenPLC Tutorial
Jul 18, 2023
OpenPLC is an open-source Programmable Logic Controller (PLC) that is designed to allow users to learn PLC programming and explore applications of industrial automation in a hands-on manner. It uses a programming standard known as IEC 61131-3, which is a widely accepted standard for PLC programming.
In OpenPLC, the MOD block represents the modulus arithmetic operation. The modulus operation returns the remainder of an integer division. For instance, if you divide 10 by 3, the quotient is 3, and the remainder is 1. In this case, the modulus is 1.
In the OpenPLC environment, you typically use the MOD block by connecting two integer input values: a dividend (IN1) and a divisor (IN2). The output (OUT) of the MOD block would then be the remainder of the division of IN1 by IN2.
As an example, if IN1 is 10 and IN2 is 3, the output of the MOD block would be 1, which is the remainder of the division.
Remember, in any PLC environment, including OpenPLC, you should take care to avoid a scenario where the divisor (IN2) could be zero, as this would result in a division by zero error.
*** Industrial Automation Courses ***
PLC Tutorials
https://instrumentationtools.com/category/plc/
PLC and HMI Training Course
https://learn.automationcommunity.com/courses/learn-plc-and-hmi-programming-with-example-problems/
Omron PLC Training Course
https://learn.automationcommunity.com/courses/omron-plc-training-course-using-cx-programmer/
Show More Show Less #Manufacturing
#Programming
#Robotics

