PLC Tutorials

Statement List (STL) to Find Highest Value

This article explains the detail logic and all steps involved to find the Highest value in given Data block using the Statement List (STL). Also helps to you in array pointer logic in simatic manager.

Statement List (STL) to Find Highest Value

Follow the below setps.

Step 1:

Create Global Data Block write no of data in DB and save it.

Data you can save in dec, bin, int, real format.

We have written data here in dec for our program.

Insert Data Block as shown below.

Step 2:

Create Data Value in the Data Block.

Step 3:

Insert Function

Step 4:

Create Function and write code in STL as given below.

      A     M     40.2                  /// START Search  CMD

      JCN   END

      L     0

      T     MW    50                    // STARTINNG LOCATION OF DATA

      T     MW    56

REOP: NOP   0

      L     MW    50

      SLW   3

      LAR1  

      OPN   "DATA"

      L     DBB [AR1,P#0.0]             // DATA 1ST LOCATIO

      L     MB    56

      >I    

      JC    STR                         //// DATA GREATER THEN CHENG

INC:  L     MW    50

      L     1                           // INCREASE LOACTION 

      +I    

      T     MW    50

      L     MW    50

      L     21                          // IF DATA LOCATION IS EXCCED

      <I                                // CHECK FOR NEXT LOCATION

      JC    REOP

      JU    END

STR:  NOP   0

      L     MW    50

      SLW   3

      LAR1  

      OPN   "DATA"

      L     DBB [AR1,P#0.0]

      T     MB    56

      JU    INC

END:  NOP   0

Statement List (STL) to Find Highest Value in the Data Block

Step 5:

Start search command by using bit M40.2 = True

You can gate Highest value of given data in MW56

Author: Rahul khaladkar

If you liked this article, then please subscribe to our YouTube Channel for PLC and SCADA video tutorials.

You can also follow us on Facebook and Twitter to receive daily updates.

You've successfully subscribed !
Share

Recent Articles

  • PLC Tutorials

Example PLC Program to Control a Pump based on Level Sensors

Learn an example PLC program to control a pump based on level sensors using ladder…

2 weeks ago
  • PLC Tutorials

PLC Timer Application in Security Camera Recording

In the PLC timer application for security camera recording, when motion is detected then camera…

2 weeks ago
  • PLC Tutorials

Batch Mixing with PLC Ladder Logic Program

In this example, we will learn batch mixing with PLC ladder logic program using timer…

2 weeks ago
  • PLC Tutorials

PLC Example on Manufacturing Line Assembly

This PLC example on manufacturing line assembly is an intermediate-level PLC program prepared for the…

2 weeks ago
  • PLC Tutorials

PLC Programming Example with Pushbutton and Motor

In this article, you will learn the PLC programming example with pushbutton and motor control…

3 weeks ago
  • PLC Tutorials

Boolean Logic to PLC Programming

This article teaches how to convert Boolean logic to PLC programming ladder logic with the…

1 month ago