Using SFC20 to copy SDB's

L D[AR2P#0.0]

Lifetime Supporting Member
Join Date
Nov 2006
Location
UK
Posts
6,694
I came across the following coding method which appears to use SFC20 to copy from SDB200 (the SDB used for configured connections) by specifying the source area as DW#16#89000000

Has anyone any experience of using SFC20 for this purpose ?

Code:
      L     P##psource
      LAR1  
      L     W#16#1002
      T     W [AR1,P#0.0]
      L     2
      T     W [AR1,P#2.0]
      L     200
      T     W [AR1,P#4.0]
      L     DW#16#89000000
      T     D [AR1,P#6.0]
      CALL  SFC   20
       SRCBLK :=#pSource
       RET_VAL:=MW100
       DSTBLK :=#WData
 
L P##psource
LAR1
L W#16#1002 // = S7 BYTE
T W [AR1,P#0.0]
L 2 // = Repetition 2 (bytes).
T W [AR1,P#2.0]
L 200 // = DB number 200
T W [AR1,P#4.0]
L DW#16#89000000 // = memory area (*)
T D [AR1,P#6.0]
CALL SFC 20
SRCBLK :=#pSource
RET_VAL:=MW100
DSTBLK :=#WData

*: From Hans Berger and STEP7 online help I know that the memory area is specified as
81 = inputs
82 = outputs
83 = Merkers
84 = DB
85 = IDB
86 = L-Stack
87 = Previous L-Stack

If 89 = SDB, then that is undocumented.
Could be true. I never thought of that you could poke around in the memory like that with SFC20.
 
I've tried using SFC20 to copy SDB122 in a 317-2DP CPU but SFC20 reports an error saying the DB is not loaded.

I came across the 89 area when wading about in the code recently posted by pethoek concerning SFB14/FB14 - it's in the library that I posted in the thread.
 

Similar Topics

Hi all, i have learned siemens sample code by using sfc 20 for data move. but i don't know how i can adapt this sample code if i would like to...
Replies
0
Views
2,005
I have a project to automate four generator sets. The system will monitor and store the load demand of the factory. Once there's Power outage, the...
Replies
0
Views
42
Adding ethernet equipment to an existing panel that has none. We have some solid ethernet cables coming from other remote cabinets that I plan to...
Replies
3
Views
104
I'm trying to control a device via MODBUS RTU and the ModbusRtuMasterV2_PcCOM in Twincat 3. I've configured a device with the right com port and...
Replies
7
Views
204
Hi, I'm trying to use the IO Device Library (Product Versions) which is configured to work with the 1756-EN4TR & 1756-EN2TR but my system uses...
Replies
0
Views
52
Back
Top Bottom