The text of a manual · part 4 of 39
Series 90-30/20/Micro PLC CPU Instruction Set Reference Manual, pages 28 to 37
Pages 28 to 37 of 337
The original document is the PDF (4.4 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the GE Fanuc IC692CPU211D / IC692MDR541C, Fanuc IC692CPU211D / IC692MDR541C, GE IC692CPU211D / IC692MDR541C and GE Fanuc IC693CPU311X
Page 28
2 logic solution ends when an END instruction is encountered or when the default END OF PROGRAM LOGIC is reached. The 313 and higher CPUs have an Instruction Sequence Coprocessor (ISCP) that executes the Boolean instructions, and an 80C188,80386 or AMD SC 520 microprocessor executes the timer, counter, and function blocks. In the Model 311 and 90-20 CPUs, the 80C188 executes all Boolean, timer, counter, and function block instructions. On the Micro, the H8 processor executes all Boolean and function blocks. A list of execution times for each programming function can be found in Appendix A.
4. Output Scan Outputs are scanned during the output scan portion of the sweep, immediately following the logic solution. Outputs are updated using data from %Q (for discrete outputs) and %AQ (for analog outputs) memory, as appropriate. If you have a Genius Communications Module or Genius Bus Controller that is configured to transmit global data, then data from %G memory is sent to the GCM, GCM+, or GBC. The Series 90-20 and Micro output scans include discrete outputs only. During the output scan, all Series 90-30 output modules are scanned in ascending reference address order. The output scan is completed when all output data has been sent to all Series 90-30 output modules. If the CPU is in the STOP mode and IPScan-Stop parameter on the CPU configuration screen is set to NO, the output scan is skipped.
Caution If the IPScan-Stop parameter on the CPU configuration screen is set to YES, real-world outputs may be turned ON even when the PLC is in STOP mode, because the PLC will write the current values in the output tables to the output modules during the Output Scan.
5. Programmer Communications Window This part of the sweep is dedicated to communicating with the programmer. If there is a programmer attached, the CPU executes the programmer communications window. The programmer communications window will not execute if there is no programmer attached and no module to be configured in the system. Only one module is configured each sweep. Support is provided for the Hand-Held Programmer and for other programmers that can connect to the serial port and use the Series Ninety Protocol (SNP) protocol. Support is also provided for programmer communications with intelligent option modules.
Programmer Communications Window Modes •
GFK-0467M
Limited Mode. In the default Limited window mode, the CPU performs one operation for the programmer each sweep, that is, it honors one service request or response to one key press. If the programmer makes a request that requires more than 6 (or 8 depending on the CPU - see Note) milliseconds to process, the request processing is spread out over several
Chapter 2 System Operation
2-9
Page 29
2 sweeps so that no sweep is impacted by more than 6 (or 8 depending on the CPU - see Note) milliseconds.
Note The time limit for the communications window is 6 milliseconds for the 340 and higher CPUs and 8 milliseconds for the 311, 313, 323, and 331 models. •
Complete Mode. In the Complete mode, the CPU will conduct programmer communications until they are complete or until 50 milliseconds elapses.
The following figure is a flow chart for the programmer communications portion of the sweep.
a45659
START
PROGRAMMER ATTACHED
ATTACHED
PREVIOUS STATUS ?
NO PROGRAMMER REQUEST ?
PROGRAMMER ATTACHED STATUS
HAND-HELD PROGRAMMER ATTACHED
NOT ATTACHED
NOT ATTACHED ABORT OPERATION IN PROGRESS
PREVIOUS STATUS ?
NO
KEY PRESSED ?
SETUP FOR HAND-HELD PROGRAMMER
YES PROCESS REQUEST
ATTACHED
YES SETUP FOR SERIES 90 PROTOCOL
PROCESS KEY
SEND INITIAL DISPLAY
SEND NEW DISPLAY STOP
Figure 2-2. Programmer Communications Window Flow Chart
6. System Communications Window (Models 331 and Higher) This is the part of the sweep where communications requests from intelligent option modules, such as the PCM or DSM, are processed (see flow chart). Requests are serviced on a first-come-firstserved basis. However, since intelligent option modules are polled in a round-robin fashion, no intelligent option module has priority over any other intelligent option module. In the default Run-to-Completion mode, the length of the system communications window is limited to 50 milliseconds. If an intelligent option module makes a request that requires more than 50 milliseconds to process, the request is spread out over multiple sweeps so that no one sweep is impacted by more than 50 milliseconds.
2-10
Series 90™-30/20/Micro PLC CPU Instruction Set Reference Manual – May 2002
GFK-0467M
Page 30
2
START a43066
ANY REQUESTS IN QUEUE ?
NO
YES DEQUEUE A REQUEST
PROCESS THE REQUEST
NO
WINDOW TIMER TIMEOUT ? YES
POLLING STOPPED ?
NO
YES RESTART POLLING
STOP
Figure 2-3. System Communications Window Flow Chart
7. Reconfiguration During this portion of the sweep, the CPU checks the actual hardware lineup against the configured hardware lineup. Slots that are configured for a module but that are empty physically, or slots that contain faulted modules, will not be scanned by the CPU (i.e. the CPU will not read any input data from, and will not send any output data to that module or slot). During reconfiguration, if the CPU detects that a slot previously identified as containing a faulted module now has a good module, or that a configured module has been physically added to the PLC, it will begin scanning that module. Reconfiguration enables the CPU to do the following:
GFK-0467M
•
Recognize a legitimate change that you make in the configuration.
•
Ignore potentially corrupted or inaccurate input data from faulted or missing modules.
•
Avoid sending output data that could become corrupted by a faulted output module.
Chapter 2 System Operation
2-11
Page 31
2 8. Checksum Calculation A checksum calculation is performed on the user program at the end of every sweep. Since it would take too long to calculate the checksum of the entire program, you can specify the number of words from 0 to 32 to be checked on the CPU configuration screen. If the calculated checksum does not match the reference checksum, the program checksum failure exception flag is raised. This causes a fault entry to be inserted into the PLC fault table and the PLC mode to be changed to STOP. If the checksum calculation fails, the programmer communications window is not affected. The default number of words to be checksummed is 8.
PCM Communications with the PLC (Models 331 and Higher) There is no way for intelligent option modules (IOM), such as the PCM, to interrupt the CPU when they need service. The CPU must poll (check periodically) each intelligent option module for service requests. This polling occurs asynchronously in the background during the sweep (see flow chart below). When an intelligent option module is polled and sends the CPU a service request, the request is queued for processing during the system communications window.
Figure 2-4. PCM Communications with the PLC
2-12
Series 90™-30/20/Micro PLC CPU Instruction Set Reference Manual – May 2002
GFK-0467M
Page 32
2
Digital Servo Module (DSM) Communications with the PLC The DSM302 and DSM314 are intelligent option modules that operate asynchronously with the Series 90-30 CPU module. Data is exchanged between the CPU and a DSM automatically via %Q, %I, %AQ, and %AI memory. A PLC CPU requires time to read and write the exchange data across the PLC backplane with the DSM module. Table 2-2 lists the sweep impact for the various possible DSM configurations. For additional timing considerations that apply to the DSM modules, refer to the following manuals: •
Motion Mate DSM302 for Series 90-30 PLCs User’s Manual, GFK-1464.
•
Motion Mate DSM314 for Series 90-30 PLCs User’s Manual, GFK-1742.
Standard Program Sweep Variations In addition to the normal execution of the standard program sweep, certain variations can be encountered or forced. These variations, described in the following paragraphs, can be displayed and/or changed from the programming software.
Constant Sweep Time Mode In the standard program sweep, each sweep executes as quickly as possible with a varying amount of time consumed each sweep. An alternative to this is CONSTANT SWEEP TIME mode, where each sweep consumes the same amount of time. You can achieve this by setting the Configured Constant Sweep, which will then become the default sweep mode, thereby taking effect each time the PLC goes from STOP to RUN mode. You may set a CONSTANT SWEEP TIME mode value between 5 to 200 milliseconds for CPUs 311-341 or between 5 and 500 milliseconds for the 350364 and 374 CPUs. Due to variations in the time required for various parts of the PLC sweep, the constant sweep time should be set at least 10 milliseconds higher than the sweep time that is displayed on the status line when the PLC is in NORMAL SWEEP mode. This prevents the occurrence of extraneous oversweep faults. Use the CONSTANT SWEEP TIME mode when I/O points or register values must be polled at a constant frequency, such as in control algorithms. Another reason might be to ensure that a certain amount of time elapses between the output scan and the next sweep’s input scan, permitting inputs to settle after receiving output data from the program. If the constant sweep timer expires before the sweep completes, the entire sweep, including the communications windows, is completed. However, an oversweep fault is logged at the beginning of the next sweep.
GFK-0467M
Chapter 2 System Operation
2-13
Page 33
2
Configuring Constant Sweep Mode There are two ways to configure Constant Sweep Mode: •
In Logicmaster configuration software, the CPU configuration screen has configurable Sweep Mode and Sweep Timer parameters. After making your selections, you must store the configuration from the programmer to the PLC during STOP mode before the changes will take effect. Once stored, this configuration becomes the default sweep mode.
•
In Logicmaster programming software, the PLC Sweep Table selection on the PLC Control and Status menu has Sweep Mode and Timing parameter selection options. The parameters on this screen can only be edited in RUN mode. Changes made from this screen are only stored to the PLC, not to the folder on your PC, and are only effective while the PLC remains in Run mode. Once the PLC stops, it assumes the default Sweep Mode, which becomes effective the next time the PLC goes into Run mode. This method for temporarily configuring the Sweep Mode is useful for system design and debug operations.
PLC Sweep When in STOP Mode When the PLC is in STOP mode, the application program is not executed. Communications with the programmer and intelligent option modules continue. In addition, faulted module polling and module reconfiguration execution continue while in STOP mode. For efficiency, the operating system uses larger “time-slice” values than those used in RUN mode (usually about 50 milliseconds per window). You can choose whether or not the I/O is scanned. I/O scans may execute in STOP mode if the IOScan-Stop parameter on the CPU detail screen is set to YES.
Caution If the IPScan-Stop parameter on the CPU detail screen is set to YES, realworld outputs may be turned ON even when the PLC is in STOP mode, because the PLC will write the current values in the output tables to the output modules during the Output Scan.
Communication Window Modes The default window mode for the programmer communication window is “Limited” mode. That means that if a request takes more than 6 milliseconds to process, it is processed over multiple sweeps, so that no one sweep is impacted by more than 6 milliseconds. For the 313, 323, and 331 CPUs, the sweep impact may be as much as 12 milliseconds during a RUN-mode store. The active window mode can be changed using the “Sweep Control” screen in Logicmaster - for instructions on changing the active window mode, refer to Chapter 5, “PLC Control and Status,” in the Logicmaster 90™ Series 90™-30/20/Micro Programming Software User’s Manual (GFK-0466).
Note If the system window mode is changed to Limited, then option modules such as the PCM or GBC that communicate with the PLC using the system window will have less impact on sweep time, but response to their requests will be slower.
2-14
Series 90™-30/20/Micro PLC CPU Instruction Set Reference Manual – May 2002
GFK-0467M
Page 34
2
Keylock Switch on 35x, 36x and 37x Series CPUs: Change Mode and Flash Protect All 350 - 374 CPUs have a keylock switch (CPUs 311-341 do not); however, some versions of CPU firmware do not support all keylock switch features. These differences are discussed in this section. Note that the keylock switches on some of these CPUs are labeled ON/RUN and OFF/STOP, and on others are labeled ON and OFF. Regardless of the labeling, all of these keylock switches work as described below.
Flash Memory Protection (Hard-Wired) This hard-wired, non-configurable feature can be used to prevent Flash memory from being changed by unauthorized people (people without a key). When the keylock switch is in the ON position, Flash memory cannot be written to. Flash memory can only be written to when this switch is OFF. This keylock switch feature is always in effect, regardless of how the next two configurable features are set.
Run/Stop (Configurable) This configurable feature was introduced in CPU firmware release 7.00. It is set by the R/S Switch parameter on the CPU configuration screen. The R/S Switch parameter is set to Disabled by default. If the R/S Switch parameter is set to Enabled, you can stop the PLC by turning the keylock switch to OFF, and start the PLC by turning the switch to ON (if there are no faults). If faults exist, one of the following will happen: •
If the PLC has a non-fatal fault, turning the keylock switch from OFF to ON will cause the PLC to go into run mode, and the RUN light will turn on steady, but the fault tables will not be cleared.
•
If the PLC has a fatal fault, turning the keylock switch from OFF to ON will cause the RUN light to flash on and off for a period of five seconds, and the PLC will not go into run mode. This flashing light indicates the presence of one or more fatal faults in the Fault Tables. You can try to clear the fault table faults by turning the keylock switch from OFF to ON again during the five-second period. (If the five-second period has expired, turning the keylock switch from OFF to ON will start another five-second period.) If the faults do not clear using this method, you will have to remedy the causes of the fatal faults before being able to resume operation. See Chapter 3 for fault details.
Other Run/Stop Keylock Switch Considerations
GFK-0467M
•
If the R/S Switch parameter is set to Enabled and the keylock switch is in the OFF position, the PLC will be in STOP mode, and the programming software cannot be used to place the PLC into RUN mode.
•
If the R/S Switch parameter is set to Enabled, the keylock switch is in the ON position, and there are no fatal faults, the programming software can be used to toggle the PLC between the RUN and STOP modes.
Chapter 2 System Operation
2-15
Page 35
2 •
If the R/S Switch parameter is set to Enabled, the keylock switch is in the ON position, but the PLC is stopped, you can place the PLC into RUN mode by either turning the keylock switch to the OFF position and then back to ON, or by using the programming software.
RAM Memory and Override Protection (Configurable) This feature was introduced in CPU firmware release 8.00. It is set by the Mem Protect parameter on the CPU configuration screen. The Mem Protect parameter is set to Disabled by default. If the Mem. Protect parameter is set to Enabled, and the keylock switch is in the ON position, the following is true: •
User RAM memory (program and configuration) cannot be changed.
•
Discrete points cannot be overridden.
•
The Time of Day (TOD) clock cannot be changed with the Hand-Held Programmer (however, the TOD clock can still be changed using the configuration software).
Safeguard your Keys Each new 350 - 374 CPU is shipped with two keys for the keylock switch. If you use one or more of the keylock switch protection features described above, we recommend you carefully safeguard your keys. If they are lost, misplaced, or stolen, you may be locked out from working on your PLC, and unauthorized persons may have access to it. You may want to purchase spare keys for backup purposes, or if more than two persons need access to the PLC. A keylock switch key kit, containing three sets of keys, can be purchased from a GE Fanuc distributor. When ordering, request catalog number 44A736756-G01. All 350 - 374 CPUs use the same key.
Disabling Keylock Switch Features If you do not need to use any of the protection features of the keylock switch, you can choose to disable them all. To do so, leave the keylock switch set to the OFF position, and set the R/S Switch and Mem. Protect parameters (described above) to Disabled (their default setting). In this condition, all keylock switch protection features will be disabled, and you will not need to use a key to access the PLC.
2-16
Series 90™-30/20/Micro PLC CPU Instruction Set Reference Manual – May 2002
GFK-0467M
Page 36
2
Section 2: Program Organization and User References/Data The user memory size for the Series 90-30 programmable controllers is listed in the following table. User Memory Size CPU Models
User Memory (Kbytes)
CPU311
6
CPU313, CPU323
12
CPU331
16
CPU340
32
CPU341
80
CPU350
80 (release 9.00 and later) 32 (prior to release 9.00)
CPU351, CPU352, CPU360, CPU363, CPU364, CPU374
240 (release 9.00 and later) 80 (prior to release 9.00)
Beginning with firmware release 9.00 CPUs, %R, %AI, and %AQ memory sizes for the 351, 352, 360, 363, 364 and 374 CPUs are configurable. (For details, refer to the Logicmaster 90™ Series 90™-30/20/Micro Programming Software User’s Manual, GFK-0466K or later or the User’s Manual for your programmer software). A program for the Series 90-20 programmable controller can be up to 2 KB in size for a Model 211 CPU, and the maximum number of rungs allowed per logic block (main or subroutine) is 3000. For Series 90-30 PLCs, the maximum block size is 80 kilobytes for C blocks and 16 kilobytes for LD and SFC blocks; however, in an SFC block, some of the 16 KB is used for the internal data block. As shown in the next figure, user program logic is executed repeatedly by the PLC while the PLC is in normal Run mode. a45660A
Read Inputs
Execute Program Logic
Write Outputs
Refer to the Series 90-30 Programmable Controller Installation and Hardware Manual, GFK0356, or the Series 90-20 Programmable Controller User’s Manual, GFK-0551, for a listing of program sizes and reference limits for each model CPU. All programs have a variable table that lists the variable and reference descriptions that have been assigned in the user program. The block declaration editor lists subroutine blocks declared in the main program.
GFK-0467M
Chapter 2 System Operation
2-17
Page 37
2
Subroutine Blocks A program can “call” subroutine blocks as it executes. A subroutine must be declared through the block declaration editor before a CALL instruction can be used for that subroutine. A maximum of 64 subroutine block declarations in the program and 64 CALL instructions are allowed for each logic block in the program. The maximum size of a subroutine block is 16 KB or 3000 rungs, but the main program and all subroutines must fit within the logic size constraints for that CPU model.
Note Subroutine blocks are not supported in the Series 90-20 PLC or the Micro PLC. The use of subroutines is optional. Dividing a program into smaller subroutines can simplify programming, enhance understanding of the control algorithm, and possibly reduce the overall amount of logic needed for the program.
Examples of Using Subroutine Blocks As an example, the logic for a program could be divided into three subroutines, each of which could be called as needed from the program. In this example, the program block might contain little logic, serving primarily to sequence the subroutine blocks.
-
A subroutine block can be used many times as the program executes. Logic which needs to be repeated several times in a program could be entered in a subroutine block. Calls would then be made to that subroutine block to access the logic. In this way, total program size is reduced.
2-18
Series 90™-30/20/Micro PLC CPU Instruction Set Reference Manual – May 2002
GFK-0467M