Kkula
Hello ixo65,
i want to compare to analog values,
Case one e.g a>b
Case two a<=b
is the code that you have posted suitable for my case or can you give me an example for my application.I saw your code but still i dont get the point about comparing values!
Thank you in advance
------------------------------------------------------------------------------------------
Split from
Comparing an analog input to a setpoint variable from an HMI
.
Hello! Regarding your need to compare two analog values (a > b and a <= b), the previous code snippets provide a foundation, but let's clarify and tailor it to your application. The core concept revolves around using comparison instructions within your TIA Portal program (S7-1200/1500).
You'll use the following instructions, typically within a Function Block (FB) or Function (FC):
Here's a basic example in LAD. Adapt this to your specific data types (INT, REAL, etc.):
NETWORK 1: // a > b CMP > IW60, IW62 // Compare Input Word 60 (a) > Input Word 62 (b) JMP_IF_TRUE Greater_Than_Block NETWORK 2: // a <= b CMP <= IW60, IW62 // Compare Input Word 60 (a) <= Input Word 62 (b) JMP_IF_TRUE Less_Equal_Block // ... Blocks for handling the results (Greater_Than_Block, Less_Equal_Block)
Important: Replace IW60 and IW62 with your actual analog input addresses or variable names. The 'CMP' instruction sets a status bit based on the comparison result, which 'JMP_IF_TRUE' uses to branch your logic.
If you provide details about your specific PLC (S7-1200/1500), the data types of your analog values, and how you want to *use* the comparison result (e.g., trigger an output, set a flag), I can provide a more targeted example.
Our flexible community website is a platform that allows users to connect, share information, and collaborate on various topics of interest. The website offers a range of features such as discussion forums, messaging, user profiles, event calendars, and more. Users can customize their experience by creating and joining different groups or communities based on their interests or location. The website is designed to be user-friendly and adaptable to the needs and preferences of our diverse user base. Whether you are looking to network professionally, share hobbies and interests, or simply connect with like-minded individuals, our flexible community website has something for everyone. Join us today and become a part of our thriving online community!
India
Copyright ©2026
Share this page with your family and friends.