CX-Programmer User Manual (986752), страница 14
Текст из файла (страница 14)
Differentdata-types are used to refer to these different parts.Define a symbol with a BOOL data-type to refer to the status value (e.g. a symbol with address/value‘TIM1’ and data-type BOOL). This may be used for contacts.Define a symbol with a NUMBER data-type to refer to the timer as a whole (e.g. a symbol withaddress/value ‘1’ and data-type NUMBER).
This can be used in timer/counter instructions (e.g. ‘TIM’).Define a symbol with a UINT data-type to refer to the set-value part of the timer/counter (e.g. a symbolwith address ‘TIM1’ and data-type UINT). This can be used in instructions to read/write the set-valueof the timer.Global SymbolsThe PLC global symbol table is initially filled with some pre-set symbols, which depend upon the PLCtype. For example, the symbol ‘P_1s’ (1 second pulse) is created for many PLC types. All pre-setsymbols have the prefix ‘P_’ and they may not be removed or edited.Page 66Revision 2.0OMRONCHAPTER 4 – ReferenceA global symbol table contains the PLC’s symbols – these symbols can be referenced by any programfor the PLC.
Any unnamed symbols (IO comment - just addresses given a comment) are contained withinthe global table - they may not be placed in a local symbol table.Note:Global symbols are only global for a particular PLC. It is not possible to share symboldefinitions between PLCs on the project workspace.Local SymbolsThese symbols are specific to a particular program, and cannot be referenced by any other. It isrecommended that symbols are defined locally to a program unless the address is being used in multipleprograms. This makes the project more manageable and maintainable.A program’s local symbol table is created empty.
The local symbol table can be viewedby selecting the View Symbol Table button from the toolbar.It is possible to define a symbol at a local level with the same name as a symbol at global level. This isconsidered an override of the symbol definition. The program uses the symbol definition from its locallevel. This is a powerful feature, but can be achieved by mistake, so CX-Programmer issues a warningwhen compiling if this is done.Copying and Moving SymbolsIt is possible to cut, copy and paste symbols from one symbol table to another.
It is also possible to movesymbols between tables by using drag/drop. Note that pre-set symbols can not be removed, but they maybe overridden.For advanced users, it is possible to paste symbols from another application into a symbol table. This canbe done from any application that supports a text format – for example a spreadsheet. Refer to Chapter5 - Advanced Topics for further information.Use the following procedure to copy or move symbols.1, 2, 3…1.Select a symbol, or symbols in the symbol table.
More than one symbol can beselected by pressing Shift and selecting another item to extend the selection or bypressing Ctrl and selecting another item to add to the selection.2.Select the Copy button from the toolbar to copy the item, or the Cut button fromthe toolbar to move the item.3.Select a symbol table to move the items.4.Select the Paste button from the toolbar to paste the symbol or symbols.
A Pasteoperation can be performed several times without copying again.Note: If a program or part of a program (i.e. selected rungs or sections) are copied between programs,then the symbols used within the program are copied to the new program.Sharing Symbols with Other ApplicationsSome OMRON applications may be able to share symbol definitions with other packages. CXProgrammer supports this feature.Revision 2.0Page 67CHAPTER 4 – ReferenceOMRONIn order to allow sharing of symbols, it is necessary to link a CX-Server file with the project, which holdsa copy of the desired symbols. This is set up using the Project Properties dialogue.
Once this is done,it is necessary to indicate which symbols are to be shared. Only global symbols may be linked with otherapplications. Refer to Chapter 5 - Advanced Topics for further information.Adding SymbolsIt is possible to add a symbol from several places – from the project workspace, within a symbol tableor a program window. In each case, the Insert Symbol dialogue is used.Use the following procedure to add a symbol.1, 2, 3…Page 681.Select the New Symbol button from the toolbar. The Insert Symbol dialogue isdisplayed.2.Enter a symbol name.3.Enter an address or value in the Address or Value field.
For a value (NUMBERdata type symbol), type in a decimal value, or prefix the value with a ‘#’ forhexadecimal. A positive or negative floating point value may also be entered.Leave the field blank if the address is to be automatically allocated (see page 76)4.Select a data type in the Data Type field. For a numeric value rather than address,select the data type ‘Number’.5.Enter a comment, if required, in the Comment field.6.For global symbols, indicate whether to share the symbol definition with theproject’s linked CX-Server file by setting the Link the Definition to a CX-Serverfile field.7.Select the OK pushbutton to accept the settings. Select the Cancel pushbutton toabort the operation.Revision 2.0OMRONCHAPTER 4 – ReferenceEditing SymbolsIt is possible to edit symbols by double clicking symbols from the symbol table, or from an operandwithin a program.
The dialogue works in the same way as the Insert Symbol dialogue.When a symbol’s address or comment is altered, the program or programs using it automatically use thenew address and show the new comment.When a symbol is renamed, the program does not automatically use the new name.
If the renamedsymbol was an override, the program attaches to the global definition. The program has errors if asymbol with the old name does not exist – in order to make the program use the new name, a Find andReplace operation is necessary.Select the Replace All pushbutton from a program object in the project workspace – this updates theprogram and the local symbol table beneath it.Removing SymbolsSymbols may be removed by deleting them from the symbol table.Generally, when a symbol is removed, the program and programs using it then use the address or valueof the removed symbol.The exception is for symbols with automatically allocated addresses – in these cases, the program showsthe name of the removed symbol in the places where it was used. It is then easy to see where an addressneeds to be assigned in the program.If the removed symbol was an override of a global symbol, then the program uses the global symbol ofthe same name, which may have a different address or value.Program EditingA number of procedures can be performed from within the Ladder program but it depends upon whetheran instruction, contact, coil, or workspace has been selected.To view the Ladder program, select the View Diagram button from the toolbar.The following elements can be selected from the Diagram toolbar and placed directlyinto the Ladder program.New Open Contact.
Once the Contact has been entered, the name or address for thatcontact needs to be entered. Refer to Chapter – 4 Contact and Coil Editing for furtherinformation.New Closed Contact. Once the Contact has been entered, the name or address for thatcontact needs to be entered. Refer to Chapter – 4 Contact and Coil Editing for furtherinformation.Vertical. The New Vertical button from the toolbar connects elements in the Ladderprogram vertically.Revision 2.0Page 69CHAPTER 4 – ReferenceOMRONHorizontal. The New Horizontal button from the toolbar connects elements in theLadder program horizontally.New Open Coil.
Once the Coil has been entered, the name or address for that contactneeds to be entered, refer to Chapter – 4 Contact and Coil Editing for furtherinformation.New Closed Coil. Once the Coil has been entered, the name or address for that contactneeds to be entered, refer Chapter – 4 Contact and Coil Editing for further information.Instruction. Once the graphical instruction has been placed on the diagram, the actualinstruction must be selected, refer to Chapter – 4 Contact and Coil Editing for furtherinformation.Note that both a rung and elements of a program can be given comments within theladder display, by using Properties.Use the following procedure to create a Ladder program.1, 2, 3…1.Select the PLC object in the project workspace.2.Select the New Program button from the toolbar to start a newprogram. A ladder editing window will open.3.Select the Program object in the project workspace.
Select theProgram object once more so it becomes an editable field. Enter aname for the program.4.Select one of the above objects from the Diagram toolbar and placeon the Ladder program. The icon image remains selected untilanother element is clicked on the toolbar.5.Items can be individually selected by selecting the Selection Modebutton from the toolbar.6.Rungs can be selected by clicking the rung margin within the Ladderprogram.Some objects (excluding the rung and text comments, and the vertical and horizontals) have associateddialogs allowing address or instruction information to be entered.