Step 7 Array default value

CharlesM

Member
Join Date
Aug 2005
Location
Arkansas
Posts
1,129
I have DB86 that is an array of a UDT. I want to setup default values for this array. Can I do this? I have not found a way to do it with an array. Siemens told me to open the DB online then do a save and the default values would be saved into the DB. However this does not work and I think its because of the array.

If I remove the array and just go in and setup the DB in the same way. (lots of keyboard time) will it work the same way? This DB is being indexed through loops to read and write data to the motion controller. This is all done in STL (by Peter I think). I'm not much on STL but I think when you index through the data you are just looking at the address and the "array index" really has nothing to do with it. Am I correct in my thoughts?

DB86_1.JPG


DB86_2.JPG
 
Yes, when indexing through the arrays, S7 is simply looking at addresses. The arrays make it easier to code and structure, but there is nothing inherently different about a DB that is based on arrays and one composed of simple variables.
 
If you set the initial value in the UDT, when you create the db with an array, the array element actual values will be assigned the initial values from the UDT - does this help ?

If you change the initial values in the udt after you have created the DB, then you will need to do an interface update on the DB and then you can use edit>Initialise Data Block to copy the initial values to the actual values.

You are using the term 'default values' what exactly are you referring to in the DB, the initial value or the actual value ?
 
I want to set the initial value in the DB. I am still having trouble with WinAC when I don't do a good shut down of windows WinAC will load initial values into the DB. Each element of the array holds different values. So if I set the value in the UDT it will fill the all the array elements with the same data. I think.
 
An easy way to update your Initial Values to "useful" values is to create a new DB, copy the contents of the original DB into the new one and then edit the Initial Values as required before saving the new DB. Then delete the original DB (but not its Symbolic name) and either copy or rename the new DB to the original DB name.
 
This part confuses me because it has been a couple of years. What I remember doing is writing the prgram in the RMC and then activating a FC or FB that copies the data out of the RMC and into the S7. The S7 shouldn't write over this data unless an operator needs to change a position or pressure setpoint or speed. I never used the initial values in the PLC. Also, these initial values can be saved in the RMC's flash. When changes are made one can update the RMC's flash with the (U)pdate flash command.

I have forgotten exactly when the S7 uses the initial values but you had better have a way of changing the initial values from the HMI if you are going to use the Step7 initial values. It would be a shame if the S7 started up and initialized the step table to some old invalid values.

OT. Charles, even though I have had problems with the Step7 I think my experience with SCL was good. I liked SCL much better than LAD or STL. I would consider getting SCL. Writing STL is tedious and LAD is inefficient and not near as capable. You can't do array indexing in LAD.
 
Charles, if you want to use initial values, you will always have a problem: at warm restart DB retains actual values, at cold restart initializes with initial values. One solution is to avoid cold restart and to have a copy of DB actual values in HMI (it's not a problem if values must to be edited from HMI). I used it many times.
Another solution is to have DB containing default actual values with "Unlinked" attribute. It's stored in load memory. Restart OB copy it's content to you work DB with SFC83 READ_DBL. If your CPU haven't SFC83, use SFC20 BLKMOV.
 
Gambrinus - according to the documentation I have read, the only way to get the actual value back to the initial value is via the block editor.
My understanding of a cold restart is that it copies the DBs from load memory to work memory so the actual values in work memory will now become the actual values from load memory - this is not the same as the initial values.
 
As far as I'm aware, the only way to get the Initial Values the way you want them is either by copying the data to a new DB, as mentioned in my post above, or else by exporting the source to Excel and modifying the data there. Under normal circumstances I find copying the data to be far quicker and easier than exporting to Excel and re-importing, but I can imagine that there may be circumstances, particularly with large DBs, where it may be easier to automate the process in Excel, having stored a copy of the DB with good Actual Values first, of course.
 
I think the real problem is with WinAC. This DB holds the program for the motion controller. Sometimes (every few months) my event steps program is filled with zero's. WinAC has this DB that holds all the program. WinCC Flex has parts of the DB in a recipe. So the operator can change only the things that need to be adjusted to make the part. When the machine starts up the operator selects a recipe that is sent to WinAC. Then it is downloaded to the motion control. What I have found is that if windows is not shut down correctly then WinAC does a cold start. It can't load the last values into the DB because it did not get shut down correctly and does not have these values. So it fills DB86 with 0's. The operator does not know this so they load the recipe and download to the motion controller filling my event steps with a little data but mostly 0's. Its not important that the DB contain exactly what was in it when it shut down because the important values are stored into the recipe. The motion controller saves the values to flash so it is powered up with good numbers. So my fix for this was to do an upload on startup in OB100 filling the DB with the data from the motion controller. Then the operator loads the important data and everything is happy. This seemed to helped but I have lost the DB a couple of times after doing these changes.

So my plan is to save the actual values in the DB so that it will start with something other than zero's. It only has to have the program not the important numbers that the operator stores in the recipes.

I had thought of trying to do something from the HMI but it is a lot of Data. Also if I make something to complex it is just easier to open the motion control software and download the data back into the controller and upload it into the DB.
 

Similar Topics

I'm still a little remedial with my Step 7 classic knowledge. I'm working on in Simatic Manager 5.5, SP4, and I need a little insight of how to...
Replies
10
Views
2,725
Good day. I have a device on profibus that I am reading data from using SFC14. This data is written into an array within a DB. The array is 128...
Replies
6
Views
3,736
Good Morning. I would like to know how you can convert a string to a barcode from string to char. Basically my reader barcode reading puts me in...
Replies
1
Views
2,049
I have made a small FB in SCL, in this blok i have to transfer to an array in a certan position, but I can't get it to work. It goes as follows...
Replies
6
Views
6,540
I am just picking up Siemens Step-7 after years of RsLogix, and I am shocked i cant do the most simple things with arrays. This has screwed up...
Replies
21
Views
23,134
Back
Top Bottom