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
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]
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.
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
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".
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
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
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.
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
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.
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.
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