Home » Statement List (STL) to Find Highest Value
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.

Insert Data Block in Siemens S7 300

Step 2:

Create Data Value in the Data Block.

Create Data Value In Data Block

Step 3:

Insert Function

Insert Function in Siemens S7 300

FC1 Object Name

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

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

STL Code to find Maximum Value

Author: Rahul khaladkar

Read Next:

Share With Your Friends

Related Articles

Introduction to SCADA

S Bharadwaj Reddy

Siemens TIA Portal Free Version Download

S Bharadwaj Reddy

Ladder Logic for Stair-Case wiring using Toggle Switches

S Bharadwaj Reddy

Quiz Program Logic Using PLC Programming

S Bharadwaj Reddy

PLC Logic GATE Program

S Bharadwaj Reddy

Components of SCADA

S Bharadwaj Reddy

Leave a Comment

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Statement List (STL) to Find Highest Value

WordPress Image Lightbox
Send this to a friend