Clear / Fill a db 1516-3 PLC TIA Portal Version V15.1 Update 2

dahnuguy

Member
Join Date
Mar 2007
Location
SC
Posts
720
I have a db that must be optimised due to the size of the data in it. I would LOVE to switch to non optimized but then the db max size limit is exceeded.

The optimized db is also in the load memory.

I am reading a section of the db from load memory into the working memory.
(It is a recipe library which contains variables for machine function.)

Let's say this is db1.

L recipe number
T index

I load db1[index] into the working memory db2[1] using "read DBL"

This works fine. (If both source and destination are both optimised or not optimised. )

After the batch is finished I want to clear the data in db2 to avoid any stale data and to avoid accidentally using the wrong recipe for the next batch.

I can't find a fill or clear function that will work with an optimised block.

I also can not address the block with an ANY pointer so I can not write it myself. "You cannot access an optimised memory area from this location."

So how do we clear or fill the data in optimized db db2, the destination block?


edit:
both source db1 and destination db2 are the same data type "udt recipe"

db1 has an array of 20 "udtrecipe" need to move one of those into working memory at db2.
 
Last edited:
Optimised data blocks can only be referenced symbolically.


The array of recipes is large so is an optimised DB. If one element of the array will fit in a non-optimised db, then you can use the FILL instruction, below, Data_Block_1 is optimised, Data_Block_2 is non-optimised:

recipe.jpg
 
If they are not both optimized then "readDBL will return a fault.

I tried using optimised db1 and non optimised db2 first. It compiles and looks right , but then returns error

8082
Destination DB type different from source DB type (optimized/standard access).

8082 "The destination and source DB were both created with optimized access. You have, however, used structures with the destination and source DB that lead to a different arrangement of the data when compiled. (Note: Use UDTs instead.)"

They are udts.
 
I need to use a mov blk to move the recipe in to the working memory. Using "this := that" over 9000 bytes is not feasible. (9772 bytes. Wasn't my doing...only so much I can do about it.)

Can't use ANY to refer to an optimised db area.

The mov blk instructions wont work if the two dbs are not the same with respect to optimised or not optimised.

And the fill blk instructions wont work on an optimised block.
 
I can't see a solution with optimised db, so I am going to move ahead with fewer recipes in the load memory.

Change from receipe array [0-20] to recipe array [0-5] make it non optimised and move on.

If the customer needs more, they can expend the memory.
 
use the readdbl to move it to an interim optimised db then copy that to a non-optimised db?

Did that. That is essentially what I am doing.

DB1 is optimised.
readDBL requires the source and destination to be the same with regards to optimisation.

Either both are or both are not optimised.

I find it odd that there is no provision in the optimised db functions for a fill or clear function.

That would give me what I want.

I would expect readDB to work similarly to readDBL, either way it is the destination of that move that I want cleared.
I considered using db of type array but they are automatically optimised and have their own limitations.
 
If you're looking to clear the DB, you should be able to use the ReadDBL function to read it into itself. I think this re-initializes it back to the start values (which are presumably set to what you want it to go back to).
 
If you're looking to clear the DB, you should be able to use the ReadDBL function to read it into itself. I think this re-initializes it back to the start values (which are presumably set to what you want it to go back to).

That is interesting.
I am reading from the DBL into the work memory.

Like recipe library into the current recipe...

then when finished , I want to explicitly clear the current recipe to avoid someone just hitting start and running an unintended batch with the wrong recipe.

I wound up making the blocks non optimised.
Then readDBL from library "array of recipes" into the working memory for the "current recipe".
Then I wrote a couple functions to clear sections of the recipe and the whole recipe.

My intention was to write as few custom blocks as I could. The customer will support the code for their customers and I am not sure they have much Siemens experience.


I know someone is going to complain about the STL and any pointers.
 

Similar Topics

This example describes various possibilities for presetting memory areas with certain values for clearing defined memory areas. The...
Replies
1
Views
2,619
Hi, Experts: We have 20 + years old GE PLC series 90-30 stop running (the run led not on and battery led not on) and HMI showing that "PLC has...
Replies
7
Views
198
Hi everyone, recently i worked with a cmore panel and have the question that how can clear alarm list whit remote form,right now only can with...
Replies
0
Views
109
Hi guys, I have a data table as REAL type VALUES_TABLE[32,100]. I want to clear this table. For that i created a REAL type CLEAR_DATA tag with...
Replies
8
Views
562
Hi, I have bought a used 1756-L73S and SP, it is running firmware 30.013 and safety locked, im running Logix Designer 30.01.00. The controller...
Replies
10
Views
1,665
Back
Top Bottom