Wątki

[ Pobierz całość w formacie PDF ]
.Variables can only be accessed by the block to which they belong.If oneblock needs the value of another block s variable, it must be transferred asdata in a software signal.The two main classes of variable are:148 038 02-EN/LZM 111 303 R1A PLEX-C" Temporary Variables" Stored Variables4.5.4.1 Temporary VariablesTemporary variables exist only during the execution of the program andare only stored in registers in the Register Memory.They are not stored inData Store.They have none of the properties of stored variables.A temporary variable receives its value during program execution, forexample by being assigned the value of a constant, or by being assignedthe contents of a variable in a data word associated with an incomingsignal.When a signal is to be sent, the associated data is often read into RegisterMemory from stored variables in Data Store immediately prior to thesignal sending instruction.When the signal is received in the destinationblock the data words are assigned to temporary variables in the program.The data values now belong to the receiving block and can be used in theprogram.Temporary variables containing the data that came with the signal can betransferred to stored variables, that is, written in the Data Store.Data that is not transferred from temporary variables to stored variableswill be lost once the program exits, for example, after a signal sendingstatement.Temporary variables are a type of field variable and can only be used tostore numbers or symbol values, they cannot store string values.In the declaration of temporary variables the name of the variable normallystarts with the letter  T.However this is not always the case and somestored variable names may begin with  T.038 02-EN/LZM 111 303 R1A 149 The general format of the declaration of temporary variables is -VARIABLE name ;The temporary variable default length is 16 bits which does not need to bedeclared.Shorter temporary variables are possible, but are rare, in this casethe length is shown after the name.Three temporary variables from block RE are shown in chapter Figure4.13.*** RE 4D13/CAA 107 0100/M57D R3A021892.VARIABLE TBLOCKNBR; ! BLOCK NUMBER !1893.VARIABLE TFILENUMBER; ! FILENUMBER,USED IN GIVEFSEND (SIZE ALT.)!1894.VARIABLE TNEWINDNUM; ! NEW NUMBER OF INDIVIDUALS (SIZE ALT.) !Figure 4.13Declaration of three temporary variables in block RE.The variables named TBLOCKNBR, TFILENUMBER andTNEWINDNUM are all temporary variables as no variable properties areincluded in the declarations (see later under  Stored Variables ).All are 16bits long.4.5.4.2 Stored VariablesStored variables are always stored in the Data Store.Each variable has itsown position in the block s Base Address Table in the Reference Store andthis position gives the address in Data Store for the variable.chapter Figure 4.14 is an extract from the declare sector from blockC7ST2, showing the declaration of some stored variables.*** C7ST2 2D11/CAA 107 3376/M57B R4A01187.! 2.3 COMMON STORED VARIABLES !188.! !189.!---------------------------------------------------------!190.191.VARIABLE CINDINT 16 DS; ! INT IF ALL INDS DEALT WITH !192.VARIABLE CNUMIND 16 RELOAD; ! NO OF INDS !193.VARIABLE COWNREF 16,194.CREASON 16, ! FAULT REASON !195.CSIFLEN 16, ! NO OF SIF OCTECTS !196.CSIGNALKEY 16, ! USED IN RESTART PHASE !197.CTESTDATA(32) 16 DS; ! DIAGNOSTIC TEST DATA !198.VARIABLE CUSEDINDS 16 DS RELOAD; ! NUMBER OF RECORDS USED !Figure 4.14Declaration of Stored Variables, Block C7ST2150 038 02-EN/LZM 111 303 R1A PLEX-C4.5.4.3 Variable PropertiesStored variables keep their values when the execution of the program isinterrupted or terminated.They have certain properties which relate to theway they are stored in DS and what happens to them at system reload, startand restart.This information is stored in the Base Address Table inReference store.The properties are summarized in chapter Figure 4.15.DS Stored in Data Store in a permanently allocated location.Stored in a dynamically allocated buffer.Used to transportBUFFERlarge amounts of data.Field variables are cleared (set to zero) at system start or restart.CLEARSymbol variables are set to their first value.Loaded from backup media at reload of the CPRELOAD(and dumped to backup media at each dump).DUMP Dumped in restart data printout at system restart.Value is not transferred between old and new software during aSTATICfunction change.Figure 4.15Properties of Stored Variables.Properties can be assigned only to stored variables in certaincombinations.For example a variable cannot be CLEAR and RELOADsince there would be confusion during system restart with reload.4.5.4.4 Stored Variable TypesThere are three different variable types:" Field variables" Symbol variables" String variablesEach of these types of variable can have combinations of the propertiesdescribed above.4.5.4.5 Field VariablesA field variable is used to store numerical data in binary form.The valuesare always non-negative integers and the value range depends on thelength of the variable.For example, a 16 bit field variable can contain anynumber between 0 and 65,535 (0 - H FFFF).038 02-EN/LZM 111 303 R1A 151 Possible sizes for stored field variables are: 1, 2, 4, 8, 16, 32, 64 and 128bits.Temporary field variables are always 16 bits in length.There are four types of stored field variables:" standard field variables." indexed field variables." structured field variables."  R field variables.Standard Field VariablesThe declaration has the following format:VARIABLE name [length] [properties];- length must be a number that is a power of two.If no length isassigned the compiler assigns the length 16 bits.- properties are as described in chapter Figure 4.15.Extracts of the standard field variable declarations for block RE are shownin chapter Figure 4.16.*** RE 4D13/CAA 107 0100/M57D R3A021316.VARIABLE OTSEIZED 1 DS CLEAR; ! 0 = OUTGOING SIDE NO SEIZED !1317.! 1 = SEIZED !1307.VARIABLE BMODINFBRA 16 DS; ! B-NUMBER MODIFICATION INFORMATION !! TO BRA!1194.VARIABLE FLCONNFID 32 DS CLEAR; ! FORLOPP IDENTITY !Figure 4.16Declaration of three field variables in block RE." Variable OTSEIZED is 1 bit long it is stored in DS and is cleared onsystem start/restart." Variable BMODIBFBRA is 16 bits long, stored in DS but has no otherproperties." Variable FLCONNFID is 32 bits long, stored in DS and is cleared onsystem start/restart.If a variable is declared with properties, the use of  DS is optional [ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • mikr.xlx.pl
  • Powered by MyScript