BlockMove IO signals to DB

Rusty_K

Member
Join Date
Mar 2004
Location
Norway
Posts
73
Hello All!

I'm, trying to "BlockMove" a group of inputs/outputs to a DB for interaction with a WinCC SCADA system on a Siemens 412-2DP CPU. (The folks here feel more secure about the SCADA dealing with copies of the input/ output values instead of the actual live ones..prevents any chance of setting an output via WinCC etc etc..) I'm using an Any pointer to do this and although I do get vaues in my DB, they do not correspond to the live I/Os. Here's my code..any idea's on what exactly I'm doing wrong.

// Build Any Pointers To Transfer Robot IO Data To WinCC DB
// Build Any Pointer For Source IO Block (Robot System IOs)

LAR1 P##RobotIO_SRCBLK_AnyPoint
L B#16#10 // Constant 10h for S7
T B [AR1,P#0.0]
L B#16#2 // Data Type (02h = Byte)
T B [AR1,P#1.0]
L W#16#4 // Area size (In This Case Number of Bytes (Data Type Multiplier))
T W [AR1,P#2.0]
L W#16#0 // Data Block Number ( Not A DB Therefor Value = 0)
T W [AR1,P#4.0]
L B#16#81 // Data Type (81h = Input Area)
T B [AR1,P#6.0]
L B#16#0 // Load 0 for Byte 7 ( Last 3 Bits Not Needed Since Max Offset < 8191 )
T B [AR1,P#7.0]
L W#16#50 // Offset For Start Position of Input Address (I80.0)
T W [AR1,P#8.0]

// Build Any pointer For Destination DB (WinCC Robot Data DB)
LAR1 P##RobotIO_DSTBLK_AnyPoint
L B#16#10 // Constant 10h for S7
T B [AR1,P#0.0]
L B#16#2 // Data Type (02h = Byte)
T B [AR1,P#1.0]
L W#16#4 // Area size (In This Case Number of Bytes (Data Type Multiplier)
T W [AR1,P#2.0]
L W#16#55 // Data Block Number (DEC 85)
T W [AR1,P#4.0]
L B#16#84 // Data Type (84h = DB)
T B [AR1,P#6.0]
L B#16#0 // Load 0 for Byte 7 ( Last 3 Bits Not Needed Since Max Offset < 8191 )
T B [AR1,P#7.0]
L W#16#0 // Offset For Start Position in WinCC Robot Data DB (0)
T W [AR1,P#8.0]

// Transfer Trolley Counter Data From "Current Lots" DB to "Client Request" DB
CALL "BLKMOV"
SRCBLK :=#RobotIO_SRCBLK_AnyPoint
RET_VAL:=#RobotIO_ReturnVal
DSTBLK :=#RobotIO_DSTBLK_AnyPoint

Thank you kindly for your time and help.....Cheers!

R.K.
 
If you are doing it directly, why are you bothering to build a pointer, why not just

Code:
  // Transfer Trolley Counter Data From "Current Lots" DB to "Client Request" DB
  CALL "BLKMOV"
  SRCBLK :=I 80.0 BYTE 4
  RET_VAL:=#RobotIO_ReturnVal
  DSTBLK :=DB85.DBX0.0 BYTE 4

EDIT, sorry put 2 as the dest length.
 
Last edited:
As far as the pointer goes

Code:
  LAR1 P##RobotIO_SRCBLK_AnyPoint
  L B#16#10 // Constant 10h for S7
  T B [AR1,P#0.0]
 L B#16#2 // Data Type (02h = Byte)
  T B [AR1,P#1.0]
 L W#16#4 // Area size (In This Case Number of Bytes (Data Type Multiplier))
  T W [AR1,P#2.0]
 L W#16#0 // Data Block Number ( Not A DB Therefor Value = 0)
  T W [AR1,P#4.0]

that parts OK

this bit

Code:
 L B#16#81 // Data Type (81h = Input Area)
  T B [AR1,P#6.0]
 L B#16#0 // Load 0 for Byte 7 ( Last 3 Bits Not Needed Since Max Offset < 8191 )
  T B [AR1,P#7.0]
  L W#16#50 // Offset For Start Position of Input Address (I80.0)
  T W [AR1,P#8.0]


the first two bits are OK if you stay below a certain address as you point out. The byte address is incorrect. If you want 80 as the byte address, then you need to SLW3, as the last 3 bits are the bit address (0-7).

I would do that last bit.

Code:
 L 80 // Input Address for IB80
 SLD3
 L D#16#81000000 // Data Type (81h = Input Area)
 OD
  T D [AR1,P#6.0]


You DB address ws OK simply because you started at DBB0.
 
If you don't need to transfer too much info, then you could just use a list of load/transfers, eg:

Code:
L ID 80
T DB85.DBD0
..
..

Alternatively, set up some DB's to mirror the I/Q/M areas and just copy the whole lot to the DB's. The SCADA can then access the DB's and the address in the DB will tie up with the address in the I/Q/M area.

Code:
	 CALL "BLKMOV" (
		 SRCBLK				 := P#I 0.0 BYTE 256,
		 RET_VAL				 := #iTemp,
		 DSTBLK				 := "dbInputImage".wInput);
	 CALL "BLKMOV" (
		 SRCBLK				 := P#Q 0.0 BYTE 256,
		 RET_VAL				 := #iTemp,
		 DSTBLK				 := "dbOutputImage".wOutput);
	 CALL "BLKMOV" (
		 SRCBLK				 := P#M 0.0 BYTE 1024,
		 RET_VAL				 := #iTemp,
		 DSTBLK				 := "dbMarkers".wMFlags);
 
Last edited:

Similar Topics

Hi, I need to receive data via a DPDP coupler. On the other side it's simatic doing blockmove. On TIA side it's like blockmove doesn't work on...
Replies
0
Views
959
Could some one please tell me how to copy an entire data block to another in Step 7. I used SFC 20 in the ladder compiled and downloaded to CPU...
Replies
2
Views
3,721
I am considering using a "magnetic cable tie mount" like this one: https://www.grainger.com/product/MAG-MATE-Magnet-with-Zip-Tie-Holder-49M018 It...
Replies
2
Views
92
I am trying to use the 4-20 mA signals from a device whose user manual says that it outputs "isolated 4-20 mA". I only have spare PLC inputs in a...
Replies
3
Views
235
I'd like to talk this through a little: Relays are regularly used for PLC outputs, regardless of a need for signal conversion. But what about...
Replies
15
Views
957
Back
Top Bottom