to determine max and min value from DB

plc2000

Member
Join Date
Jun 2009
Location
Europe
Posts
6
Hi

I am trying to determine (online) max and min value from DB. Anybody may help me and give me any example how I may to cope with this problem ??

I will be grateful for help.

Greetings
 
Source code below:

Code:
FUNCTION FC 1 : VOID
TITLE =
VERSION : 0.1

VAR_INPUT
  dbData : BLOCK_DB ; 
END_VAR
VAR_OUTPUT
  rMax : REAL ; 
  rMin : REAL ; 
END_VAR
VAR_TEMP
  iLoopCount : INT ; 
END_VAR
BEGIN
NETWORK
TITLE =
      L     -3.402823e+038; 
      T     #rMax; 
      L     3.402823e+038; 
      T     #rMin; 
      LAR1  P#DBX 0.0; 
      OPN   #dbData; 
      L     DBLG; 
      L     4; 
      /D    ; 
L1:   T     #iLoopCount; 
      L     #rMax; 
      L     D [AR1,P#0.0]; 
      >=R   ; 
      JC    t2; 
      T     #rMax; 
t2:   L     #rMin; 
      >=R   ; 
      JC    t3; 
      TAK   ; 
      T     #rMin; 
t3:   +AR1  P#4.0; 
      L     #iLoopCount; 
      LOOP  L1; 
END_FUNCTION
 
How you say that? THAT IS STL language.

As you failed to provide info on plc you use. LD assumed you use S7. And that indeed is STL of S7 system.
 
Create an stl source code block in your sources folder, open it, paste in the code, then compile it. FC1 will then appear in your blocks folder.
 
L 0
T MD 90

L 100 // loop 100 times
p1: T MW 50
OPN DB 2 // data type REAL
L MW 51
L 4
*D
SLD 3
L P#DBX 0.0
+D
LAR1

// find max value
L DBD [AR1,P#0.0]
L MD 90
>R
JCN p2
T MD 90
p2: T MD 91 // min value

L MW 51 // counter
L 1
+I
T MW 51

L MW 50
LOOP p1


I know this code is incorrect and isn't finish. Mayby someone help to finish this.
 

Similar Topics

Hello, i am a beginner with a Siemens Logo 8 PLC. I would determine the direction of an object if it passes a whole cycle of 2 input sensors. See...
Replies
2
Views
180
Hi all, Just looking through the CIP_AXIS_DRIVE data type in a Logix controller to look for something that can tell me whether the current...
Replies
2
Views
1,064
I'm currently working on an MES interface PLC which passes around a whole bunch of strings. A lot of these strings are really just to allow for an...
Replies
0
Views
1,113
I don't use AB much these days, and any installs I've done in years past have been setup by myself from scratch, so I've always known what...
Replies
8
Views
2,082
Hello: I wonder if there is a way to find the CPU load of a Logix processor, and if it is not possible to determine this in an absolute way, I...
Replies
6
Views
1,994
Back
Top Bottom