Unlinked DB's in S7

I'm using the new 300 with MMC card. 315DP2.

I changed the program to this:

CALL SFC 84
REQ :=M200.0
SRCBLK :=P#DB203.DBX0.0 BYTE 6000
RET_VAL:=#RetVal
BUSY :=#Busy
DSTBLK :=P#DB205.DBX0.0 BYTE 6000

But it still didn't help... Samme error

RMA: So I guess we can say there are inconsistencies between the English and German help files then...
 
Last edited:
I think that Ken has nailed it.
For both SFC20 and SFC84 it is stated that both source and destination must be specified as ANY pointers.

Does SFC20 work when accessing an unlinked DB on an S7-300 with the MMC card ?
I suspect that the SFC82, SFC83 and SFC84 replaces the SFC20 for access to the MMC card.

edit: Didnt see Bortes last post.
Can you try with something else than 6000 bytes? (just to see if that has to do with the problem).
 
Last edited:
Maybe the German version can help us here - 8124 is described as being "Bereichsfehler beim Lesen eines Parameters". In this case, for some reason, it only says "Bereichsfehler" and not "Bereichslängenfehler", but in my (recent!) experience this has always turned out to be a length problem. Are you sure that DB203 is actually 6000 Bytes long, i.e. last address is 5999, or alternatively, the next address shown in the "END_STRUCT" line is 6000 or more?
 
Well i tried what Jesper wanted, so I changed the pointers to width of 4 bytes only. But I didn't help at all. I saw the code changed but it came back to the same error (was to fast to see the other codes).

Then I tried this small program to make sur it wasn't just working even when it returned that code:

CALL SFC 84
REQ :=M200.0
SRCBLK :=DB203.DBD0
RET_VAL:=#RetVal
BUSY :=#Busy
DSTBLK :=DB205.DBD0
CALL SFC 83
REQ :=M200.1
SRCBLK :=DB205.DBD0
RET_VAL:=#RetVal
BUSY :=#Busy
DSTBLK :=DB203.DBD8

I did try to write it as any pointers but S7 automatically changed it back to my data type.
 
Even tried this but with no luck...


CALL SFC 84
REQ :=M200.0
SRCBLK :=P#DB203.DBX0.0 BYTE 6
RET_VAL:=#RetVal
BUSY :=#Busy
DSTBLK :=P#DB205.DBX0.0 BYTE 6
CALL SFC 83
REQ :=M200.1
SRCBLK :=P#DB205.DBX0.0 BYTE 6
RET_VAL:=#RetVal
BUSY :=#Busy
DSTBLK :=P#DB203.DBX8.0 BYTE 6
 
This may be a wild stab:
Are you sure that the "00" in the error code "A00" doesnt mean that the transfer completed succesfully ?
Have you tried to observe if some changed values gets written in DB205 ?
 
I did try to write it as any pointers but S7 automatically changed it back to my data type.



This raises a question I've often wondered about, when the data type in a parameter description is given as "ANY", does this mean you can use any data type you like, or that you must use an "ANY" data type. If the latter is the case, what have you defined your Bytes as?

This gets more and more curious! I just tried creating a parameter in a DB of type "ANY" and while it accepts the any OK I can't find an Initial Value that S7 will accept. However, if I create a Local Variable in an FB and then choose "ANY" out of the drop down list, the Initial Value gets left blank, but even this gives an error if I try to do it in the DB - weird!
 
Jesper: Yes I have tried that. I tought about the same thing too so I put some dummydata in db203 and tried to move it back and forth but with no luck... It doesn't seem to be moving any data.


RMA: If you actually look at the data of an ANY pointer given as an input you will see it still fills in the fields for size even though you didn't specifiy it. Like if you just use DB200 as an input for the any, looking at word 2 of the any pointer data will give you the actual size of the complete db. So it seems to be a visual thing in Step7
 
Just throwing in some suggestions:

Are you sure that it is DB205 that is the "unlinked" and DB203 that is "normal" ?

Are you sure that both DB203 and DB205 are downloaded to the PLC ?

