ADoozer
Member
Hi all.
First off, I would like to say this is an excellent forum I have been browsing anonymously for years.
Secondly, I am Rockwell to the core.
Anyway, some background:
I recently inherited a project (Siemens) where a particular FC is causing issues (The FC works perfectly fine as is, but needs a slight modification to accommodate a change required in the complete system). The FC was written initially in SCL, but since its compilation date (October 2008) the SCL file has been "lost". Unfortunately the archives on site and in the office only span back to 2009 and do not contain the file.
I have been trying to reverse engineer the code, with varying success. (I am using the Siemens Simatic Statement List (STL) for S7-300 and S7-400 programming refernce manual [6ES7810-4CA10-8BW1]) and have managed to partially write some SCL which generates segments of the STL.
I know what the FC does, I also know that it is using SFC20 (or possibly SFC81) to copy whole DBs (the FC is basically a FIFO controller with a few bells and whistles).
And now, the question.
The following bold lines have me stumped:-
L W#16#44C <-this is a reference to DB <1100> (the "empty" DB)
T LW 28 <- what is LW?
OPN DB [LW 28] <-we are now opening DB1100 as a shared DB
L DBW 0 <- load 0 into ACCU 1
T #Clear <- sets temp variable #Clear to 0
L #Blk_1_Nr <- previously set to (last DB - count DBs + 1 e.g. 1101)
T LW 28 <- what is LW?
L #Bw_1_Nr <previously set to 18ITD
L L#8 <- what is L# (8 is for * to get bytes in DB I think)
*D
OPN DI [LW 28] <- open DB1101 as an instance DB
LAR1 <- assume this is now the pointer to DB1101.DBX18.0
L DIW [AR1,P#0.0] <- fetches the DB status word
T #Value1 <- copy to temp variable #Value1
A L 10.1 <- i think this is comparing #value1.1 (log complete)
A L 10.2 <- i think this is comparing #value1.2 (data ready)
JCN A7d0 <- conditional jump if RLO is 0
The pseudo code goes something like:
If DB<1101>.DBX18.1 (Log_Complete) AND DB<1101>.DBX18.2 (Data_Ready)
SFC20 (or possibly SFC81) SRC: DB1100, DST DB<1101>
I think I can probably work out the code if I could just figure out the syntax.
Can anybody shed some light or point me to a comprehensive STL manual.
Many thanks in advance
Dave
First off, I would like to say this is an excellent forum I have been browsing anonymously for years.
Secondly, I am Rockwell to the core.
Anyway, some background:
I recently inherited a project (Siemens) where a particular FC is causing issues (The FC works perfectly fine as is, but needs a slight modification to accommodate a change required in the complete system). The FC was written initially in SCL, but since its compilation date (October 2008) the SCL file has been "lost". Unfortunately the archives on site and in the office only span back to 2009 and do not contain the file.
I have been trying to reverse engineer the code, with varying success. (I am using the Siemens Simatic Statement List (STL) for S7-300 and S7-400 programming refernce manual [6ES7810-4CA10-8BW1]) and have managed to partially write some SCL which generates segments of the STL.
I know what the FC does, I also know that it is using SFC20 (or possibly SFC81) to copy whole DBs (the FC is basically a FIFO controller with a few bells and whistles).
And now, the question.
The following bold lines have me stumped:-
L W#16#44C <-this is a reference to DB <1100> (the "empty" DB)
T LW 28 <- what is LW?
OPN DB [LW 28] <-we are now opening DB1100 as a shared DB
L DBW 0 <- load 0 into ACCU 1
T #Clear <- sets temp variable #Clear to 0
L #Blk_1_Nr <- previously set to (last DB - count DBs + 1 e.g. 1101)
T LW 28 <- what is LW?
L #Bw_1_Nr <previously set to 18ITD
L L#8 <- what is L# (8 is for * to get bytes in DB I think)
*D
OPN DI [LW 28] <- open DB1101 as an instance DB
LAR1 <- assume this is now the pointer to DB1101.DBX18.0
L DIW [AR1,P#0.0] <- fetches the DB status word
T #Value1 <- copy to temp variable #Value1
A L 10.1 <- i think this is comparing #value1.1 (log complete)
A L 10.2 <- i think this is comparing #value1.2 (data ready)
JCN A7d0 <- conditional jump if RLO is 0
The pseudo code goes something like:
If DB<1101>.DBX18.1 (Log_Complete) AND DB<1101>.DBX18.2 (Data_Ready)
SFC20 (or possibly SFC81) SRC: DB1100, DST DB<1101>
I think I can probably work out the code if I could just figure out the syntax.
Can anybody shed some light or point me to a comprehensive STL manual.
Many thanks in advance
Dave