functions in S7 Simatic

botr

Member
Join Date
Feb 2006
Location
Zary
Posts
15
I have to write functions which will read in DB suitable word .
The address of word be passed as number 0-100
0 - DBW0
1 - DBW2
2 - DBW 4
3 - DBW 6
4 - DBW 8
5 - DBW 10
I ask about help very
To possibly function in STL or SCL
I greet
 
If you don't need to specify the DB, its already open, then you can indirectly address the dataword. The pointer must be in WORD format.

example

L DBW[W_Pointer]

where W_Pointer is a variable of WORD format.

If you need to specify the DB as well, there are a number of different ways, need to say what you want to do.
 
number DB is constant
For example:
OPN DB20
L #variable
L 1
<>I
SPB aa1
L DBW2
T MW10
aa1:
L #variable
L 2
<>I
SPB aa2
L DBW4
T MW10
aa2:
.........
.....
.....
 
botr

I am not sure if I understand you correctly, but there is a Siemens Function that will do what I think you are trying to do.

Take a look at FC86 TBL_FIND TABLE, this is located in 'Standard Library' -> 'TI-S7 Converting Blocks', this might do what you want

Paul
 
Here is an FC that will perform the function requested:

Code:
FUNCTION FC 2 : VOID
TITLE =read dbwx where x=iIndex * 2
VERSION : 0.1

VAR_INPUT
  dbBlock : BLOCK_DB ; 
  iIndex : INT ; 
END_VAR
VAR_OUTPUT
  iResult : INT ; 
END_VAR
BEGIN
NETWORK
TITLE =fetch dbwx where x=iIndex * 2
	  OPN   #dbBlock; 
	  L	 #iIndex; 
	  SLD   4; 
	  LAR1  ; 
	  L	 DBW [AR1,P#0.0]; 
	  T	 #iResult; 
	  SET   ; 
	  SAVE  ; 
END_FUNCTION
 
PLucas said:
botr

I am not sure if I understand you correctly, but there is a Siemens Function that will do what I think you are trying to do.

Take a look at FC86 TBL_FIND TABLE, this is located in 'Standard Library' -> 'TI-S7 Converting Blocks', this might do what you want

Paul

I believe this FC is to search for a pattern.
 

Similar Topics

Hi, can anyone pl. let me know how to unlock the library functions in Simatic Step-7 environment? Pl. also let me know how to lock the functions...
Replies
13
Views
6,750
Two questions for GE/Emerson e.g. PACSystemsRX3i (CPE330): 1. Is it possible to use 2D arrays inside a function as a local member? (I can only...
Replies
0
Views
33
For a while, I have been working with InTouch 10.1. The problem I am currently facing is the need to implement certain functions that do not...
Replies
0
Views
480
I've uploaded a raw program from an old Hitachi EC-40HARP that is to be replaced by something else. I have to do some reverse engineering as the...
Replies
1
Views
427
Is there a way in CX-Programmer to call functions from a structured text program? I have found this manual that seems to describe the process...
Replies
1
Views
1,060
Back
Top Bottom