You are on page 1of 6

(http://www.siemens.

com)
IndustryOnlineSupport
ProductSupport

Home(start) ProductSupport

Entrytype:FAQ,EntryID:837001,Entrydate:07/19/2010 (13)
Rate

Whatisthesignificanceoftheinitialandactualvaluesofadatablock?
Entry Associatedproduct(s)

Description
Thenameforvariables,thedatatype,acommentaryandaninitialvalueareconfiguredinthedeclarationtablefor
adatablock.Thisinitialvalueisapureconfigurationvariablewhichisappliedasanactualvaluewhengeneratinga
datablockonthebasisofaUDT(userdefineddatatype)orinadeclarationforanewvariableinaglobaldata
block.Theactualvaluesbecomevisibleviathemenucommands"View>Dataview".

Theinitialvalueisonlyconfiguredonceforadatablockorforanewlydeclaredvariabledatablock.Ifthevariable
alreadyexists,theactualvalueisunaffectedbyanychangeintheinitialvalue.Theonlyvalueofsignificancetothe
CPUisthevalueinthecolumnheaded"Actualvalue".EveniftheinitialvalueisalsoloadedontotheCPUandcan
bemonitoredthereinonlinemode,thisvalueisnotusedbytheCPU.

YouhavetwooptionsforstartingyourCPUwithanewvalue:

1.Switchtothedataviewandenteryournewinitialvalueinthe"Actualvalue"column.
2.Gotothedeclarationviewandenteryournewinitialvalueinthe"Initialvalue"column.Thenswitchtothe
dataview.Youcanthentransferallthevaluesfromthe"Initialvalue"columntothe"Actualvalue"columnvia
themenucommand"Edit>InitializeDataBlock".

ThenloadthedatablockintotheCPU.

Sincetheinitialvaluedoesnotcontinuetousetheinitialvalues,thereisnoneedtoperformtheopposite
procedure,i.e.toloadthevaluesfromthe"Actualvalue"columntothe"Initialvalue"column.Thereisnomenu
commandforthiseitherinSTEP7.Thefollowinginstructionsareusedinsomeuncommonconfigurationsfor
savingtheactualvaluesofadatablockasinitialvalues.Thisprocedurecaneitherbeconducteddirectlywithinan
STLsourceorbysavingthevalueswithExcel.

SavingtheactualvaluesofadatablockasinitialvaluesdirectlyintheSTLsource
OncetheSTLsourcehasbeengenerated,theactualvaluescanbecopiedlinebylineintothedeclarationlinesin
theSTLsource.

No. Procedure
1 SelecttheonlineviewintheSIMATICManagervia"View>Online"andopenthedatablockwithintheonline
view.Savethedatablockeitherbyclickingthefloppydiskbuttonorvia"File>Save".
2 Createasourceforthedatablockvia"File>GenerateSource...".
3 Openthesource,whichyouhavegenerated,inthesourcefolderintheSIMATICManager.
4 IntheSTLsource,copytheactualvalues,whicharepositionedbetween"BEGIN"and"END_DATA_BLOCK",
linebylineintothecorrespondingdeclarationlines(initialvalues)afterthecorrespondingdatatypes.

Fig.01
AsFig.01shows,youhavetocopytheactualvalueswiththeassignments":="intothedeclarationlinesofthe
initialvalues.Asaresult,thedeclarationlinesaredefinedasshownintheexamplebelow:
Data_1:BYTE:=B#16#AA
5 SaveandcompiletheSTLsourcevia
File>Save
File>Compile
Theactualvaluesarethenappliedasinitialvalues.

SavingtheactualvaluesofadatablockasinitialvalueswithExcel(theconvenientway)
TheactualvaluesofadatablockcanalsobesavedinExcelasinitialvalues.Thisoptionisparticularlyadvisable
forlargedatablocksbecausethedataiscopiedintothedeclarationlinesinablockhere,notlinebyline.Thetable
belowexplainswhatyouneedtowatchoutforwhenimportingandexportingtheSTLsourceandwhensavingin
Excel.

No. Procedure
1 SelecttheonlineviewintheSIMATICManagervia"View>Online"andopenthedatablockwithintheonline
view.Savethedatablockeitherbyclickingthefloppydiskbuttonorvia"File>Save".
2 Createasourceforthedatablockvia"File>GenerateSource...".
3 MarkthegeneratedsourceinthesourceintheSIMATICManagerandrightclickit.Thenselectthe"Export
Source..."commandinthepopupmenu.
4 Select"STLsource(*.awl)"asthefiletypeinthe"Exportsource"dialogbox,aswellasthefolderwherethe
sourceistobeexported.Thefilenamemustcontainthefileextension".AWL",e.g."Source_DB2.AWL".Then
clickthe"Save"button.

Fig.02
5 StartMicrosoftExcelandopentheexportedSTLsourcevia"File>Open...".The"TextimportWizard"dialog
opens.
Note
Youhavetoselect"Allfiles(*.*)"asthefiletypeinordertoensurethattheSTLsourceisvisibleinthe"Open"
dialogbox.
6 Insteponeofthetextimportwizard,enablethe"Delimited"formattingoption.

