Simatic S7 Question

arocon

Member
Join Date
Oct 2006
Location
Dubai
Posts
171
Could anyone please explain me the following code ? How do it got DB number ? What is the use of the current_offset and RT_Int_ Offset? Why used in the code ITD, SLD 3, LAR1 ?? What is doing the code in between CNT and LOOP_CNT ?

// set BR = 1
SET
SAVE

// load constants
L "GlobalConstants".RT_Int_DB
T #DB_To_Open

L "GlobalConstants".RT_Int_Number
T #RT_Number

L "GlobalConstants".RT_Int_Size
T #RT_Size

L #Table_ID
T #Table_ID_Temp

// check for a valid DB number
L 0
L #DB_To_Open
==I
SPB DNE
T #DB_To_Open

// open block
AUF DB [#DB_To_Open]

L 0
T #Current_Offset

L #RT_Number

CNT: T #RT_Int_Counter
L #Current_Offset
ITD
SLD 3
LAR1
// offset for table id is 12
L DBW [AR1,P#12.0]
L #Table_ID_Temp
==I
SPB OFD
L #Current_Offset
L #RT_Size
+I
T #Current_Offset
L #RT_Int_Counter
LOOP CNT
DNE: L 0
T #RT_Int_Offset
BE
OFD: L #Current_Offset
T #RT_Int_Offset
BE


Thanks
 
How do it got DB number ?


Back in the mists of time, the author of this program decided to create a global constants data block. In that data block he decided to store the number of the data block relevant for this code segement. Why he did this, we will probably never know. Maybe he was waiting for some potatoes to cook and they took longer than expected ?

Code:
[SIZE=3][FONT=Times New Roman]L     "GlobalConstants".RT_Int_DB[/FONT][/SIZE]
[SIZE=3][FONT=Times New Roman]T     #DB_To_Open
[/FONT][/SIZE]


later on in this epic program, we find:

Code:
[FONT=Times New Roman][SIZE=3]// open block [/SIZE][/FONT]
[SIZE=3][FONT=Times New Roman]      AUF   DB [#DB_To_Open]
[/FONT][/SIZE]




 

Similar Topics

HI i would like to know how to get a variable that will store the amount of times a program has been executed. The issue is I have 3 DBs for 1 FB...
Replies
2
Views
73
Hi, first post here so sorry for it being a noob question but what can I do .. I need help (and of course I need it yesterday :banghead: ) The...
Replies
11
Views
5,901
Hey all. I've got a query for you. Does it require more of the processor of a PLC to generate the time value everytime a timer is called upon...
Replies
8
Views
1,416
Could anyone tell me when Network 9 will be enable ? or when value of OUTV will change ? Thank you
Replies
1
Views
1,801
In one network SFC20(BLkMOV) is used to transfer 8 byte data from P#DB500.DBX8.0(SRC BLK) to P#DB20.DBX4.0(DST BLK). I would like to change...
Replies
2
Views
4,266
Back
Top Bottom