CHAPTER 6 SYSWIN program for programming a PLC controller
Introduction
6.1 Connecting a PLC controller with a PC computer
6.2 SYSWIN program installation
6.3 Writing your first program
6.4 Saving a project
6.5 Program transfer to PLC controller
6.6 Testing program function
6.7 Interpretation of "Tools" icons
6.8 PLC controller working modes
6.9 Run mode
6.10 Monitor mode
6.11 Program-Stop mode
6.12 Program execution and monitoring
6.13 Impact on the program during monitoring
6.14 Graphic representation of dimension changes in a program
Introduction
SYSWIN is a software designed for OMRON programmable controllers class C and CV. It is designed for creating and maintaining a program, as well as for testing PLC controller function, in off-line and controller's operational regime.
Necessary conditions for starting SYSWIN are Microsoft Windows environment on a standard IBM or 386/486 compatible or Pentium computer, with 8MB RAM at least, and 10MB free disc space.
6.1 Connecting a PLC controller with a PC computer
PLC controller is linked with a PC computer through an RS-232 cable. One end of the cable is connected to a serial PC port (9-pin or 25-pin connector), while the other end is connected to an RS-232C connector on RS232 module of a CPM1A controller. In order to establish a connection with a PC, DIP switch on the connector must be set in "Host" position.
6.2 SYSWIN program installation
Instruction package for CPM1A is covered by three SYSWIN installation diskettes. It can be installed in Windows 3.1, 3.11, 95, 98 or NT 4.0. In order to start the installation you need to select RUN option from a START menu.
A window will come up like the one below where you need to write in the file command "setup.exe". Mentioned file can be found in the installation directory of Syswin program. Following a brief installation procedure you will get a program group Syswin 3.4.
Double-click on Syswin icon starts a Syswin program which opens as in the following picture.
6.3 Writing your first program
Writing a program begins with New Project option from a File menu. In a message window that appears you need to select options as in picture below.
Select a PLC controller by clicking on OK, and a program is ready to be used. It is recommended when you begin working that you write in a header a title of a program, author's name and inputs/outputs used. This may seem as a waste of time, but really isn't because this habit of writing comments will pay off in the future.
Program written here is just a basic program made for learning Syswin. Program can detect when a key has been pressed and can activate a relay at the PLC controller output. As long as the key is pressed down, a relay is active. Operation of a relay and a key can be followed via LED diodes on PLC controller housing. Writing a program begins with a click on the first icon to the left, recognized by two vertical lines. Icon beneath this one is similar to the first but for a slash. These two icons correspond with concepts normally open and normally closed contact which all instruction lines start with. You can select an option with an open contact by clicking on the first icon. When you click on the black rectangle to the right, a small window will appear where you need to write in the address of a bit a contact relates to.
It is very important to use addresses in a regular way when programming with SYSWIN. Addresses can have two parts, first refers to the word address, and the second to bit address in that word (both numbers must be separated by a period). For example, if address 200 is used, SYSWIN will interpret this as 2.00, and a zero bit whose word address is 2 will be called for. If you wish to access word 200 or its zero bit, you must use a call 20000, or better even 200.00. In this example address 000.00 is assigned for input address (key). This address represents a zero bit for word 000 from memory region IR. Simply said, it is an input screw terminal designated as 00 input. By connecting a key to it, and to one of the COMM terminal screws, a needed connection between PLC controller and keys is established.
Address dialogue box for a bit that contact refers to
When you have written in 000.00, select OK, and first segment of the program will come up. Bit address will appear above the symbol with two vertical lines which refers to this bit, and a black rectangle will move one space to the right.
First element of a program myprog.swp
First instructions up to the bus bar are called conditions because their execution activates instructions found to the right of the condition instructions. When a condition is entered, you also need to enter a corresponding instruction that is set off by an execution of the condition. In this example it is a relay controlled by a 00 bit in a word 010 of memory region IR. Output instructions are represented by a circle, or a circle and a line if we are dealing with a normally closed contact. By clicking on the icon with a circle, you select an output option with normally open contacts. Click on a black rectangle, and a contact window will come up where you need to write in the address for the output bit 010.00. Output of the IR region is found at address IR010, and first four bits of this word represent a relay within a PLC controller (if we are talking about a model CPM1A with relay outputs). Program done so far looks as in picture below.
Second element of myprog.swp program
The basic functional entirety of some program is Network. Program consists of several networks found one below the other. Operations with these are found in Block option of the menu. Of all options, two basic ones, Insert network and Delete network are used the most. Other makers for PLC controllers use different concepts such as Rung instead of the term Network. Simply said, we are talking about a PLC program sequence which has one or more executing instructions, and along with END instruction can make up one correct PLC program. As the first network in a program is already in use, the next one has to be added. Adding a Network is done with Insert network command from a Block menu.
When selecting this option, a small window appears where you need to select whether a new network will appear above or below the existing one.
In our case you should choose the second option and click on OK. Following this, a new network appears as in picture below.
Last network in every program must contain END instruction. Since this is a simple example, second network is also the last. End instruction is found among the functions. In order to come to it, you need to click on FUN icon following which a window as in picture below will come up.
Selecting a function by clicking on FUN icon.
END instruction can be obtained either by writing in "END" in newly obtained window or by clicking on Select which gives all PLC controller instructions sorted by the regions as in the following picture.
Selecting END instruction from a set of instructions sorted in regions.
By entering the END instruction your writing of a program is finished. Finished program looks as in the following picture.
Finished myprog.swp program
6.4 Saving a project
Since you've finished writing a program, you need to save a project. Select Save Project option from a File menu, and write in the file name in a message window (myprog.swp in this case). After you click on OK, project will be saved. You can access SYSWIN file contents only from SYSWIN; file type is identified by extension:
Project.swp - SYSWIN program
Project.swl- SYSWIN library
Project.swt - SYSWIN pattern
Project.swb - SYSWIN back-up file
Project.prg - PMD program
6.5 Program transfer to PLC controller
First you need to check whether PLC is connected with a PC correctly, and you'll do this by checking physical connection through a serial cable. Following this you need to select a Communication option from Project menu in order to set parameters for serial communication. Of all the parameters, the most important one to be selected is a serial port of a computer that PLC is connected to. Default settings for CPM1A are: COM1, 9600 Baud, Unit 00, protocol ASCII 7 bit Even Parity 2 stop and they need to be left so. To check how communication functions, you can click on Test PLC to test link with a PLC controller.
When a connection has been established, program transfer begins with a click on download from Online menu. Select expansion function or memory allocation. Before you program a PLC, it's good to erase program's memory contents. Finally, after a successful program transfer to a PLC, a message window will come up to inform us of this.
6.6 Testing program function
Program check option from a Project menu allows testing of program function. Message that appears following a command has several options that can be selected before you run a test. Once these options have been selected, click on Execute, and a report on testing and errors will be displayed. You can further check for errors, and there is also a 'Go to Network' command which transfers you to a segment where the error was found.
SYSWIN has classic editorial capabilities, such as Edit/Find or Edit/Replace commands. Searching through a program for assigned values or symbols is quick and offers a large number of optional filters. We can search through an entire program or its segments, and this is defined with option call. Also, there are possibilities for defining a search path, as well as for different actions when looking for a desired element.
Beside this, SYSWIN provides various advantages in situations where we need permanent archiving of user program. It is especially important to periodically print projects that are made quick and easy by SYSWIN. Projects can be printed in many different formats, and printing can include specific sections of a project.
6.7 Meaning of "Tools" icons
SYSWIN has several types of editors among whom a relay diagram also known as relay editor, or first editor that awaits us upon starting a SYSWIN program is the most frequently used editor.
First we need to explain tools palette (Drawing Tools) and the meaning of each icon. Aside through the usual mouse click, you can access the specific elements of this palette from a keyboard. You'll find a corresponding key of the keyboard by each icon, and you can accomplish the same action with it as you would using a mouse.
By clicking on the icon, we have selected a desired tool, and with a click on network section this symbol will be stored in a program. Explanation for each of the icons is given as follows:
Open contact icon. By clicking on this icon (or using a key '"') we enter an open contact into Network. We need to position the element we have entered at a specified place (black space). Following this, a message window where data can be entered (open contact address-number of words, bit position) is activated automatically.
Closed contact icon. By clicking on this icon (or '/' on keyboard) we enter a closed contact or inverted condition into network.
Horizontal line. By clicking on this icon (or using '-' on a keyboard), horizontal line is lengthened out from left to right. SYSWIN, however, retains a right to make drawn lines optimal in terms of length, or to point out possible errors. This option is used when you need to add another condition before an instruction contingent upon this condition, or when something simply can not fit.
Vertical line. With a click on this icon, or use of '?', we draw vertical lines from top to bottom. This option is necessary to realize parallel connections between contacts.
Output instruction. This represents an instruction that is executed if condition instruction preceding it is executed. With the help of this instruction we advance a result of logical expression with output variables (bits). We can arrive to this instruction with the help of keyboard ('O' key).
Inverted output instruction (shortcut-key 'Q'). Similarly to the previous case, with this executing instruction we advance a result of logical expression to an output bit, and the only difference is that this bit is turned on if a condition is not executed and vice versa.
PLC functions (shortcut-key 'F'). Click on this icon accomplishes possibility of installment of complex PLC instructions into a program. Window that appears following a click on the icon contains all instructions sorted by sections. Some of these instructions are given separately as icons, and some can be accessed only through this option. One such instruction is END instruction which is used in each program. Window that comes up is displayed in the following picture.
When this window pops up, select an instruction and click on OK.
Click on this icon (or using 'T' key) will give you an option to enter a timer into the program. Using a mouse, click on the bright area of the monitor, and a message window comes up where you can enter needed information relating to a timer (timer designation and duration in milliseconds). This way, we get a classic timer or timer with a delay when turned on. If some other version of a timer is needed, preceding FUN icon should be used, and option Timers and counters (see picture above) selected.
Counter icon. Click on this icon (or 'C' key), and this will install a classic counter into a PLC program. Prior to this we enter needed information in message window: designation of the counter (CNT001 for instance) and counter value. Change of counter status (decrementing by 1) is done when an input signal (CP) changes from OFF to ON status.
With this icon we can invert previously entered contact, output or input. Inversion is done so that we first click on this icon, and then on a variable whose inversion we wish to perform.
Erase icon. Click on this icon and a shaded area of network erases the shaded part of the program.
Mouse plays an important part in the SYSWIN program. Each double-click on any PLC instruction results in a corresponding editor where necessary changes can be entered. This principle is accordingly installed into SYSWIN, so double-click on block or network heading (BLOCK HEADER BAR or NETWORK HEADER BAR) gives the same results.
6.8 PLC controller working modes
There are several ways to find out the present working mode, for example from an Online Mode menu or its display in a Toolbar. This option is accessible if communication was successfully established with a PLC controller.
If we choose a mode that differs from a present one, change of mode will be momentary. In order to avoid an accidental change of PLC controller mode, there is an option that obliges a computer to ask a question before each mode change, whether that is the option a user really wants (this option is included as default). PLC controller has three modes in class C, MONITOR, RUN and PROGRAM/STOP mode.
6.9 RUN MODE
This PLC mode enables program to be executed as basic operation. It is used in final testing, after a program has been tested in detail, and errors have been eliminated. SYSWIN can not change memory contents of PLC controller in this mode, neither is the change of a program being executed possible. Of course, when program is finished and tested, PLC begins its new life in command closet, being first set to RUN mode.
6.10 Monitor mode
In this mode, program execution is possible, as well as editing and monitoring during operation. This is the most frequently used mode in program development. When this mode has been selected, controller has an obligation to supply a PC with information which relates to program itself, or more precisely to status of variables in the program. If we additionally confirm Monitoring option from an Online menu, we can follow current values of variables on the monitor itself, in real time.
All changes in inputs and outputs can be viewed on the monitor, and status of variables and program locations used in the program are registered and memorized.
6.11 Program-Stop mode
Choosing this mode simply stops a PLC controller if PLC was in RUN or MONITOR mode. It is used for data and program transfer to PLC controller.
6.12 Program execution and monitoring
Program transferred from a PC to a PLC starts executing at the moment when you move from a Stop/Program mode to a Monitor or Run mode. When Monitoring function starts executing, some sections of the monitor will be shaded (see picture above), and this way you can follow program execution. Monitoring is active during editing of some program segment, and is stopped at the moment when a changed section of the program is transferred into a PLC controller.
6.13 Impact on the program during monitoring
During monitoring, you can use the right button on the mouse to call up a menu of some elements of ladder diagram. Menu that appears when we click on location where address of some bit is positioned, contains the following elements:
Force Set - used for permanent forced set up of bit status to ON
Force Reset - used for permanent forced set up of bit status to OFF
Cancel - cancels out the forced status
Set (1) - used for a brief change of bit status from OFF to ON status
Reset (0) - used for a brief change of bit status from ON to OFF status
Cancel All - cancels out forced status of all bits
With the help of these options, status of bits can be changed, word contents in controller memory can also be changed, and all or some of the earlier forced settings can be cancelled out. The concept of forcing entails forced set up of some input/output to ON or OFF status for program reevaluation. At the moment when PLC leaves monitoring regime, data on forced bits and words is lost. Simultaneous forcing and evaluation of contents of a greater number of dimensions, and Data Set Bar is used for this, usually found at the bottom of the monitor (see previous picture). Editing as well as defining an area in Data Set Bar is accomplished with a double click following which a corresponding message window appears, and we write here address for the bit whose status we are following.
6.14 Graphic representation of dimension changes in a program
SYSWIN allows graphic representation of dimensions with time as abscissa. When a monitoring mode is in use, monitor display changes through time, showing changes in values of monitored dimensions. Monitor refreshment is done after a reception of each sample where sample intervals are 0,1-65.5 seconds. Graphics saved in this way can be stored for later analysis as a file, or read in an already saved file.
Procedure for starting graphic monitoring is following:
- from Editors menu select Time chart monitoring option
- from a new tools palette select Trace Configure (pictured as a key).
- Fill out message box Configure Time Chart Monitor (see next picture)
- From Online menu choose Tracing.
With Trace/Configure command adjust parameters for monitoring. Necessary parameters are Trigger or an event where saving will begin, sampling period and bits and/or words whose values we are monitoring. Mapping of a time diagram for dimensions previously specified begins after the last command.
Quitting is done with a click on a black square icon, and restarting is performed by clicking on an a red circle icon. Return to the editor with a ladder diagram by clicking on Editors menu and Program editor submenu.
No comments:
Post a Comment