Fig.03
Thenclickonthe"Next"button.
7 Inthenextdialogboxofthetextimportwizard,select"tab"or"space"asthedelimiter.

Fig.04
Thenclickonthe"Next"button.

8 Inthethirdstepofthetextimportwizard,select"standard"asthedataformatforthecolumns.
Fig.05
Thenclickonthe"Finish"button.TheconvertedSTLsourceisnowopenedinExcel.
9 SelectallthecellsbelongingtotheSTLsourceinMicrosoftExcelandrightclick.Thenselectthe"Format
Cells..."commandinthepopupmenu.

Fig.06

10 Select"Right"or"Right(Indent)"asthehorizontaltextalignmentinthedialogbox"FormatCells>Alignment"
andclickOKtoconfirm.
Fig.07
11 Nowselecttheactualvaluesbetween"BEGIN"and"END_DATA_BLOCK",includingtheassignments":=",and
copythedataintothedeclarationlinesbetween"STRUCT"and"END_STRUCT"afterthecorrespondingdata
types,asshowninFig.08.

Fig.08

12 Thencheckwhetherthesyntaxagreesaftercopyingtheactualvaluesintothelinesfortheinitialvalues.
Example:
STRUCT
Data_1:BYTE:=B#16#AA
...
END_STRUCT
Fig.09
13 SavethefileinExcelvia"File>Saveas..."andselect
FormattedText(Spacedelimited)(*.prn)asthefiletype.
Note
Onceyouhavesavedthefileasdescribedabove,youreceivethefile,e.g."Source_DB2.AWL".However,if
yousavethefileunderanothername,suchas"Source_DB20.AWL",thefile"Source_DB20.AWL.PRN"willbe
storedonyoursystem.Thisfilethenhastoberenamedfrom"Source_DB20.AWL.PRN"to
"Source_DB20.AWL"(deletetheextensionPRN).Theextension"PRN"hasbeenaddedbythesystemin
caseswherethefilenameending"AWL",whichisbeingsaved,hasalreadybeenenteredonce.
14 ImporttheSTLsource,whichyouprocessedinExcel,intothesourcefolderforyourSTEP7projectinthe
SIMATICManagervia"Import>ExternalSource...".
15 MarktheimportedSTLsourceinthesourcefolderandrightclick.Thenselectthe"Compile..."commandinthe
popupmenu.Theactualvaluesaresavedasinitialvaluesfollowingcompilation.
SiemensAG20092017 Imprint(http://www.siemens.com/corporate_info) Privacypolicy(http://www.siemens.com/privacy) Cookiepolicy(http://www.siemens.com/cookiepolicyen)

Termsofuse(http://www.siemens.com/terms_of_use) DigitalID(http://www.siemens.com/digital_id_en) 0.0.0.0

Fig.10

Note
IfyouuseUDTsinyourdatablock,thereisarestrictionhere.Youcannotattachtheactualvaluestothevariables
asinitialvalues.WhiletheUDTscanbeexported,anychangeintheinitialvalueoftheUDTaffectsall(!)theplaces
wheretheUDTsareusedequally.Distinctionscannotbemadebetweentheplaceswhereitisused.

Keywords
Programminghelp,Initialization,Initialvalues,Systembehavior

Securityinformation
Inordertoprotectplants,systems,machinesandnetworksagainstcyberthreats,itis
necessarytoimplementandcontinuouslymaintainaholistic,stateoftheartindustrial
securityconcept.Siemensproductsandsolutionsconstituteoneelementofsuchaconcept.
Formoreinformationaboutindustrialsecurity,pleasevisit
http://www.siemens.com/industrialsecurity.(http://www.siemens.com/industrialsecurity)

Alsoavailableinthefollowinglanguages:
German
French
Italian
Spanish
Chinese

Entrybelongstoproducttreefolder(s):
AutomationTechnology AutomationSystems IndustrialAutomationSystemsSIMATIC SoftwareforSIMATICController STEP7V5.x STEP7basicsoftwareandeditors STEP7(products?pnid=14342)

Rateentry
norating Submitrating

Feedback*)
Name

Phonenumber

email

Comment Numberofcharacters:0(max.500)

Sendcopyofcommenttosender Send

*)Important:Pleaseusethisformforgeneralfeedbackonly.AlltechnicalandspecialisttopicsshouldbedirectedtotheexpertcommunityintheTechnicalForum
(https://support.industry.siemens.com/tf/ww/en/).

SiemensAG20092017 Imprint(http://www.siemens.com/corporate_info) Privacypolicy(http://www.siemens.com/privacy) Cookiepolicy(http://www.siemens.com/cookiepolicyen)

Termsofuse(http://www.siemens.com/terms_of_use) DigitalID(http://www.siemens.com/digital_id_en) 0.0.0.0

You might also like