S7 Data Block Clearing/Wiping Issue

AbjectControl

Member
Join Date
Feb 2010
Location
Cold Winter North
Posts
25
All-

Greetings, and happy Thursday.

I've got a bit of a question regarding Data Blocks in Step7. I apologize ahead of time if it is obtuse to inquire; however, I'm looking for a clean method of wiping a Data Block (DB) to it's initial state, and/or neatly setting everything to a pre-determined value after an operation.

Now, for the fun caveat. I can't use STL or SCL.

Help?
 
The easiest way is to have a duplicate copy of the block with its initial values in and then copy the duplicate into the working block when you wish to "reset" it using SFC20.

Nick
 
I've tried doing that, but I get an error each time with the following logic, and was advised I can't "BlkMov" one DB directly into another DB. Posted in STL for sake of ease of posting.

A Test1
JNB _00c
CALL "BLKMOV"
SRCBLK :=DB23
RET_VAL:="test".DB_VAR
DSTBLK :=DB22
_00c: NOP 0
 
It seems that your problems are in the AnyPointer department. The picture attached shows two calls to SFC20 both copying data from "Backup" to "Working". In the first call, the address are typed in explicitly whereas in the second example a UDT has been used to simplify things. An added advantage of using a UDT is that the working data and the backup data can both reside within the same DB.

Nick

SFC20.jpg
 

Similar Topics

Afternoon, I have a DB in TIA Portal V16 that is optimised. I cannot change this. There is an array inside that block which consists of 3000...
Replies
9
Views
1,142
Hello all, PLC-programming noob here. I have multiple clients accessing some data on my Siemens S7 1211C PLC; some OPC clients and some direct...
Replies
30
Views
8,320
Hey people, I have been using GET_NAME , GET_IM_DATA and ModuleStatus FB to get an info from Modules inside my program, but ever since and...
Replies
4
Views
2,554
Hi, just wondering if I could get some advice when setting up function blocks (Currently using Siemens S7) using a STRUCT data format. Say I was...
Replies
11
Views
3,023
Hi, Ok bear with me, I have an Array of Real in a DB ranging from 0 to 10. In ladder I want when count pulse = 100 move count into Array 0...
Replies
1
Views
2,079
Back
Top Bottom