CX-Programmer User Manual (986752), страница 5
Текст из файла (страница 5)
Once enough instructions have been entered to enable its drawing in ladder format itis redrawn.Revision 2.0Page 17CHAPTER 2 – Quick Start GuideOMRONInstructions can be transferred to and from the Mnemonics view using the standard Microsoft WindowsCut or Copy and paste functions. For example, it is possible to paste a large amount of program from atext editor. Refer to Chapter 3 - Project Reference for further information.Introducing Symbols and the Symbol TablePLC addresses, which are used as operands in a PLC program, can be assigned a symbolic name and/ora comment for the purpose of reference during programming.
An address with a name or comment isknown as a Symbol.A symbol table is an editable list of symbol definitions – the names, addresses and comments. This listalso provides information on the following:♦Rack location. If the address is contained within the PLC IO table, this shows the address’ racklocation.♦Usage. If the address is contained within the PLC IO table, this shows the physical hardware type(i.e. ‘Input’ or ‘Output’) which is mapped to the address.
If no hardware is mapped, ‘Work’ isshown, meaning that the symbol is for general use.It is possible to indicate the physical format of the data that is stored at an address. This additional datatyping facility enables CX-Programmer to check whether the address is used consistently withinprograms. In the symbol tables, an icon is shown next to a symbol that indicates its data type. The DataType set is as follows:Data TypeBOOLDINTINTAddress of a signed, single binary word.LINTAddress of a signed, quad binary word.NUMBERA literal numeric value - not an address.
The value can be signed, or floatingpoint. NUMBERs are used for any literal value or for timer/counter identifiers(for TIM/CNT, only unsigned integer values are allowed).Floating point values are only suitable within IEEE REAL type operands.Note: when used as BCD number operands, the value is treated as if it wereentered in decimal with a ‘#’ on the front. E.g. using a NUMBER ‘1234’ isequivalent to typing ‘#1234’ as the operand, so that the decimalinterpretation is made of the value.The value of a NUMBER data type is assumed to be decimal, unless it isprefixed with '#' for a hexadecimal value.Note: NUMBERs entered in hexadecimal are converted todecimal for BCD operands (e.g.
a NUMBER defined as ‘#10’ willappear as ‘#16’ for a BCD operand).CHANNELPage 18Data Type DescriptionAddress of a binary bit - a logical Boolean on or off state. This type istypically used for contacts or coils.This is a special data type, for backward compatibility. It is an address (nonbit) to data of any type (unsigned or signed, one or more words), so can beused in place of any of the above data-types except NUMBER and BOOL.The data type is weak, and so checking is limited (e.g. CX-Programmercannot check if the address is being used for BCD or binary values).Address of a signed, double binary word.IconRevision 2.0OMRONCHAPTER 2 – Quick Start GuideData TypeData Type DescriptionREALAddress of a double word floating point value (IEEE format - use the UDINTtype for the BCD, FDIV format).UDINTAddress of an unsigned, double binary word.UDINT_BCDAddress of an unsigned, double BCD word.UINTAddress of an unsigned, single binary word.UINT_BCDAddress of an unsigned, single BCD wordULINTAddress of an unsigned, quad binary word.ULINT_BCDAddress of an unsigned, quad BCD word.IconEach program within a PLC has a ‘local’ symbol table that consists of symbols that are for usespecifically in that program.
Each PLC within a project has a ‘global’ symbol table that consists ofsymbols that can be used in any of its programs. When a PLC is added to a project, its global symboltable is filled with a pre-set list of symbols, dependant upon PLC type.Each symbol name must be unique within its table. However, it is possible to use the same name in alocal and a global table – in this case, the local symbol takes precedence over the global symbol of thesame name.The symbol table allows these names to be entered and edited directly.
Each symbolname must be unique. Use the following procedure to activate the symbol tables.1, 2, 3…Revision 2.01.Double-click on the symbol table object beneath the PLC in the project workspace.The global (i.e. PLC’s) symbol table is displayed containing global symbols.Page 19CHAPTER 2 – Quick Start Guide1.OMRONDouble-click on the symbol table object beneath a program in the project. Theprogram’s local symbol table is displayed.Using CX-ProgrammerThis chapter contains an example tutorial and also describes basic procedures whichshould be considered before performing any programming task on the computer andpreparing ladder programs with CX-Programmer, and how to use the various tools toimprove productivity. CX-Programmer offers many methods of working with its tools:in general, instructions are given for using the toolbar icon in the first instance.The following tutorial has been based on a CS1H PLC.
The choice of PLC made here affects a numberof other parameters that may need to be set up. For example, the CV-series requires setting up the IOtable, and using the Settings object in the Project hierarchy to establish specific PLC characteristics.When planning a PLC programming project, various items need to be considered and set up within CXProgrammer before beginning to lay down program instructions.
For example, it is important for CXProgrammer to know the model and configuration of the PLC to be programmed, so that it can establishthe correct program checking and communications for that PLC. Programming should be targeted at thePage 20Revision 2.0OMRONCHAPTER 2 – Quick Start GuidePLC that is to be used. It is possible to change the PLC type at any time - the program(s) are thenconverted. However, since the conversion may not be perfect, it is best to set the correct PLC type at thebeginning.Before programming, it is recommended that a checklist of the important programaspects be constructed, including its structure and PLC parameters.
To start a newproject in CX-Programmer, follow these steps in addition to the basic procedureoutlined in your PLC programming manual:StepDetermine PLC essential parametersDetermine allocation of PLC memoryDetermine PLC setup parametersCreate appropriate IO TableDecide how to input and edit the programIncludePLC series, PLC type, CPU (where applicable),communications interface, choice of editor and project type.Where applicable. For example, C-series PLCs requireworking out the balance required between program memoryand expansion data memory.PLC configuration data.List all related IO devices and addresses.
Some C-seriesPLCs do not support this function.CX-Programmer offers two languages: ladder and mnemonic.A mixture may be used.Starting a New ProjectOnce the project requirements have been worked out on paper, the first step is to create a project anddefine the device entries for that project. A project can have multiple PLCs. CS1-series PLCs are multitasking and can therefore have more than one program associated with them in the project; CV-seriesPLCs and C-series PLCs can only have one program associated with the device.Use the following procedure to create a new project.1, 2, 3…1.Select the New button from the toolbar.2.Define the device entries for the project. Refer to the CX-Server User Manual forfurther information. For this tutorial, set the PLC type as CS1G with CPU typeCPU42.3.Save the project.
Select the Save Project button from the toolbar. The Save CXProgrammer File dialogue is displayed.4.Type a valid file name in the File Name field. Select the Save pushbutton to savethe new project. Select the Cancel pushbutton to abort the operation.When a new PLC is added to a project, the following empty tables are created:♦Empty local symbol table;♦Global symbol table containing pre-set symbols;♦IO Table;♦PLC Memory data;♦PLC Settings data.Revision 2.0Page 21CHAPTER 2 – Quick Start GuideOMRONThe project workspace is populated with the contents of the newly created project and a Ladder programis displayed in the Diagram Workspace ready for programming to begin.A description of each object in the project hierarchy is provided in Chapter 4 - Reference.Within the Ladder program, the current position is indicated by a highlighted rectangular block, knownas the cursor.
Using the mouse or the arrow keys, the cursor can be positioned at any point within thediagram. An element can be placed at the current cursor position by either selecting it from the Insertmenu, selecting it from the toolbar or by pressing its assigned shortcut key. An element can be placedin any empty grid position, or may overwrite a horizontal element.Task and program types depend on the PLC type, defined in the program properties.Use the following procedure to change properties for a program at any time.1, 2, 3…1.Click on the Program object in the project workspace.2.Select the Show Properties button from the toolbar.
The Program Propertiesdialogue is displayed.3.Select a Task type setting from the Task Type field. Since this program is writtenfor a cyclic task, set this to ‘Cyclic Task 00’. The icon to the left of the programname changes to reflect the task type, and the task number is shown on the right ofthe program name.4.Set the Operation Start setting so the program starts on PLC start-up.Writing a Ladder ProgramThe following program sequences a set of traffic lights. The sequence is a standardBritish sequence of the following order:•Red light only;•Red and Amber lights together;•Green light only;• Amber light only.Writing a ladder program consists of:Page 22•Creating symbols;•Creating the ladder program;•Compiling (automatically checking) the program;•Transferring the program to and from a PLC;•Comparing the program with the PLC program;•Monitoring the program during execution;•Performing an on-line edit (if necessary).Revision 2.0OMRONCHAPTER 2 – Quick Start GuideCreating SymbolsAn important step in creating a Ladder Program is the definition of those PLC data areas that are to bereferenced by the program.