Try the CREA_DBL to see if you can create a new DB206 for example.
If that works, then try to use WRIT_DBL from a Merker area to DB206.
If that works, then try to use WRIT_DBL from DB203 to DB206.
 
Jesper: Yes I'm sure DB205 and 203 are correct, they are downloaded because I can se them online.

I've tried creating a db using this program but I'm not sure if it's working...

CALL SFC 82
REQ :=M200.2
LOW_LIMIT:=W#16#CE
UP_LIMIT :=W#16#CE
COUNT :=W#16#4
ATTRIB :=B#16#1
SRCBLK :=M0.0
RET_VAL :=#RetVal
BUSY :=#Busy
DB_NUM :=#DBNumber
CALL SFC 84
REQ :=M200.0
SRCBLK :=DB203.DBD0
RET_VAL:=#RetVal
BUSY :=#Busy
DSTBLK :=P#DB206.DBX 0.0 BYTE 4
CALL SFC 83
REQ :=M200.1
SRCBLK :=P#DB206.DBX 0.0 BYTE 4
RET_VAL:=#RetVal
BUSY :=#Busy
DSTBLK :=DB203.DBD8


The DBNumber contains just zero...
 

CALL SFC 82
REQ :=M200.2
LOW_LIMIT:=W#16#CE //CE(hex) = 206(decimal)
UP_LIMIT :=W#16#CE
COUNT :=W#16#4 //4 bytes
ATTRIB :=B#16#1 //1=unlinked
SRCBLK :=M0.0 //This has to be an ANY pointer !
RET_VAL :=#RetVal
BUSY :=#Busy
DB_NUM :=#DBNumber //A return value with the DB number that was created.


The only error that I can see is that SRCBLK must be an ANY pointer.
 
I can create a DB in the load memory not in the work memory... Hmmm strange. It's just like I can't access the memory
 
I meant vice versa.... Typo!!:confused:


I gave up... I created a DB in my work memory and used that and then deleted it afterwards... Works for now (until my memory is filled up...)
 
Dear Borte:

I've used unlinked DB for a registering application. You can't connect to an unliked DB, but you can download it to your PC to see if you have succesfully written it.

You can use SFC84 to copy or write data to a diferent DB created on the MMC (unlinked). It works correctly.

I had a problem with the ANY format. I've solved it with this funtion
DB_ANY is local variable of type ANY
DB_number is a local variable with the DB's number
L P##DB_ANY
LAR1
L B#16#10
T LB [AR1,P#0.0]
L B#16#19
T LB [AR1,P#1.0]
L W#16#1
T LW [AR1,P#2.0]
L W#16#0
T LW [AR1,P#4.0]
L #DB_number
T LD [AR1,P#6.0]

The complete code:
L P##DB_ANY_source
LAR1
L B#16#10
T LB [AR1,P#0.0]
L B#16#19
T LB [AR1,P#1.0]
L W#16#1
T LW [AR1,P#2.0]
L W#16#0
T LW [AR1,P#4.0]
L #DB_number_source
T LD [AR1,P#6.0]
Next segment:
L P##DB_ANY_Destination
LAR1
L B#16#10
T LB [AR1,P#0.0]
L B#16#19
T LB [AR1,P#1.0]
L W#16#1
T LW [AR1,P#2.0]
L W#16#0
T LW [AR1,P#4.0]
L #DB_number_Destination
T LD [AR1,P#6.0]
Next Segment:
U #execute
= L 20.0
BLD 103
CALL SFC 84
REQ :=L20.0
SRCBLK :=#DB_ANY_source
RET_VAL:=#Error_Code
BUSY :=#busy
DSTBLK :=#DB_ANY_Destination
NOP 0

I hope this helps
Kelkoon
P.S.You are still limited by the size of the Block (16kBytes in 315-2DP) You should make a function to write in several unlinked blocks. I have one in SCL but the code is too long, if you want it please send me a private message and I'll mail it to you.
 
Last edited:

Similar Topics

I have a programm in a Siemens S7 313C CPU that stores recipe-data in and extracts recipe-data from an unlinked datablok. With an unlinked...
Replies
0
Views
1,680
Back
Top Bottom