SIMATIC S7-200/300/400, Step7, PCS7, CFC, SFC, PDM, PLCSIM,
SCL, Graph, SPS-VISU S5/S7, IBHsoftec, LOGO ...
-
reymond_craig
- Posts: 139
- Joined: Wed Sep 26, 2007 2:57 am
- Location: Philippines
Post
by reymond_craig » Mon Nov 22, 2010 7:44 am
Dear Colleagues,
Good afternoon I encounter an STL code below.
This is inside one FC and called to do specific task.
I cant understand where they get this value
DW#16#
84000000
Please help me expert to understand this code.
Thank you very much in advance.
//---------------
here is in the Variable declaration
Code: Select all
Input
SOURCE_DBNO Int
SOURCE_BEGIN Int
SOURCE_LENGTH Int
DEST_DBNO Int
DEST_LENGTH Int
Temp
POINTER_SOURCE Any
POINTER_DEST Any
RET_V Int
//---------Code-----------
Code: Select all
Network 1
L P##POINTER_SOURCE
LAR1
L P##POINTER_DEST
LAR2
L W#16#1002
T LW [AR1,P#0.0]
T LW [AR2,P#0.0]
L #SOURCE_DBNO
T LW [AR1,P#4.0]
T LW [AR2,P#4.0]
L #SOURCE_BEGIN
SLD 3
OD DW#16#84000000
T LD [AR1,P#6.0]
L DW#16#84000000
T LD [AR2,P#6.0]
L #SOURCE_LENGTH
T LW [AR1,P#2.0]
T LW [AR2,P#2.0]
Network 2
Code: Select all
CALL "BLKMOV" //SFC20
SRCBLK :=#POINTER_SOURCE
RET_VAL:=#RET_V
DSTBLK :=#POINTER_DEST
-
sventek
- Posts: 56
- Joined: Sun Jul 13, 2008 10:48 am
- Location: Europe
Post
by sventek » Mon Nov 22, 2010 8:45 am
Hi!
Please look in the document "Programming with STEP7" in the subfolder documentation in the SIMATIC folder. There you can find a topic "Format of the Parameter Type POINTER". You'll find all information about it.
reymond_craig wrote:DW#16#84000000
describes the type of the memory area. Here it is the hex code for Data block.
Hope this was helpful.
Greetings
sventek
-
dsekulic
- Posts: 186
- Joined: Sun Feb 12, 2006 5:47 pm
- Location: Europe
Post
by dsekulic » Mon Nov 22, 2010 8:45 pm
Hi,
Value DW#16#84000000 sounds to me that it is related with some time. If this is time in miliseconds then if You cut 3 LSB's then You have DW#16#84000 (value in seconds). If You devide this value by 60 (no of seconds in minute) then You have 1400minutes. Maybe something like that.
regards
-
sventek
- Posts: 56
- Joined: Sun Jul 13, 2008 10:48 am
- Location: Europe
Post
by sventek » Tue Nov 23, 2010 6:52 am
dsekulic wrote:Value DW#16#84000000 sounds to me that it is related with some time.
No, that's not right. The code is an example for using indirect addressing. There you have to specify the memory area. DW#16#84000000 is, as I wrote, the hex code for the memory area "Data block".
sventek
-
reymond_craig
- Posts: 139
- Joined: Wed Sep 26, 2007 2:57 am
- Location: Philippines
Post
by reymond_craig » Tue Nov 23, 2010 8:47 am
Thank you very much for the response I guess sventek is right. DW#16#84000000 means it is data block the memory to be used. But how is he able to detect on where he is going to point the value let say the format for normal pointer is P#Db100.dbx0.0 byte10 DB is already for DW#16#84000000 where did he get the code for the other part of the pointer? Also L W#16#1002 i cannot find this in the manual
-
dsekulic
- Posts: 186
- Joined: Sun Feb 12, 2006 5:47 pm
- Location: Europe
Post
by dsekulic » Tue Nov 23, 2010 11:21 am
It is obvious that code is related with indirect addressing, but how do You conclude that DW#16#84000000 is connected with indirect addressing. #SOURCE_BEGIN is Int
Code: Select all
L #SOURCE_BEGIN
SLD 3
OD DW#16#84000000
T LD [AR1,P#6.0]
L DW#16#84000000
T LD [AR2,P#6.0]
I see no conncetion of DW#16#84000000 with indirect addressing. The point is that DW#16#84000000 are stored in LD [AR2,P#6.0] and bitwised OR operation of DW#16#84000000 and shifted #SOURCE_BEGIN by 3 bits in left to LD [AR1,P#6.0]. That's all.
-
manus_a
- Posts: 11
- Joined: Tue Sep 14, 2010 3:16 am
Post
by manus_a » Tue Nov 23, 2010 3:02 pm
hi
my idea that is check DB no.
L B#16#84 // Load DB type code
for my steel mill use this function for check is DB type or not
and
if more than B#16#85 is memory L ( local data )
if less than B#16#84 is memory type I or Q or M
if not correct please reply me
thank
-
lx0520
- Posts: 10
- Joined: Fri Feb 20, 2009 3:02 am
- Location: Taiwan
Post
by lx0520 » Tue Nov 23, 2010 5:04 pm
The code description as fallows:
---------------
here is in the Variable declaration
Code: Select all
Input
SOURCE_DBNO: Int
SOURCE_BEGIN: Int
SOURCE_LENGTH: Int
DEST_DBNO: Int
DEST_LENGTH: Int
Temp
POINTER_SOURCE: Any
POINTER_DEST: Any
RET_V: Int
//---------Code-----------
Code: Select all
Network 1
L P##POINTER_SOURCE // load parameter type any
LAR1 // load accu1 content to AR1
L P##POINTER_DEST // load parameter type any
LAR2 // load accu1 content to AR2
L W#16#1002 // load data format of parameter type any;w#16#1002 means use for S7(w#16#10**,fixed number)
// and data format byte(w#16#**02)
T LW [AR1,P#0.0] // set parameter #POINTER_SOURCE as S7 and data format by byte
T LW [AR2,P#0.0] // set parameter #POINTER_DEST as S7 and data format by byte
L #SOURCE_DBNO // get source DB NO.
T LW [AR1,P#4.0] // put DB NO. to parameter #POINTER_SOURCE
[color=#FF0000]L #DEST_DBNO [/color] [color=#FF0000] // i think you lost this command [/color]
T LW [AR2,P#4.0] // put DB NO. to parameter #POINTER_DEST
L #SOURCE_BEGIN // get start address
SLD 3 // translate to byte address
OD DW#16#84000000 // force the memory area as DB
T LD [AR1,P#6.0] // put memory type(DB) to parameter #POINTER_SOURCE
L DW#16#84000000
T LD [AR2,P#6.0]
L #SOURCE_LENGTH // get repeatition factor
T LW [AR1,P#2.0] // put repeatition factor to parameter #POINTER_SOURCE
T LW [AR2,P#2.0] // put repeatition factor to parameter #POINTER_DEST
Network 2
CALL "BLKMOV" //SFC20
SRCBLK :=#POINTER_SOURCE // copy the source DB data by byte
RET_VAL:=#RET_V
DSTBLK :=#POINTER_DEST // write the source DB data to destination DB byte by byte
this STL code copy source DB data to destination DB as byte by byte
Please see the "ANY format of parameter types" with Step7 online help document then you understood.
Regards.
-
manus_a
- Posts: 11
- Joined: Tue Sep 14, 2010 3:16 am
Post
by manus_a » Wed Nov 24, 2010 2:50 pm
Thank lx0520 for your reply
I have S7-400 experience for 2 years,
before revamp i use S5 155U PLC CPU 948 .
for me programing S7 more easy than S5.
thank you.
-
reymond_craig
- Posts: 139
- Joined: Wed Sep 26, 2007 2:57 am
- Location: Philippines
Post
by reymond_craig » Sun Nov 28, 2010 11:24 am
Thank you very much lx0520 you are really expert on this.
I wish you are my workmate.
Now I understand the code.
Im really thankful to you guys specially to lx0520.
Godbless us all
-
lx0520
- Posts: 10
- Joined: Fri Feb 20, 2009 3:02 am
- Location: Taiwan
Post
by lx0520 » Mon Nov 29, 2010 10:38 am
To Mr. manus_a and reymond_craig
I think your better than you think you are.