062-00381-010 - Control Technology, Inc.
Transcription
062-00381-010 - Control Technology, Inc.
Control Technology Inc. Automation Systems Training Program 2500 Series Training Course 1 CONTROL TECHNOLOGY INC. 2500 Series Training Course 1 Control Technology Inc. 5734 Middlebrook Pike Knoxville, TN 37921 Phone 865-584-0440 • Fax 865-584-5720 www.controltechnology.com ©2008-2012 Control Technology Inc., all rights reserved This manual may contain references to brand and product names which are trade names, trademarks, and/or registered trademarks of Control Technology Inc., Siemens® AG, Texas Instruments, Rockwell Automation, and FasTrak Softworks. Every effort has been made to ensure the accuracy of this manual; however, errors do occur. CTI provides the manual on an “as is” basis and assumes no responsibility for direct or consequential damages resulting from the use of this manual. This manual is supplied without any express or implied warranty of any kind, including but not limited to the warranties of merchantability or fitness for a particular purpose. This manual, the products it references, and the product specifications are subject to change without notice. If you have any comments or discover an error, please contact us by phone at 1-800-537-8398 or visit our website at www.controltechnology.com . Siemens®, SIMATIC® and Series 505® are registered trademarks of Siemens AG and Siemens Energy & Automation, and TISOFT™ is a trademark of Siemens Energy and Automation. Inc. Any references herein to “505” are intended as references to the Siemens or SIMATIC 505 product line. While Control Technology, Inc.’s 2500 series products are compatible with the SIMATIC Series 505, Siemens in no way endorses or sponsors CTI or the 2500 series. Neither is CTI in anyway affiliated with Siemens. WorkShop® and FTTrend® are registered trademarks of FasTrak SoftWorks, Inc. Windows® is a registered trademark of Microsoft Corporation. CTI Part No. 062-00381-010 Published 04/24/12 Table of Contents Introduction ........................................................................................... 1 Understanding the 2500 Series System Architecture ..................................... 1 Hands-on Application Development ................................................................ 1 Additional Documentation ................................................................................ 2 Chapter 1. PLC Memory Architecture .............................................. 3 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 User Program Memory ........................................................................... 3 User Program Elements.......................................................................... 3 I/O Registers ............................................................................................ 4 Control Relays ........................................................................................ 4 Status Words........................................................................................... 4 Configuration Data ................................................................................ 5 Flash Memory ......................................................................................... 5 High-Speed DRAM ................................................................................. 5 Chapter 2. PLC Scan Cycle ................................................................. 7 2.1 2.2 2.3 Scan Overview ........................................................................................ 7 Discrete Scan............................................................................................ 8 Analog Scan ............................................................................................. 9 2.3.1 Cyclic Analog Tasks ...................................................................................... 9 2.3.2 Non-Cyclic Analog Tasks ........................................................................... 10 2.6 2.7 Cyclic RLL ............................................................................................. 10 PLC Scan Types .................................................................................... 10 2.7.1 Fixed Scan .................................................................................................... 11 2.7.2 Variable Scan ............................................................................................... 11 2.7.3 Variable Scan with Limit............................................................................ 11 2.8 Scan Modes ............................................................................................ 12 2.8.1 Discrete Scan Mode ..................................................................................... 12 2.8.2 Analog Scan Mode....................................................................................... 13 2.8.3 Scan Locking Mode ..................................................................................... 13 Chapter 3. 2500 Series Hardware ..................................................... 15 3.1 3.2 2500 Series System Overview ............................................................... 15 2500 Series System Components.......................................................... 17 Control Technology Inc. 2500 Series Training Course 1 Page i 2500 Se Chapter 4. Addressing and Memory Structure ............................... 23 4.1 Digital and Analog I/O Addressing ..................................................... 23 4.1.1 Digital Inputs and Outputs ........................................................................ 23 4.1.2 Analog Inputs and Outputs ........................................................................ 24 4.2 4.2.1 4.2.2 4.2.3 4.2.4 4.3 I/O Concepts .......................................................................................... 24 Discrete Image Register.............................................................................. 25 Word Image Register.................................................................................. 26 Normal I/O Updates.................................................................................... 26 Immediate I/O Updates .............................................................................. 26 Memory Types ....................................................................................... 27 4.3.1 Program Memory ....................................................................................... 27 4.3.2 Data Memory............................................................................................... 28 4.3.3 System Memory ........................................................................................... 28 Chapter 5. Configuration and Setup ................................................. 31 5.1 5.2 5.2.1 5.2.2 5.2.3 5.2.4 5.3 Configuration Overview ....................................................................... 31 Communications Path ........................................................................... 32 RS232 Port Details ...................................................................................... 32 Communications Setup in WorkShop ...................................................... 34 Serial Port Setup ......................................................................................... 35 Quick Connect Communications Setup .................................................... 36 PLC Configuration ................................................................................ 37 5.3.1 PLC Type Setup .......................................................................................... 37 5.3.2 PLC Memory Configuration...................................................................... 38 5.4 I/O Configuration .................................................................................. 40 5.4.1 Configuring 32-Pt Digital Input Module .................................................. 42 5.4.2 Configuring 32-Pt Digital Output Module ............................................... 43 Chapter 6. Discrete RLL Programming ........................................... 45 6.1 6.2 Introduction ........................................................................................... 45 Opening a Program ............................................................................... 46 6.2.1 Ladder Editor .............................................................................................. 47 6.2.2 Toolbar Icons............................................................................................... 48 6.3 6.4 6.4.1 6.4.2 6.4.3 6.4.4 6.4.5 6.4.6 Page ii Insert a RLL Network........................................................................... 49 Discrete Contacts and Coils .................................................................. 50 Normally Open Contact ............................................................................. 50 Output Coil .................................................................................................. 51 Normally Closed Contact ........................................................................... 52 Series (AND) Contacts ................................................................................ 52 Parallel (OR) Contacts ............................................................................... 53 Not Coil Output ........................................................................................... 54 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 6.4.7 6.4.8 6.4.9 6.4.10 6.5 6.6 6.7 6.8 6.9 6.10 Logical NOT Contact .................................................................................. 54 Set Coil Output ............................................................................................ 55 Reset Coil Output ........................................................................................ 55 One Shot Contact ........................................................................................ 56 Saving a Program .................................................................................. 56 Program Download ............................................................................... 57 Transfer PLC to RUN Mode ................................................................ 57 Monitor Program Status ...................................................................... 58 On-Line Edit .......................................................................................... 64 Timer and Compare Instructions ........................................................ 65 6.10.1 6.10.2 6.10.3 6.10.4 6.10.5 6.10.6 6.10.7 Motor Control or ON/OFF Station Example ........................................... 65 Creating Tag Names and Descriptors ....................................................... 66 Integer Number Format ............................................................................. 69 Timer Operation .......................................................................................... 70 Creating Timers .......................................................................................... 71 Compare Operation .................................................................................... 72 Timer and Pulse Timer Application .......................................................... 74 6.11 Counter Instructions ............................................................................. 76 6.11.1 Up Counter .................................................................................................. 76 6.11.2 Up/Down Counter ....................................................................................... 77 6.11.3 Counter Application.................................................................................... 79 6.12 Move Word and Date Compare Instructions ..................................... 80 6.12.1 6.12.2 6.12.3 6.12.4 6.12.5 Move Word Description ............................................................................. 80 Move Word Application ............................................................................. 81 Date Compare Description ......................................................................... 82 Data Representation.................................................................................... 83 Date Compare Application ......................................................................... 84 6.13 Event Drum and Load Data Constant Instructions .......................... 86 6.13.1 Load Data Constant Description ............................................................... 86 6.13.2 Event Drum Description ............................................................................. 87 6.13.3 EDRUM and LDC Application .................................................................. 92 6.14 Shift Registers ........................................................................................ 96 6.14.1 6.14.2 6.14.3 6.14.4 Bit Shift Register Description .................................................................... 96 Bit Shift Register Application .................................................................... 98 Word Shift Register Description ............................................................. 101 Word Shift Register Application ............................................................. 103 Chapter 7. PLC Program Control .................................................. 107 7.1 7.2 Program Structure .............................................................................. 107 END Instruction .................................................................................. 110 Control Technology Inc. 2500 Series Training Course 1 Page iii 2500 Se 7.3 Master Control Relay (MCR) ............................................................ 111 7.3.1 MCR Description ...................................................................................... 111 7.3.2 MCR Application ...................................................................................... 112 7.4 Jump to Jump-End.............................................................................. 113 7.4.1 Jump Description ...................................................................................... 113 7.4.2 Jump Application ...................................................................................... 114 7.5 Skip-to-Label ....................................................................................... 115 7.5.1 Skip-to-Label Description ........................................................................ 115 7.5.2 Skip-to-Label Application ........................................................................ 116 7.6 Go to Subroutine (GTS) ...................................................................... 117 7.6.1 GTS Description ........................................................................................ 117 7.6.2 GTS Application ....................................................................................... 118 7.7 TASK Instruction ................................................................................ 120 7.7.1 TASK Description ..................................................................................... 120 7.7.2 TASK Application..................................................................................... 122 Chapter 8. Data Formatting ............................................................. 125 8.1 8.2 8.2.1 8.2.2 8.2.2 8.2.3 8.2.4 8.2.5 8.2.6 8.2.7 8.3 Data Elements ...................................................................................... 125 Data Types............................................................................................ 127 Signed Integer ........................................................................................... 127 Unsigned Integer ....................................................................................... 128 Long Integer .............................................................................................. 128 Real Number ............................................................................................. 128 Hexadecimal .............................................................................................. 129 Binary Coded Decimal (BCD) ................................................................. 130 BCD to Binary Conversion ...................................................................... 131 Binary to BCD Conversion ...................................................................... 132 Analog Data.......................................................................................... 133 8.3.1 Analog-to-Digital Conversions................................................................. 133 8.3.2 Signals with 20% Offset ........................................................................... 134 Chapter 9. Math Instructions .......................................................... 137 9.1 Add and Subtract Instructions .......................................................... 137 9.1.1 ADD and SUB Descriptions ..................................................................... 137 9.1.2 ADD Application ....................................................................................... 138 9.2 Multiply Instruction ............................................................................ 141 9.2.1 Multiply Description ................................................................................. 141 9.2.2 Multiply Application................................................................................. 141 9.3 Divide Instruction ................................................................................ 143 9.3.1 Divide Description..................................................................................... 143 9.3.2 Divide Application .................................................................................... 144 9.4 Page iv RLL Math Example Application ....................................................... 145 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Chapter 10. Troubleshooting ........................................................... 147 10.1 10.2 10.3 10.3 10.4 10.5 10.6 10.7 PLC Status Words............................................................................... 147 Alarming and Status Reporting ......................................................... 148 Program Control Monitoring ............................................................ 150 PLC Status ........................................................................................... 153 I/O Status ............................................................................................. 155 Digital Input Module Status ............................................................... 156 Digital Output Module Status ............................................................ 157 Remote I/O Communications Status ................................................. 159 10.7.1 Monitoring Remote I/O Errors ................................................................ 159 10.7.2 Logging Remote I/O Error Counts .......................................................... 160 Chapter 11. Documentation ............................................................. 163 11.1 Print Dialog .......................................................................................... 163 11.2 Selection of Program Elements .......................................................... 164 11.3 Data Range and Print Setup .............................................................. 165 Appendix A. CTI Contact Information .......................................... 167 Appendix B. Replacement/Compatibility Guide ........................... 169 Appendix C. CPU Product Models ................................................. 171 Appendix D. 2500 Series Status Words .......................................... 173 Control Technology Inc. 2500 Series Training Course 1 Page v 2500 Se Page vi 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Introduction A good foundation is essential to a productive experience with any system. T he content of this course is intended for students that have experience with Automation and Control Systems including control devices and PLCs. The student should also have some basic knowledge of ladder or control programming and be competent using a PC with Windows operating system. Understanding the 2500 Series System Architecture Basic PLC concepts Basic system architecture and hardware description Use of Workshop program package PLC program loading, editing, and saving Description and use of common instructions Description and use of program control instructions PLC number formats Handling analog values in Ladder Status words Troubleshooting Hands-on Application Development The students will receive hands on experience with live training systems. Each training system will provide a 2500 Series rack, power supply, processor, and Input/Output modules connected to a PC Application Development Station. Upon completion, the student will be able to: Assemble a CTI 2500 Series Automation System Understand the PLC System operation and architecture Write and edit a RLL (Relay Ladder Logic) program Monitor the operation of a ladder program Troubleshoot a CTI 2500 Series PLC Control Technology Inc. 2500 Series Training Course 1 Page 1 2500 Se Additional Documentation Additional documentation is available on the CTI website at www.controltechnology.com . This includes the following: CTI Product Catalog CTI Product Datasheets and User Manuals Application Notes CTI Replacement Guide for Siemens 505 products Siemens SIMATIC® 505 manual set Page 2 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Chapter 1. PLC Memory Architecture T he CTI 2500 Series controller contains several different types of memory, each with a specific purpose. The memory types are described in the following sections. 1.1 User Program Memory The user program and related data is stored in battery-backed memory. As long as battery power is present, the contents of battery-backed memory will be maintained over a power cycle. The size of the battery backed memory is model dependent. As an alternative, flash memory is provided on all 2500 Series CPUs for permanent storage of user programs and configuration data. This memory replaces the optional EEPROM in the Siemens 505 controllers. See Appendix C for CPU Model information. 1.2 User Program Elements The following user program elements are stored in battery-backed memory Relay Ladder Logic (RLL) Program Special Function Programs Special Function Subroutines Loop Parameters Analog Alarm Parameters Variable Data – 16 bit words Constant Data – 16 bit words Timer Counter Data Drum Data Shift Register Data Table Move Data One-Shot Instruction Data The amount of memory allocated to the user program elements may be specified by the user as part of the PLC configuration. Control Technology Inc. 2500 Series Training Course 1 Page 3 2500 Se 1.3 I/O Registers The CTI 2500 controller contains two I/O registers, which are memory areas used to hold I/O values. The discrete I/O register contains Boolean values (0 or 1). The word I/O register contains 16 bit word values. The size of the I/O register depends on the product model. See Appendix C for CPU model information. An I/O register address can be used as an Input or an Output. Discrete I/O register Inputs are assigned a designator of X; discrete I/O register Outputs are assigned a designator of Y. For example, an Input associated with discrete I/O register address 6 would be designated as X6 and an Output associated with discrete register address 10 would be designated as Y10. Word I/O register Inputs are assigned a designator of WX while word I/O register Outputs are assigned a designator of WY. For example, an Input associated with word I/O register address 16 would be designated as WX16 and an Output associated with discrete register address 20 would be designated as WY20. The I/O register Output values represent the last value set by the user logic or by programming software. Unless changed by user logic or programming software, the I/O register Input values represent the value last read from the physical I/O point associated with the I/O register address. The I/O register locations are linked to the physical I/O modules by associating the register address with I/O points on a particular module to a range of I/O register addresses. For example, you could assign the 8 points of a discrete Input module to X1-X8 or assign the Outputs of analog Output module to WY9 – WY17. Assignment of I/O register locations to physical module I/O points, which is accomplished within the programming package, is referred to as an I/O configuration. 1.4 Control Relays Control Relays are used for internal storage of discrete (Boolean) data. Control Relays are not associated with the physical I/O. Control Relays can be retentive or non-retentive. Retentive relays hold their value over a power cycle, as long as the battery is good. The number of control relays supported varies with the controller model. See Appendix C for CPU Model information. 1.5 Status Words Status Words are used to provide information about the controller operation. Because Status Words can be read by user logic, they can be used to condition the operation of the controller. In addition, the Status Words can be accessed by user programs or supervisory control software. See Appendix D for a description of the System Status Words. Page 4 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 1.6 Configuration Data The following configuration data is maintained in the battery backed memory: I/O Configuration The I/O configuration data includes the I/O Configuration, which associates the logical I/O addresses with the physical I/O points, and the base enable status. Memory Configuration The memory configuration contains the user memory allocation for each of the user program elements listed in Section 1.2 above. Profibus Configuration The Profibus configuration includes the Profibus parameter sets, which define the characteristics of the Profibus bus and slaves; the operational parameters, and the Profibus I/O configuration table. Scan Configuration The scan configuration includes the scan type, the scan time, the task codes per scan, the scan watchdog value, and the analog scan time slice configuration. See Chapter 2 for a description of the CTI 2500 CPU scan. Password Data The password data includes the user password, the access level, and the enable status. 1.7 Flash Memory Non-volatile flash memory is used to store the operating firmware for the controller. The firmware can be updated in the field. See Appendix E for more information. 1.8 High-Speed DRAM Because the DRAM (Dynamic Random Access Memory) is significantly faster than either battery backed memory or flash memory, it is used to execute the operating firmware, user program instructions, I/O registers, and Control Relays. The contents of the DRAM are lost when power is removed and must be refreshed from nonvolatile storage during controller power up start. Control Technology Inc. 2500 Series Training Course 1 Page 5 2500 Se Page 6 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Chapter 2. PLC Scan Cycle T his chapter presents the concepts of the Scan Cycle processing, when certain functions are performed in the cycle and how to customize the scan time behavior. 2.1 Scan Overview The controller executes most tasks in a cyclical sequential order. This order is referred to as the controller scan. There are two major divisions to the CTI 2500 controller scan; the discrete scan and the analog scan. The discrete scan contains elements commonly found in traditional programmable logic controllers. The analog scan provides an execution framework better suited to process control tasks such as PID loops and analog alarms. Discrete Scan Analog Scan Figure 2.1 Controller Scan Control Technology Inc. 2500 Series Training Course 1 Page 7 2500 Se 2.2 Discrete Scan The Discrete Scan consists of three tasks. These tasks always run to completion. Normal I/O Update Main RLL SF I/O Figure 2.2 Discrete Scan Normal I/O During the Normal I/O task, I/O register Output values are transferred to the physical I/O and new Input values are obtained from the physical I/O and written to the I/O register. All configured I/O points are fully updated each scan. RLL Execution During the Main RLL Execution task, the Relay Ladder Logic is evaluated and executed. The I/O register is updated with values set by the RLL. Physical I/O may be read or written during the RLL execution by using immediate I/O instructions. Special Function I/O During the Special Function I/O tasks, requests from the Special Function modules installed in the local and remote bases are processed and requests from remote base controller communications ports are serviced. Page 8 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 2.3 Analog Scan The Analog Scan consists of tasks that may require multiple scans to complete. Included in this scan are the Loops, Alarms, and Special Function programs as well as communications and diagnostic functions. Each task in the Analog Scan is allotted a time slice in which to. Except for the diagnostic task, whose time slice is fixed, the time allocated to each task can be configured. This allows you to optimize the controller performance for your application. Analog Loops (Cyclic) Analog Alarms Runtime Diags Cyclic SF Programs Priority SF Programs Normal SF Programs Ladder SF Sub Network Com Priority Com Normal Com Ladder SF Sub0 Figure 2.3 Analog Scan These analog tasks are further specified in the following sections. 2.3.1 Cyclic Analog Tasks Cyclic tasks execute on a time interval basis, based on a user-specified sample rate. Cyclic tasks include Analog Loops, Analog Alarms, and Cyclic Special Function (SF) programs. As illustrated in the Figure 2.3, these cyclic tasks are executed in separate time slices. Execution is prioritized based on how close an instance of the Loop, Alarm, or SF program is to overrunning (scheduled for another execution before the previous execution is finished). At the beginning of the time slice, the highest priority instance is executed first. Execution continues until the instance completes or the time slice expires. If it completes before the time slice expires, the next highest priority instance will be executed. If the time slice expires before an instance completes, the instance is suspended. When there are no more instances to be executed or when the time slice expires, the controller begins executing the next analog task. If an instance has not completed executing before it is scheduled to execute again, an overrun flag will be set. Special Function programs called by Loops or Alarms will be executed during the time slice of the task which called it. Similarly, Special Function Subroutines called by Special Function Programs or other Special Function Subroutines shall be executed during the calling program time slice. Control Technology Inc. 2500 Series Training Course 1 Page 9 2500 Se 2.3.2 Non-Cyclic Analog Tasks Non-cyclic analog tasks are triggered from ladder or are otherwise event based. They include: Priority and Normal SF programs These programs are queued for execution when the SFPGM RLL box receives power flow. The processes are executed in the order in which they are queued. There is a separate task for priority SF programs and normal SF programs. RLL Requested SF Subroutines These subroutines are queued for execution when SFSUB RLL box receives power flow. There is a separate task for SFSUB and SFSUB0 instructions requests. Normal Communications This task processes deferred requests that require several scans to complete, such as program edit operations. These requests may originate from the local serial port, USB port, local Ethernet port, or from Special Function modules. Priority Communications This task processes all requests from the serial and USB ports that can be processed in a single scan. Network Communications This task processes all requests from the local Ethernet port, except deferred requests. Run-time diagnostics Run-time diagnostics are executed continuously to ensure PLC hardware is functioning properly. The diagnostic task executes for a maximum of 1ms per scan. NOTE: PID Loops, Special Function Programs, and SF Subroutines called from the RLL program that are marked for In-Line execution are executed immediately during the RLL portion of the scan 2.6 Cyclic RLL Cyclic RLL instructions are executed on a user-specified interval. When queued for execution, it will interrupt any other task in the discrete scan or the analog scan. See the CTI 2500 Programming Reference Manual for additional information. 2.7 PLC Scan Types The CTI 2500 Series controller provides three scan types: Fixed Scan, Variable Scan, and Variable Scan with Limit. Page 10 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 2.7.1 Fixed Scan When a Fixed Scan time is selected, the controller will attempt to start a new scan when the scan time interval specified by the user expires. All tasks in the Discrete Scan will be executed once. Then each task in the Analog Scan will be executed at least once. If all analog tasks have been executed within the specified scan time, the controller will re-check all communications tasks (Normal, Priority, and Network) and process any outstanding requests until the scan time expires. If a task is processing when it is time to start a new scan, it will be suspended until the next scan. If there is no work to be done, the PLC will idle until it is time to start another scan. If the total execution time of the Discrete Scan and the first execution of the Analog Scan exceeds the fixed time, the Scan Overrun flag is set. NOTE: To avoid scan overruns, you must set the Fixed Scan time to a value that allows the Discrete Scan tasks to run to completion and all Analog Scan tasks to execute at least once based on the configured time slices. 2.7.2 Variable Scan When Variable Scan is selected, the controller will execute all Discrete and Analog Scan tasks once and then immediately start a new scan. All tasks are guaranteed one execution per scan. Variable Scan provides the fastest PLC scan time and is used in most applications. 2.7.3 Variable Scan with Limit When this option is selected, the controller shall execute the Discrete Scan once and then begin executing Analog tasks. Each Analog task will be guaranteed execution at least once during scan. The PLC will continue executing the Analog Scan tasks as long as there is work to be done or the time limit has been reached. A new scan is started when all Analog tasks are completed or the time limit expires. The scan overrun bit is set in Status Word 1 if the total execution time for one pass through the Discrete and Analog Scan exceeds the time limit. NOTE: To avoid scan overruns, you must set the Time Limit to a value that allows the Discrete Scan tasks to run to completion and all Analog Scan tasks to execute at least once based on the configured time slices. Control Technology Inc. 2500 Series Training Course 1 Page 11 2500 Se 2.8 Scan Modes Normally, the execution mode of the Discrete Scan and Analog Scan are locked together. Placing the controller in RUN mode, places both the Discrete Scan and Analog Scan in RUN mode while placing the controller in PROGRAM mode places both scans in PROGRAM mode. For special application needs, it is possible to set the operating mode of the Discrete Scan and Analog Scan separately. The following sections describe the operating modes of each scan. 2.8.1 Discrete Scan Mode Mode PROGRAM Description When the Discrete Scan is in PROGRAM mode, the RLL tasks do not execute. However, the Normal I/O and Special Function I/O tasks continue to operate normally. RUN When the PLC is in RUN mode, all Discrete Scan elements are executing. EDIT This sub-mode is automatically selected when you modify an RLL program while the controller is in RUN mode. While the controller is in EDIT mode, you can modify the RLL source while the non-modified RLL continues to execute. When you change to RUN mode after editing, the RLL will be recompiled. During this time, which can take several seconds, the I/O will be frozen at the last state. Should the compile fail, the controller will be placed in PROGRAM mode. Page 12 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 2.8.2 Analog Scan Mode Mode PROGRAM Description RUN When the Analog Scan is in RUN mode, all analog tasks are running and enabled control blocks are queued for execution. HALT When the Analog Scan is placed in HALT mode, the Loop, Alarm and Special Function Program/Subroutine tasks will be suspended. However, the enabled control blocks will continue to be queued for execution. When the analog scan mode is changed from HALT to RUN mode, task execution will resume. When the Analog scan is placed in PROGRAM mode, the Loop, Alarm, and Special Function Program/Subroutine tasks do not execute. Nothing will be queued for execution. Other analog tasks, including communication tasks and the diagnostics task, continue to operate normally. THE ANALOG SCAN CANNOT BE PLACED IN PROGRAM MODE WHILE THE DISCRETE SCAN IS IN RUN MODE. 2.8.3 Scan Locking Mode The Discrete Scan and Analog Scan modes are automatically locked when both scan modes are placed in PROGRAM mode. The scan modes are automatically unlocked when the Analog Scan is placed in RUN mode while the Discrete Scan is in PROGRAM mode. You can manually lock and unlock the scans when both scans are in RUN mode. Control Technology Inc. 2500 Series Training Course 1 Page 13 2500 Se Page 14 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Chapter 3. 2500 Series Hardware CTI has been supplying high-performance I/O and communications products to the Automation Industry for over 30 years. T his chapter provides an overview of the types of products and modules CTI offers for the 2500 Series. These products include Power Supplies, Racks, Remote Base Controllers, Digital, Analog, Temperature, Pulse and Communication modules. 3.1 2500 Series System Overview Figure 3.1 CTI 2500 Series System Control Technology Inc. 2500 Series Training Course 1 Page 15 2500 Se The 2500 Series system is composed of: 2500 Series Base The base is the chassis where the modules are installed. It provides the back plane and mounting for the modules. It may be a 4, 8, or 16 slot unit. A system may have 1 Local Base and as many as 15 remote bases. The bases without the processor module are referred to as remote bases and contain a Remote Base Controller. The base with the CPU module is ALWAYS base number 0 (also called the “local base”). The remote bases are numbered from 1 to 15. No duplication is allowed. No numbering order or sequence is required. Base numbers may be skipped as desired. Power Supply The Power Supply is the first module from the left and is not assigned a slot number. The power supply provides logic power for the 2500 Series Modules. Power for field control devices such as relays, sensors, transmitters, actuators, etc. must be provided by external power sources. CPU Module Second module from the left and also is not assigned a slot number. The CPU runs the Control Application, manages all IO, communications, and provides memory for data storage. All remote bases are controlled by a CPU Module. Input/Output Modules Can be inserted into any of the remaining slots. Each I/O module is assigned a slot number corresponding to their physical location. The slots are numbered starting with 1 and increasing left to right to a maximum of 16. Remote Base Controller The remote base controller or RBC is used only in remote bases and is installed in the left slot beside the Power Supply. It controls communications on the extended I/O network or Profibus DP. It provides the direct interface between the CPU and all the IO located in its remote base. CTI has a wide variety of 2500 Series modules available. This discussion is focused upon a general description of the most commonly used modules. Many of the Siemens SIMATIC 505 modules can be replaced by CTI 2500 Series Modules. CTI provides several aids to assist in selecting a Siemens SIMATIC 505 module replacement from CTI. See Appendix B for a conversion chart. Page 16 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 3.2 2500 Series System Components 2500 Base or Rack The Rack contains the Power Supply, CPU or Base Controller and all the IO modules. The 2500 Rack comes in three models: 2500-R4 Four Slot Rack 2500-R8 Eight Slot Rack 2500-R16 Sixteen Slot Rack Power Supply The Power Supply provides logic power. The RED LED indicates Input power is good. All models have a front panel fuse. CTI offers three power supplies: 2510 125VDC Power Supply 2512 75-Watt Power Supply 2515 100-Watt Power Supply Control Technology Inc. 2500 Series Training Course 1 Page 17 2500 Se CPU Models The CTI 2500 Series CPUs are direct replacements for the Siemens SIMATIC® 505 Series 545 and 555 controllers. The front panel will vary depending on the model. CPU GOOD –LED indicating CPU status RUN – LED indicating CPU operation mode. When lit, CPU is executing user program and controlling I/O. BATTERY GOOD – LED that indicates status of battery used for RAM back-up 3 Digit LED – Used to display IP address and Error Codes BATTERY – User-friendly front panel access SD FLASH CARD – Can be used for firmware update USB – High-speed serial port for communications with PC programming software ETHERNET – RJ45 connector for use with TCP/IP networks Supports 10/100Mb data rates RS232 – Serial port compatible with ‘Port 1’ on Siemens 505 controllers. Can be used for communications with PC programming software, HMI devices, or PRINT Output.. PROFIBUS-DP – Provides interface for CPU to serve as Master for Profibus-DP network. I/O –Remote I/O channel that supports up to 15 remote bases. CTI offers four CPU models: 2500-C100 128K CPU 2500-C200 256K CPU 2500-C300 512K CPU 2500-C400 3072K CPU Page 18 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Digital Input Modules Typically all discrete Input modules have an LED for each Input channel. The LEDs indicate the module is detecting an active Input signal. Modules are selected for Input voltage/type and number of channels. The front panels and associated wiring vary depending on model. Refer to the model documentation for wiring requirements. CTI offers the following Discrete Input modules: 2580 16pt Isolated 120VAC Input 2581 16pt Isolated 24VDC Input 2582 16pt Isolated 125VDC Input 2585 16pt TTL/Word Input 2588-8 8pt Universal Input 2589-A 32/16/8pt Universal Input Digital Output Modules Typically all discrete Output modules have an LED for each Output channel. LEDs indicate the Output signal is active in the module. Modules are selected for Output voltage/type, and number of channels. The front panels and associated wiring vary according to model. Refer to the model documentation for wiring requirements. CTI offers these Discrete Output modules: Control Technology Inc. 2590-A 16pt Isolated 120VAC Output 2590-EF 16pt Isolated 120VAC Output 2591-A 16pt Isolated 24VDC Output 2591-EF 16pt Isolated 24VDC Output 2595 16pt TTL/Word Output 2596-8 8pt DC Output 2596 16/8pt DC Output 2597 32/16/8pt DC Output 2598-8 8pt AC Output 2598 16/8pt AC Output 2599 32/16/8pt AC Output 2530 8pt Form-C Relay Output 2531 32pt Form-A Relay Output 2532 16pt Form-A Relay Output 2534 8-pt Form-C Relay Output 2500 Series Training Course 1 Page 19 2500 Se Analog Input Modules Typically one LED labeled ‘Active’ or ‘Good’ is provided for indication that the module is powered and operating as expected. If the LED is flashing or OFF, refer to the manual for troubleshooting information. Model appearance will vary slightly with module type. The modules are selected for signal level and type, and some modules support multiple signal ranges. Wiring and power requirements vary with module. Refer to the appropriate manual for information. CTI offers these Analog Input modules 2550-A 8ch Isolated Analog Input 2551-A 8ch Isolated Thermocouple Input 2552-A 8ch Isolated RTD Input 2553-A 2ch Mag Meter Input 2554-A 4ch Isolated High Speed Counter 2555-A 16ch Analog Input 2556 16ch Isolated Thermocouple Input 2557 16ch RTD Input 2558 8ch Analog Input 2559-RTD 8ch RTD Input 2559-TC 8ch Thermocouple Input Analog Output Modules Typically one LED labeled ‘Active’ or ‘Good’ is provided for indication that the module is powered and operating as expected. If the LED is flashing or OFF, refer to the manual for troubleshooting information. Model appearance will vary slightly with module type. The modules are selected for signal level and type, and some modules support multiple signal ranges. Wiring and power requirements vary with module. Refer to the appropriate manual for information. CTI offers these Analog Output modules 2560-A 8ch Isolated Analog Output 2562 8cht Analog Output Page 20 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Special Function Modules A Special Function (SF) module has a processor and memory. It is capable of operation without direct PLC control and generally runs independent of the scan cycle. In many cases it may continue to operate even if the PLC is not running. Typically SF modules are used for PLC interface to external communication networks. Two examples are shown: Ethernet Adapter and Serial Interface Adapter The 2572/2572-A Ethernet Adapters provide an interface for the PLC to send and/or receive data from other Ethernetcapable devices. Multiple protocols are supported for connection to other PLC manufacturers. The 2573-MOD Serial Interface Adapter provides 4 serial ports to exchange data with plant floor devices. Each port can be individually configured for a specific protocol such as Modbus ASCII, Modbus RTU, General ASCII (GAS), or 505compatible protocols. PLC logic is used to send Output messages and process Input messages. CTI offers the following communications modules: 2572 Ethernet TCP/IP Adapter 2572-A Fast Ethernet TCP/IP Adapter 2573-MOD Serial Interface Adapter with Modbus 2576 DeviceNet™ Scanner Control Technology Inc. 2577 Profibus Slave Adapter 2500 Series Training Course 1 Page 21 2500 Se Remote Base Controllers The Remote Base Controller (RBC) allows a CTI 2500 Series or a SIMATIC® 505 I/O base to function as a slave node on the I/O network. This allows the PLC to control I/O points located some distance away from the controller. The RBC provides the following functions: Compatible with CTI 2500 Series and Siemens 505 controllers and bases LED display shows Error and Status Codes. Selectable station address. CTI provides the following Remote Base Controllers: 2500-RIO - RS-485 Remote I/O Channel 2500-RBC - Profibus-DP network Page 22 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Chapter 4. Addressing and Memory Structure To maximize system flexibility, performance, and functionality, the 2500 Series architecture uses more types of system memory than most other PLCs. T his chapter covers the 2500 System IO addressing, how image registers are used by the system and the different types of memory. It is very important to understand how the system uses memory for reading and writing IO and when various functions occur during the scan cycle. 4.1 Digital and Analog I/O Addressing There are two basic types of Inputs and Outputs. The first type is Digital (or Discrete) Inputs and Outputs and the second type is Analog Inputs and Outputs. Digital I/O values are generally represented by a single bit value while Analog I/O is represented by a word value. NOTE: The “n” used in these discussions refers to the address offset of each I/O point for the specified memory type. This offset value is in the range of 1 to the maximum number of I/O points supported in the CPU model being used. 4.1.1 Digital Inputs and Outputs Digital Inputs are designated Xn where X indicates Input and n is the address number. Examples: X3, X57, X120. Digital Outputs are designated Yn where Y indicates Output and n is the address number. Examples: Y13, Y33, Y230 Digital I/O is stored as bits with a value of a 1 (ON) or 0 (OFF). IMPORTANT: Digital Inputs(X) and Digital Outputs(Y) share the same memory register. For example, X1 and Y1 reference the same memory location. Do NOT duplicate address numbers Control Technology Inc. 2500 Series Training Course 1 Page 23 2500 Se 4.1.2 Analog Inputs and Outputs Analog Inputs are designated WXn where WX indicates word Input and n is the Input address. Examples: WX5, WX42, WX127 Analog Outputs are designated WYn where WY indicates word Output and n is the Output address. Examples: WY3, WY61, WY211 IMPORTANT: Analog Inputs (WX) and Analog Outputs (WY) share the same memory register. For example, WX1 and WY1 reference the same memory location. Do NOT duplicate address numbers 4.2 I/O Concepts The controller uses reserved memory areas called “image registers” for storage of all Discrete and Analog Inputs and Outputs. The image registers provide a fast-access interface between the ladder program and the field I/O modules. The discrete image resister occupies a single bit while each entry in the word (analog) image register is 16-bits. The controller maintains separate image registers for Digital I/O and Analog (word) I/O modules, but the maximum number of points is dependent on the controller model as indicated below: Page 24 Controller Model Discrete I/O Points 2500-C100 2500-C200 2500-C300 2500-C400 1024 2048 8192 8192 2500 Series Training Course 1 Max Analog I/O (16-bit channels) 1024 1024 8192 8192 Control Technology Inc. 2500 Series Advanced C During the I/O period of each PLC scan cycle, the Discrete and Analog Output values stored as a result of the last ladder program scan are transferred from the image registers to the Output modules. Then new Discrete and Analog Input values are read from the Input modules and transferred to the image registers. As the ladder program executes, new values for Discrete and Analog Outputs are written to the image registers. Then the I/O update is repeated. Write Outputs from Image Register to Outputs Modules Read Inputs from Input Modules to Image Register Run Ladder Program, and update Image Register values Communications, Diagnostics, and Housekeeping Run Alarms, Loop, SFP/SFS, and update Image Register values Figure 4.1 PLC Scan Overview 4.2.1 Discrete Image Register The Discrete Image Register holds the status of all Digital Inputs (X) and Outputs (Y). These values are updated during execution of the ladder program and transferred to/from field discrete I/O modules during the normal I/O update period of each PLC scan cycle. As an aid in debug and troubleshooting, it is possible for the user to override a Discrete I/O point and “force” it to the ON or OFF state. When forced, the Discrete I/O point will remain in that state until forced to the opposite state or unforced. The forced state of each Discrete I/O point is maintained in battery-backed memory and is not affected by PLC operational mode changes and/or power cycles as long as the controller battery is good. Control Technology Inc. 2500 Series Training Course 1 Page 25 2500 Se 4.2.2 Word Image Register The Word Image Register holds a 16-bit value of each Analog Input (WX) and Output (WY) channel. These contents are updated during execution of the ladder program and transferred to/from field Analog I/O modules during the normal I/O update period of each PLC scan cycle. It is also possible for the user to override an Analog I/O point and “force” it to a specific value. When forced, the Analog I/O word will remain at the specified value until forced to a different value or unforced. The forced Analog I/O word is maintained in battery-backed memory and is not affected by PLC operational mode changes and/or power cycles as long as the controller battery is good. 4.2.3 Normal I/O Updates The Normal I/O Update is executed at the start of each PLC scan cycle. During this period, the value of each Discrete and Analog Output is copied from its logical address in the image register to its physical hardware location. Then, each Discrete and Analog Input value is transferred from the field module to its appropriate image register address. The connection between the I/O module hardware and image register address is specified by the controller I/O Configuration. 4.2.4 Immediate I/O Updates The Immediate I/O Update feature allows the controller to access an I/O point multiple times in a single RLL scan. This allows a fast-changing Input value to be monitored more often than once per PLC scan cycle and allows the system to respond faster to changes in the process. Immediate I/O Updates are usually used in cyclic or hardware interrupt tasks to ensure the current I/O values are used. I/O points associated with modules located in the local base and/or Profibus-DP stations can be accessed via Immediate I/O instructions. Page 26 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 4.3 Memory Types 2500 Series memory can be broken down to 3 main types: 1. Program Memory L (Ladder) memory S (Special) memory 2. Data Memory V (Variable) memory K (Constant) memory NOTE: U (User) Memory and CS (Compiled Special) Memory types used in SIMATIC 505 controllers are not utilized in CTI 2500 Series CPUs. 3. System Memory RLL Instruction Operation C (Control Relay) memory I/O Image Registers T (Temporary) memory Status Words 4.3.1 Program Memory Ladder Memory Used for RLL program storage. The CPU uses L-Memory to store both source code (RLL instructions) and compiled code used for program execution. Special Memory Holds configuration data for Loops and Analog Alarms as well as Special Function programs and subroutines Control Technology Inc. 2500 Series Training Course 1 Page 27 2500 Se 4.3.2 Data Memory V-Memory Internal memory designed for use by PLC programmer for data storage. It is wordaddressed memory that is read/write accessible as word or bit. For instance, the result of a math operation can be stored in V-Memory. You can enter values directly into VMemory addresses. Examples: V200, V391, V562.4, V2001 K-Memory Internal memory used for holding constant (unchanging) data. It is word-addressed memory that is designated as read-only by PLC program instructions. It is possible to write values into K-Memory addresses via programming software and HMI panels. Examples: K13, K201, K513 4.3.3 System Memory Discrete Image Register Memory area reserved for holding status of Digital Inputs and Outputs. This area is accessed as individual points (or bits) via X/Y-Memory type. Input (X) addresses are designated as read-only by PLC program instructions. Word Image Register Block of memory used for storage of all Word Inputs and Outputs. Data in this memory area can be accessed as integer or bit via WX/WY-Memory type. Word-Input (WX) addresses are designated as read-only by PLC program instructions. Control Relays (C-Memory) Control Relays are single-bit internal coils and do not represent actual field I/O points. Examples: C10, C373, C1002 T-Memory Memory that is available to each Special Function program for temporary storage. It is word addressed memory accessible as word or bit. This memory is 64 words in length, and the contents are not saved when the SF program has completed running. (TISOFT users and WorkShop releases earlier than V4.5 are limited to 16 words.) Examples: T1, T3, T9.14 Status Words Controller memory that holds status information pertaining to the PLC operation These status words are used to indicate error conditions (bits) and controller data (words) such as PLC Scan time and Real-Time Clock. Examples: STW141, STW1.1, STW9.10, STW144 Page 28 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C RLL Instruction Operation Stores information for RLL instructions that operate over multiple PLC scans Timers/Counters Timer (TMR, TMRF) Discrete Control Alarm Timer (DCAT) Motor Control Alarm Timer (MCAT) Up Counter (CTR) Up/Down Counter (UDC) Drums Drum (DRUM) Event Drum (EDRUM) Maskable Event Drum Discrete (MDRMD) Maskable Event Drum Word (MDRMW) Drum Memory is used to store the following data as 16-bit integer values: Drum Step Preset (DSP) – Starting step Drum Step Current (DSC) – Active step (valid when Drum operating) Drum Count Preset (DCP) – “Counts per Step” value stored in 16 consecutive words accessed as DRUM.STEP format (i.e., DCP1.1, DCP1.16). This memory type is valid only for EDRUM instructions. Drum Count Current (DCC) – Current count for active step One-Shots One-Shot contacts ( ↑ ) Time Set (TSET) Date Set (DSET) Shift Registers Bit Shift Register (SHRB) Word Shift Register (SHRW) Table Move Instructions Move Word to Table (MWTT) Move Word from Table (MWFT) IMPORTANT: All instructions listed on this page must contain an address number that is unique within its instruction group. For example, you cannot enter a Timer and Counter with the same address (i.e. TMR1 and CTR1 in the same program is invalid). Control Technology Inc. 2500 Series Training Course 1 Page 29 2500 Se Page 30 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Chapter 5. Configuration and Setup The 2500 Series has always been recognized for ease of configuration and setup. The only requirement for PLC communications and programming is the PC-based programming software (WorkShop) – no additional network configuration software and special PC hardware is needed. T his chapter will provide instruction on how to establish communications, setup port parameters, configure system I/O, and start using WorkShop to help with the process. 5.1 Configuration Overview Large PLC’s are designed with communication, PLC, program, and hardware flexibility. This requires us to configure the system, defining what it is, what it has, and how to use it. The configuration can be broken down into three parts: 1. Communications Path This defines how the programming device is to communicate with the PLC 2. PLC Configuration This defines type of PLC, Memory sizes, and scan time (On-line function) 3. I/O Configuration This defines the 4 basic characteristics of the I/O modules: Module type Module starting address Module size Special Function Module (Yes/No) The term Special Function Module is not related to Special Function Programs and Subroutines. Control Technology Inc. 2500 Series Training Course 1 Page 31 2500 Se 5.2 Communications Path Traditionally, the most common way of establishing communications between the PLC and PC programming software has been through the RS232 serial port. The 2500 Series CPU has a RS232 port on the front panel. However, new communication methods such as USB and Ethernet have now surpassed serial ports as the preferred means of connectivity. This is due to standard cabling and abundance of commercial products that are available. All 2500 Series CPU models contain USB and Ethernet ports on the front panel in support of these standards. NOTE: The USB port on the 2500 Series CPU is essentially a high-speed serial port. Therefore, the PC Setup for USB operation is identical to the Serial Port Setup within WorkShop. However, an additional requirement to use the USB interface is the installation of the Windows USB Driver that is available for free download from the CTI website ( www.controltechnology.com ). 5.2.1 RS232 Port Details The RS232 Serial Port communications requires a grounded null modem cable with pin-outs as shown. The wiring for this port is identical to ‘Port 1’ on the front panel of Siemens 505 controllers. Figure 5.1 RS232 Cable Pinout Page 32 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Other communication settings (such as Baud Rate and RS422 mode) are selected via 12-position dipswitch on CPU circuit board as shown below. These switches are read only on power-up. Figure 5.2 CPU User Switch Settings Control Technology Inc. 2500 Series Training Course 1 Page 33 2500 Se 5.2.2 Communications Setup in WorkShop The Communication Setup defines the communications path to be used when the program applicable to the PLC is selected and displayed in WorkShop. This establishes a link between the PLC contents and the program in the PC. This link provides display of Comments, Tag Names, and Descriptors that are NOT stored in the PLC memory In the WorkShop window, select File. Then click on Communications Setup and its dialog will appear as shown in Figure 5.3. Figure 5.3 Communications Setup Dialog Serial Ports Selects serial communications between the PC and CPU. Serial communications apply to both RS232 and USB ports. The COM Port numbers refer to the ports on the PC. Serial TIWAY Not used with 250 Series CPUs. TIWAY is a legacy communications network from Texas Instruments days. Most old TIWAY networks are being replaced by Ethernet networks. TCP/IP Selects communications via Ethernet. The 2500 Series requires an Ethernet communication module. You will also need the PLC’s TCP/IP address. There may also be some other system setup requirements by the Windows OS. FMS Not used with 2500 Series CPUs - used with Siemens Profibus FMS networks H1 Not used with 2500 Series CPUs - used with Siemens H1 networks Page 34 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 5.2.3 Serial Port Setup When Serial Port is selected, a dialog box appears to set communications parameters. Figure 5.4 Serial Port Setup Dialog The default parameters are shown. These settings work in most installations. Click the OK button to accept. Control Technology Inc. 2500 Series Training Course 1 Page 35 2500 Se 5.2.4 Quick Connect Communications Setup The Quick Connect function is used to establish a connection to a PLC without having the PLC program selected or displayed in WorkShop. Symbols, Tag Names, and Descriptors will NOT be available as there will be no link established between the PLC and the program data on the PC. This is used primarily when the PLC program is not on the PC you are using. Select Fast PLC Setup from the File menu (as shown in Figure 5.3) and the Fast PLC Connection Setup dialog is displayed. Click the Serial Ports button, and the Serial Port Setup dialog appears as shown in the previous section. Figure 5.4 Fast PLC Connection Setup Dialogs Select communications path and click OK. Only the paths you plan to use need to be configured. You have now set both the default programming path and the Quick Connect path. These will be saved with WorkShop, and future changes will require reconfiguring the appropriate path. Page 36 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 5.3 PLC Configuration We will create a new program and configure the PLC from the default settings. 5.3.1 PLC Type Setup In the WorkShop File menu, click New and the PLC Type Setup dialog box appears. Figure 5.5 PLC Type Setup Dialog Select PLC Type and Revision (Model) from the PLC Type Setup dialog. The Address Documentation window displays the path where this program will be saved. The Advanced button allows saving the program to a path other than the default Workshop Programs path. Click OK, and the new program screen is displayed as shown in the following figure. Figure 5.6 New PLC Program Control Technology Inc. 2500 Series Training Course 1 Page 37 2500 Se 5.3.2 PLC Memory Configuration In the WorkShop toolbar, select PLC Utilities / PLC Configuration and the PLC Configuration dialog appears. This dialog box displays the default memory configuration for the selected PLC Type. Figure 5.7 PLC Memory Configuration There are two columns in the Memory Configuration screen, User and System. User System – Displays the amount of each instruction type is currently configured. - Displays the amount of memory required for the specified User instructions. Example: We have 2K of Table memory configured. Each Table instruction requires 2 words of memory storage during execution. Therefore, the system allocates 4K of memory for Table instructions. If you make a change in the memory configuration the Accept button becomes active. You must click the Accept button before closing to save the new memory configuration. Click the Close button. Page 38 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C We want to save our work. Unfortunately we cannot save while the Yellow editing indicator is active. Figure 5.8 WorkShop Editing Screen Right-click on Ladder Network1, select Delete, then select Network, and click on OK. Click YES on displayed warning message. Click on the Control Technology Inc. to accept the deletion. 2500 Series Training Course 1 Page 39 2500 Se We can now save the PLC configuration. Figure 5.9 Saving New PLC Program Click File, select Save As, and name the file Configured.FSS. After you have entered the file name click the Save button. 5.4 I/O Configuration The program Configured.FSS should still be open. If not, open it by clicking File/Open from the WorkShop main menu. . Select PLC Utilities, then select PLC Configuration The I/O Configuration dialog appears. Figure 5.10 I/O Configuration Dialog Page 40 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C There are three columns listed in the I/O Configuration dialog. These include: Base, Enabled, and Configured. There are 16 total bases numbered from 0 to 15. Bases 1-15 are the remote bases. We will only be working with Base 0 (or the ‘local base’) during this training class. Move the cursor to Base 0 and click to highlight it. Then select Edit Base, and the Edit I/O Base dialog box appears as shown below. Figure 5.11 Edit I/O Base Dialog We are now ready to begin the process of configuring the I/O slots. Control Technology Inc. 2500 Series Training Course 1 Page 41 2500 Se 5.4.1 Configuring 32-Pt Digital Input Module In our training system, Slot 1 has a 32-Point Digital Input module. From the Edit I/O Base dialog, highlight Slot 1 and click Edit Slot. The Edit I/O Slot dialog box appears: Figure 5.12 Edit I/O Slot Dialog Enter the following to configure the module: I/O Address: Designates Starting I/O Address (Enter 1) Num of X Bits: Specifies number of Digital Input points for this slot (Enter 32) All other entries can be left at their default values. Click OK to close dialog box. The module is now configured to use Digital I/O addresses X1 to X32. Remember Digital Inputs use the X memory type designator. NOTE: The system assumes all modules support 8, 16, or 32 channels. Therefore all module starting addresses must be a multiple of 8 plus 1. Example: Slot 1 is (X0) +1=1. The next Digital I/O address available is 33 (used 1 –32). (Number of Input Channels=32)+1=33. Digital Inputs and Outputs share the same register memory. DO NOT duplicate address numbers. Example: We have used Digital I/O addresses 1-32. Do not assign a starting address of 1, 9, 17, or 25 to another digital module whether Input or Output. A module may have any starting address within the above constraints. Modules need not be sequentially addressed. Page 42 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 5.4.2 Configuring 32-Pt Digital Output Module Slot 2 in the Training System contains a 32-Point Digital Output module. From the Edit I/O Base dialog, highlight Slot 2 and click Edit Slot. The Edit I/O Slot dialog box appears: Figure 5.13 Edit I/O Slot Dialog Because we used Digital I/O points 1-32 for the Digital Output Module in Slot 1, this module can use the next group of Digital I/O points 33-64. Enter the following to configure the module: I/O Address: Designates Starting I/O Address (Enter 33) Num of Y Bits: Specifies number of Digital Output points for this slot (Enter 32) All other entries can be left at their default values. Click OK to close dialog box. Control Technology Inc. 2500 Series Training Course 1 Page 43 2500 Se Page 44 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Chapter 6. Discrete RLL Programming The 2500 Series has a unique discrete function which is the Drum Control Block. This single instruction provides functionality that generally requires multiple networks to duplicate in other systems. T his chapter covers the main aspects of Discrete RLL programming. We will use all the common program elements. We will create a program Off Line, load them into the PLC, run them, and monitor their operation. We will then modify the programs using On-Line Editing. The modified programs will then be saved to the programming device. 6.1 Introduction Applications are developed for the 2500 Series using 505 WorkShop and other legacy development tools such as TISOFT. WorkShop is a Windows-based development tool with builtin functionality such as FT-Trend for data analysis and an optional 2500 Series Simulator for process simulation. To obtain more information on WorkShop and related products, visit FasTrak online at their website www.fast-soft.com . Control Technology Inc. 2500 Series Training Course 1 Page 45 2500 Se 6.2 Opening a Program To open a program from the WorkShop startup screen, click File in the main toolbar and then click Open. Select Browse to locate the previously save program Configured.FSS, select it, verify Off Line, and click the OK button to open the program. Figure 6.1 WorkShop Startup Screen Page 46 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 6.2.1 Ladder Editor The program opens to the Ladder Editor screen as shown below: Figure 6.2 Ladder Editor Screen In this step we want to enable the Toolbars that are available for our editing session. In the top menu, click View. Click Toolbars; go to Ladder Toolbars; and enable Ladder Popup Menu and Common Elements. Figure 6.3 Ladder Toolbars Control Technology Inc. 2500 Series Training Course 1 Page 47 2500 Se 6.2.2 Toolbar Icons Descriptions for WorkShop icons are shown below: Main Toolbar Icons Fast PLC Connect Create a New File Open Program Save Current Programs Print Logic Programs Cut Copy Paste Find Find Next Display Ladder Special Functions PID Loops Alarms Data Window FTLogger FTTrend Cross Reference Documentation 505 Simulator New Network Append Row Enter Logic Run\Program (toggle) Selection Cursor Help Ladder Editor Toolbar Icons Relay Instructions Timers, Counters and Drums Compare Instructions Bit Operations Math and Logic Instructions Move Instructions Control Instructions Special Instructions Common Elements Toolbar Icons Selection Cursor Short Branch Down Branch Up Open Contact Closed Contact Coil Page 48 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 6.3 Insert a RLL Network Right-click on the rung with Program End. Select Insert then press OK from the popup box. Figure 6.4 Insert RLL Network A Yellow bar is displayed to indicate the location where instructions can be added. Figure 6.5 RLL Edit Screen Control Technology Inc. 2500 Series Training Course 1 Page 49 2500 Se 6.4 Discrete Contacts and Coils This section describes the steps for using relay logic instructions. All instructions used in this example are located in the Relays toolbar 6.4.1 Normally Open Contact Add a Normally Open contact to the program by selecting Relays and then click the Open Contact icon . Now place the relay in the first block of the Yellow bar against the left rail. Left click on C1 and change it to X1. Page 50 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 6.4.2 Output Coil Add an Output to the rung by selecting Relays and then the Coil icon . Add the Output by placing it in the Yellow bar near the end of the rung. Change the address of the Coil from C1 to Y33. Click the Check Mark in the Main Toolbar to accept changes. You can also use F8 to enter logic. The first RLL network is now completed. Control Technology Inc. 2500 Series Training Course 1 Page 51 2500 Se 6.4.3 Normally Closed Contact To add another new rung to the program, right-click the rung with Program End and select Insert and then Network as shown in the previous section. The next rung uses a Normally Closed contact as the first instruction. Insert this rung using Closed Contact addressed as X1 and Coil addressed asY34. 6.4.4 Series (AND) Contacts Add another rung with two Normally Open contacts in series. Address the Open Contacts as X2 and X3, and set the Output Coil address to Y35. Page 52 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 6.4.5 Parallel (OR) Contacts Add a fourth rung with two Normally Open contacts in parallel. To do this, place the first Open Contact against the left rail and assign it to address X4. Add the second Open Contact directly below it and set the address to X5. Now select a Vertical Branch from the Relays toolbar and place it next to the X4 contact. This will connect X4 and X5 contacts. Now add an Output Coil and assign it Y36. Control Technology Inc. 2500 Series Training Course 1 Page 53 2500 Se 6.4.6 Not Coil Output The fifth rung includes a Vertical Branch on both Inputs and Outputs. These are added the same as done in the previous example. Create the network shown below using X6, X7 and X8 for the Inputs. Note that a new Output instruction, the Not Coil Outputs. Address the standard Coil asY37 and the Not Coil as Y38. , is used for one of the 6.4.7 Logical NOT Contact Create another rung as shown below using an Open Contact addressed as X1, a Logical NOT Contact Page 54 and a Coil C1. 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 6.4.8 Set Coil Output Add a new rung using an Open Contact with address X1 and a Set Coil with address C2. 6.4.9 Reset Coil Output Add another rung using an Open Contact with address X2 and a Reset Coil address C2. Control Technology Inc. 2500 Series Training Course 1 with Page 55 2500 Se 6.4.10 One Shot Contact The last rung includes an Open Contact with address X3 in series with a One Shot , and both are in parallel with an Open Contact with address C3. Then another Open Contact X4 is in series with all of that to control the Output Coil with address C3. After this last rung is completed, ensure all changes have been entered into the program by clicking the Enter Logic check mark icon. 6.5 Saving a Program Then save the file by selecting File; then Save As and save the program with the name CONTACTS.FSS. Close the Ladder Editor by clicking on the Close icon window. in the edit Congratulations, you have now configured a PLC system, written a program, and saved it Off Line. Now you will load it into a PLC, run it, and monitor the results. Page 56 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 6.6 Program Download From the main screen in WorkShop, select File; then click Open. Make sure you have a connection between the PC (RS232, USB, or TCP/IP) and CPU. Figure 6.6 Program Download Menus In the Open Program dialog box, shown in Figure 6.6, you will need to make several selections. First, select Connect to PLC and make sure that the connection listed (COM1 in our example) matches your connection method. If not, then press Select to choose the proper connection. Next, select Transfer Logic to PLC and click the Browse button to locate the PLC program. In the Open dialog box, select the program CONTACTS.FSS and click Open. Click OK to accept the selection. If the proper PLC connection is chosen, the selected program will now transfer to the PLC and will be displayed in On-Line mode. 6.7 Transfer PLC to RUN Mode To switch the PLC to RUN mode, click the RUN button Then click Yes. in the WorkShop main toolbar. When the PLC enters RUN mode, the button display toggles to PROGRAM Control Technology Inc. 2500 Series Training Course 1 . Page 57 2500 Se 6.8 Monitor Program Status Look at the 32-point Output card and you will notice that channels 2 and 6 are ON. This is normal. For this example we will be using the Input switches 1 thru 8 (X1–X8) and monitoring Outputs 1 thru 6 (Y33–Y38). Monitor the Ladder Status by selecting Diagnostics then Ladder Status from the main toolbar. Look at the first rung of the Ladder program. Here we have an Open contact X1 (the first switch on the Input simulator) and an Output Y33 (channel 1 on the 32-point Output module). Turn ON the first switch on the Input simulator. X1 and Y33 are highlighted in RED indicating power flow. Notice that channel 1 on the 32-point Output card turns ON. Turn OFF X1. NOTE: The ACTIVE indicators are highlighted in this manual with a gray box to show power flow on a black and white print. Normally there are no gray boxes on the screen. Page 58 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C The second rung of ladder contains a Normally Closed contact X1 and an Output Y33. In this rung when X1 is OFF the Output is ON. Notice that channel 2 of the Output card is ON. Turn X1 ON. Notice that channel 2 of the Output card is OFF. Turn X1 OFF. The third rung has two Open contacts X2 and X3 in series controlling Output Y35. In order for the Output to be on, both X2 AND X3 have to be ON. Turn ON X2 AND X3 and notice that channel 3 comes ON. Turn OFF X2 and X3. Control Technology Inc. 2500 Series Training Course 1 Page 59 2500 Se In the fourth rung are two Open contacts X4 and X5 in parallel controlling Output Y36. In order for the Output to turn ON, either X4 OR X5 have to be ON. Turn ON X4 and notice that channel 4 of the Output module comes ON. Turn X4 OFF. Repeat operation for Rung 4 by turning ON X5 and notice that channel 4 turns ON. Turn X5 OFF. Page 60 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C The fifth rung has 3 open contacts: X8 in series with parallel contacts X6 and X7, and two Outputs: standard Coil Output Y37 and a Not Coil Output Y38. By turning ON X8 AND turning ON either X6 OR X7 the Outputs turn ON. Turn ON X6 AND X8, and notice that the Output module channel 6 turns OFF and channel 5 turns ON. Turn OFF X6 and X8. Turn ON X7 AND X8 and notice that channel 6 turns OFF and channel 5 turns ON. Turn OFF X7 and X8. Control Technology Inc. 2500 Series Training Course 1 Page 61 2500 Se Rung 6 demonstrates the Logical Not Contact. The NOT instruction inverts the power flow to the state opposite its current state. Notice that C1 is ON even though X1 is not turned ON. Turn ON X1 and notice that C1 turns OFF. Turn OFF X1. Rung 7 contains a Set Coil Output. When X1 is set ON, C2 turns ON and remains ON until C2 is turned OFF by a Reset Coil instruction. Turn X1 ON then OFF and notice that C2 remains ON. Page 62 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Rung 8 contains a Reset Coil Output with same address C2 as the Set Coil Output in Rung 7. Since C2 is ON (via Set Coil Output in the previous rung), the Reset Coil Output is highlighted to show the current state of the Output. For example, if C2 is ON (or SET), both Set Coil and Reset Coil Outputs are highlighted. If C2 is OFF (or RESET), both Set Coil and Reset Coil turn OFF. Turn X2 ON then OFF and notice that C2 turns OFF. Rung 9 demonstrates the operation of a One Shot contact. The One Shot instruction passes power flow for a single scan. When the Input changes from OFF to ON, the Output turns ON for exactly one scan. After the One Shot is executed, its Input must be OFF for at least one scan before the instruction can be executed again. When the Input is OFF, the instruction is not executed and there is no power flow to the Output. X4 must be ON before turning X3 ON and because power flows to the Output for only one scan when X3 turns ON. The C3 contact in parallel acts as a “seal-in” to keep the Output ON once it is turned ON by X3 transition from OFF to ON. Turning X4 OFF always turns the Output OFF. Try the following switch settings: Turn X3 ON then X4 ON. The Output remains OFF. Turn OFF X3 and X4. Turn X4 ON then X3 ON. The Output turns ON. Turn X3 OFF. The Output remains ON because it is latched by C3. Turn X4 OFF. The Output will turn OFF. Control Technology Inc. 2500 Series Training Course 1 Page 63 2500 Se 6.9 On-Line Edit The 2500 Series controllers support On Line changes to the program while the CPU is in RUN mode. This is demonstrated in this section. Go to Network 8, simply click on the line, and type address X2. Typing an address inserts a default Open Contact. The network is now highlighted indicating an Edit in is progress. Click the Enter Logic check mark to accept the logic changes. You must confirm the transition to Run-Time Edit Mode by selecting the Yes button in the pop-up window. Clicking the No button will discard your changes. When the logic changes are confirmed, the CPU enters Run-Time Edit Mode. The modified program is stored but not executed until the PLC is transferred to RUN mode. Until then, the original program is still running. It is possible to make additional changes while the CPU is in Run-Time Edit Mode. All edit functions and buttons are active. SAFETY NOTICE: The Run-Time Edit feature should be used only when absolutely necessary. The transfer to RUN mode causes the CPU to compile and start execution of the modified program. The compile process can be lengthy depending on the RLL memory used. In fact, the compile time for very large programs (> 75K of RLL memory) can exceed 500msec.This can cause Remote Base Controllers to timeout and possibly “bump” Outputs that could result in damage to process, machinery, and personnel. Exit the On Line connection by selecting the Close icon is no reason to Save the program changes. Page 64 2500 Series Training Course 1 on the Ladder Editor screen. There Control Technology Inc. 2500 Series Advanced C 6.10 Timer and Compare Instructions This section demonstrates operation of the Timer and Compare instructions. 6.10.1 Motor Control or ON/OFF Station Example M1 Conv1 Conv2 M2 SS1 SS2 Figure 6.7 Motor Control Example We have two conveyors. The logic for Conveyor1 is: 1. Conv2 must be running (SS2 closed). 2. Conv1 Overload is not tripped. Signals Conv1Stop Conv1Start Conv1OVLD Conv1SS Conv2SS Conv1Run Address X1 X2 X3 X4 X5 Y33 Field Device Normally Open Switch Normally Open Switch Normally Closed Overload Contact Normally Open Switch Normally Open Switch Open CONFIGURED.FSS program Off Line. Add RLL network as shown below. Save As – CONVEYORS.FSS Control Technology Inc. 2500 Series Training Course 1 Page 65 2500 Se 6.10.2 Creating Tag Names and Descriptors Tag Names are interchangeable with the addresses, i.e. If X52 has been assigned Tag START you may type either X52 or START when writing ladder instructions. Descriptors are tied to the address but are not interchangeable. Descriptors are used to hold the synonyms imported from a converted TISOFT program. If your program is converted from TISOFT, you should continue to use only Descriptors since using both Tags and Descriptors takes up a lot of space on the screen. A new program written in WorkShop should use only Tag Names. Figure 6.8 Documentation Editor Icon There are two ways to access the Documentation Editor for creating Tags and Descriptors: The first is directly from the main toolbar. Click the Documentation button (see pointer in Figure 6.8) or click View in the main toolbar and then select Documentation. Fill in the information and click OK. Documentation data can also be imported into WorkShop. Figure 6.9 Documentation Editor Page 66 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C The second way to access the Documentation Editor is to right-click on an address in the ladder (or CTRL+L) and then selects Modify Address Doc. Figure 6.10 Documentation Editor Access from RLL Control Technology Inc. 2500 Series Training Course 1 Page 67 2500 Se Addresses, Tag Names, and Descriptors can be switched ON/OFF by selecting Options; then Program Setup from the main toolbar. Figure 6.10 Program Setup Dialog Select Show Addresses and Show Tags. Using the names for our example in Figure 6.7, enter Tag Names for X1, X2, X3, and X5. The Ladder Editor will now display both Tags and Addresses. Save the program as CONVEYORS.FSS. Close the Ladder Editor screen by clicking the Close icon Page 68 2500 Series Training Course 1 . Control Technology Inc. 2500 Series Advanced C 6.10.3 Integer Number Format Timers and Counters hold their Preset Values (TCP) and Current Values (TCC) as signed integers. This section describes the representation of signed integer values used by the Timers and Counters. Integers are whole numbers with no fractions and no decimal values. Signed integers are stored as 16-bit words in the two’s complement format as shown. The 16-bit format allows you to store values ranging from –32,768 to +32,767 (decimal integer values). When bit 1 (the sign bit) is 0, the number is positive; when bit 1 is 1, the number is negative. Most Significant bit Sign bit Bit # Least significant bit 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 0 0 0 1 1 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0 1 1 0 1 0 +32767 +1 00000 -1 -32768 Figure 6.11 Integer Number Format Control Technology Inc. 2500 Series Training Course 1 Page 69 2500 Se 6.10.4 Timer Operation The Timer instruction creates a time period. This is an “On Delay” Timer, meaning the Output turns ON when the timer value reaches zero. There are two Timers - a fast Timer (TMRF) and a standard Timer (TMR). A fast Timer counts in 1msec. increments, while the standard Timer counts in 0.1 sec. increments. Figure 6.12 Timer Instruction WARNING: Timer and Counter instructions use the same memory. DO NOT duplicate instruction numbers between Timers and Counters. The Timer times down from the Preset value (00000 to 32767) to 00000. TCPn – holds the Preset time (as integer value) TCCn – holds the remaining Current time (as integer value) Enable ON - Timer enabled Enable OFF – Timer disabled and sets TCC = TCP Run Input ON and Enable ON - Timer runs. It starts at TCP and times down to zero. Run Input OFF and Enable ON - the Timer stops; TCC remains at the Current If Run Input turns ON again, the Timer starts timing again from that point. Output value (retentive). - turns on when remaining time (TCC) is zero. TCP and TCC addresses are selectable as Read/Write (Unprotected) or Read-only (Protected). The Current value is retained on power loss if the Enable is ON. Page 70 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 6.10.5 Creating Timers This section describes how to build and operate On-Delay, Off-Delay, and Pulse Timers having Retentive and Non-Retentive values. Open the program CONFIGURED.FSS. Add the following logic: Figure 6.13 Timer Examples Save as - TIMERS.FSS. Control Technology Inc. 2500 Series Training Course 1 Page 71 2500 Se Download the program to the PLC by selecting File; then select Transfer-On Line; Connect to PLC; and Transfer Logic to PLC. Run and monitor the program. Turn the Inputs ON and OFF watching how the Timers run. Use On Line Edit to change the Enable Inputs to the addresses shown in network headers Run and monitor the program. Turn the signals ON and OFF watching how the Timers operate. Leave the program running. We will use it for the Compare example. 6.10.6 Compare Operation The 2500 Series PLC includes the following Compare instructions: Equal To (EQU) Not Equal To (NEQ) Less Than (LESS) Less Than or Equal To (LEQ) Greater Than (GTR) Great Than or Equal To (GEQ) Compare (CMP) Indexed Matrix Compare (IMC) Scan Matrix Compare (SMC) We will use the Greater Than instruction for an example. Page 72 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Click the New Network button. Then click anywhere in Network 2. The New Network is inserted above the rung you selected. Figure 6.14 Creating New Network Add the logic shown below to the new network: Figure 6.15 Compare Instruction Run the program and watch the operation of the Compare (GTR) instruction. As long as TCC1 is greater than 50 (100 down to 51) and X1 is active, the Output is ON. You have created a 5 sec Pulse Timer. Save the program and close the Ladder Editor screen. Control Technology Inc. 2500 Series Training Course 1 Page 73 2500 Se 6.10.7 Timer and Pulse Timer Application We are now going to add a starting alarm horn to our CONVEYOR program. This horn will blow for 5 seconds before the conveyor is allowed to start. Open the program CONVEYOR.FSS and add the following logic: Figure 6.16 Starting Alarm Horn Logic Save the program. Download the program to the PLC and transfer to Run mode. Monitor and operate the conveyor system. Y34 should be ON for 5 sec. Then Y34 turns OFF and Y33 turns ON running the conveyor. Any of the CONV1STOP, CONV1OVLD, or CONV2SS switches can shut down the system. NOTE: The One-Shot instruction was added to the start circuit to simulate a momentary contact switch. Page 74 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C We will add another interlock to detect a broken belt while Conveyor1 is running. Unfortunately this will prevent ever starting the conveyor, so we need to add a timed bypass contact around it. The Bypass Timer should allow 5 seconds for Alarm Horn plus 3 seconds of Acceleration time (8 seconds total). Add CONV1SS (X4) and Bypass Timer contact (C11) into the control circuit as shown in the following figure. Then add the Bypass Timer shown in Network 4. Figure 6.17 Conveyor Interlocks Control Technology Inc. 2500 Series Training Course 1 Page 75 2500 Se 6.11 Counter Instructions There are two types of Counters in the instruction set, Up Counter and Up/Down Counter.. WARNING: Timer and Counter instructions use the same memory. DO NOT duplicate instruction numbers between Timers and Counters. 6.11.1 Up Counter The Up Counter counts incoming pulses and increments its count by one for each pulse. The Output turns ON when the Current Count (TCC) equals the Preset value (0-32767). Figure 6.18 Up Counter Enable ON – the Counter Current value increments on the positive edge of the Signal Input Enable OFF – the Counter is reset to zero and Counter is disabled Output ON – when Current (TCC) value equals Count Preset TCP) TCPn – holds the Counter Preset value TCCn – holds the Counter Current value The Counter Current value is retained on power loss if the Enable is ON. TCP and TCC addresses are selectable as Read/Write (Unprotected) or Read-only (Protected). Page 76 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 6.11.2 Up/Down Counter The Up/Down Counter maintains a count value based on pulses from two incoming signals. It counts up or down on the positive transition (edge trigger) of the Input signals. The Output turns ON when the Current (TCC) value equals zero or the Preset value (0-32767). Figure 6.19 Up/Down Counter Enable ON – TCC increments on positive edge of Up Signal and decrements on the edge of Down Signal. The Counter does not count above the TCP or below zero. Enable OFF – Z (zero positive TCC is reset to zero and Counter is disabled bit) - turns ON when TCC equals zero and Enable ON Output – turns “ON” when TCC equals zero or TCP. TCPn – holds the Counter Preset value TCCn – holds the Counter Current value The Current Count is retained on power loss if the Enable is ON. TCP and TCC addresses are selectable as Read/Write (Unprotected) or Read-only (Protected). Control Technology Inc. 2500 Series Training Course 1 Page 77 2500 Se We will write a new program to show the operation of Counters. We will start from the beginning to practice configuration. From the Workshop main toolbar click File; then New; and select your PLC Type and Revision. Now select PLC Utilities and PLC Configuration and verify the Memory Configuration is correct. Next, click 505 I/O and select Base 0. Click Edit Base and go through the process of configuring I/O for each module in your system (as shown in Section 5.4). Then press the Accept button and close the configuration screens Create the program as shown in the following figure. Figure 6.20 Logic Showing Operation of Counters Save the program by selecting File, then Save As - COUNTERS.FSS. Now Download the program down to the PLC (as shown in Section 6.4). Select File, then Transfer → Online. Select Connect to PLC and Transfer Logic to PLC. Click OK. When the download is complete, put the PLC in Run mode using the Workshop toolbar Run icon. Then select Diagnostics and Ladder Status to monitor the PLC program operation. Note the following operation for both Counters: Signal pulses are detected only on OFF to ON transition. If the Enable Input is OFF, the Counter is disabled and TCC is set equal to TCP. Page 78 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C The Up/Down Counter has two Outputs. The instruction box Output (Y34) turns ON when Current Count (TCC) equals zero or Preset (TCP). The Z bit address specified inside the instruction box turns ON only when TCC equals zero. If you would like Y34 active only when TCC = TCP, edit Network 2 to insert Normally Closed contact C10 as shown in the following figure: Figure 6.21 Logic for UDC Instruction Output 6.11.3 Counter Application There is a 10-car parking garage. We want the FULL indicator (Y33) to come ON when the garage is full. Incoming cars generate X3 (Up Count) and outgoing cars generate X4 (Down Count). Input X5 will be the Counter Enable signal. 10 Car Parking Garage Pay Booth X4 Ticket Gate X3 Figure 6.22 UDC Application Example If you delete Network 1 from the COUNTERS.FSS program, the remaining logic performs our application to count cars in and out and turn ON the FULL light when the garage is full. Control Technology Inc. 2500 Series Training Course 1 Page 79 2500 Se 6.12 Move Word and Date Compare Instructions Unfortunately, due to irregularities in the hardware that generates the input signals, we can never guarantee that our count is always correct. Therefore, we need a way to manually enter a count value into the Counter. We provide thumbwheel switches and a key-locked Load button. Pressing the button (X1) will transfer the thumbwheel value to memory location V100. We will simulate the thumbwheel switches by entering the number into V100 and use the Move Word instruction to move the contents of V100 into TCC2. 6.12.1 Move Word Description The Move Word instruction copies up to 256 contiguous words from one memory location to another. The starting memory location for the words to be moved is specified by parameter A, and the starting memory location for their destination is specified by parameter B. All words are copied in a single scan. Enable Status Figure 6.23 Move Word Instruction Enable ON – Moves a constant or block of contiguous addresses (block size specified by N) starting at address A to a block of contiguous addresses starting at address B. Output Status turns ON at completion of every successful operation. Enable OFF – Instruction is disabled and Output Status turns OFF. A – Starting Address for data to be moved (or copied) or integer constant. If a constant is entered, that value is copied into each Destination address. B – Starting Address for destination when data is copied N – Number of words to copy (1-256) Page 80 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 6.12.2 Move Word Application Enter new Network 2 as shown below: Figure 6.24 MOVW Example Use the Data Window to monitor or enter values in any address in the PLC. It is particularly useful when working with analog values. Figure 6.25 Data Window Icon in Main Toolbar Activate the Data Window by clicking on the Data Window icon as shown by the arrow in Figure 6.25. Figure 6.26 Data Window Enter the address (V100) and value (6). Notice that WorkShop assigns a Data Type of Unsigned Decimal (Integer). It can be changed when needed - right click in Value cell, select Format, and select Data Type desired. The value is placed in V100 as soon as you enter it in the cell. This is NOT a force. The system can change the value entered based the program logic. Run the program and monitor results. Control Technology Inc. 2500 Series Training Course 1 Page 81 2500 Se Enter different values into V100. Use X1 to move V100 into TCC2. 6.12.3 Date Compare Description The Date Compare instruction compares the current date in the PLC internal clock registers to the date values in a memory mask. Enable Status Figure 6.27 Date Compare Instruction Enable ON – Compare the current date in the PLC internal clock registers to the Date mask. When the values match, the Output Status turns ON. Enable OFF – Instruction is disabled and Output Status turns OFF. DATE – Starting Address of Date Mask (uses 4 consecutive V-memory words) Word 1: Year (BCD values 0000-0099) Word 2: Month (BCD values 0001-0012) Word 3: Day of Month (BCD values 0001-0031) Word 4: Day of Week (BCD values 0001-0007) Mask is a term for fixed data used as a reference for comparison against other changing data. Date values can be entered and/or viewed in Data Window using the Hexadecimal data format. Fields in the Date mask can be ignored by compare operation by entering a value of 00FF Hex into the appropriate word. This value causes the Date Compare instruction to automatically match” that parameter. Page 82 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 6.12.4 Data Representation The following chart shows equivalent values for Hexadecimal, Binary, Decimal, and BCD values: Hex 0 1 2 3 4 5 6 7 8 9 A B C D E F Bin. 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 Dec. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 BCD 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 Hexadecimal format: Hex 7 F B 3 Binary 0 1 1 1 1 1 1 1 1 0 1 1 0 0 1 1 Bit No. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Binary Coded Decimal format: BCD 7 9 5 3 Binary 0 1 1 1 1 0 0 1 0 1 0 1 0 0 1 1 Bit No. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Figure 6.28 Data Representation Control Technology Inc. 2500 Series Training Course 1 Page 83 2500 Se 6.12.5 Date Compare Application We want a totalizer to count the number of cars that paid to use the garage over the year. At year end we will use this for accounting purposes. An Up Counter on the pay booth (X3) will provide this. Since we would like to be able to read and reset the totalizer at the beginning of each year, we will use the Date Compare instruction to detect the “start of a new year”, store the total count from the previous year, and reset the totalizer count to zero We must determine how to specify the event that triggers the Date Compare instruction to run. Because we are interested in an entire year of data, the first of January will work for us. The Date Mask will be located in V102, V103, V104, and V105. V102 = 00FF Don’t care about Year V103 = 0001 Compare to Month 1 (January) V104 = 00FF Don’t care about Day of Month V105 = 00FF Don’t care about Day of Week. V106 Storage of year’s totalizer value The Date Compare instruction internally uses a One-Shot contact so that it only executes once when the Input transitions from OFF to ON. WARNING: You must not duplicate the address used for the Date Compare instruction with any other OneShot or Time Compare instructions. Enter values via the Data Window. Remember to format the values as Hexadecimal. Figure 6.29 Date Compare ‘Date Mask’ values Page 84 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Modify the program as shown below. Figure 6.30 DCMP Application Example Place the PLC in Run mode. From the WorkShop main window, set the PLC Real-time Clock. Select PLC Utilities; PLC Configuration; PLC Date/Time; and then click Set. Set the Date to 12/31 and Time to 23:59:00. You now have 1 minute to return to the Ladder Editor and monitor the program. At midnight, the Totalizer count TCC1 will be moved to V106 and then it will reset to 0. Control Technology Inc. 2500 Series Training Course 1 Page 85 2500 Se 6.13 Event Drum and Load Data Constant Instructions This section describes the operation of the Event Drum and Load Data Constant instructions. 6.13.1 Load Data Constant Description The Load Data Constant instruction puts a positive integer specified as parameter N into the address specified at parameter A. Figure 6.31 Load Data Constant Instruction Enable ON – Moves a positive integer (N) into memory address (A). Output Status turns ON at completion of every successful operation. Enable OFF – Instruction is disabled and Output Status turns OFF. A – Destination Address receiving integer constant; can be any writeable address N – Positive integer (0-32767) Page 86 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 6.13.2 Event Drum Description There are two types of Drum instructions: DRUM and EDRUM. They replace other functions known as Sequencer, Drum Switch, Time Drum, and other names. These instructions are used for batch and repetitive processes. The DRUM instruction is time-driven and the EDRUM is both time and event driven. We will use the EDRUM as it covers everything in the DRUM as well. We will develop two examples: a Filter System and a Batch Paint Mixer. The Time/Event Drum instruction (or EDRUM) moves through the programmed steps under control of Time, Events, or both. The JOG Input forces the move to the next step on positive edge trigger. The Drum-Controlled Coils are set to the values in the Drum Mask for the active Drum Step. Start N Jog Drum-Controlled Coils STEP EVENT COUNTS Drum MASK Status USEN ABLE Enable Figure 6.32 Event Drum Instruction Control Technology Inc. 2500 Series Training Course 1 Page 87 2500 Se INPUTS FORMAT DESCRIPTION START Binary ON = Drum advances based on Timer/Event OFF = Drum holds state. Event ignored. JOG Binary Moves Drum to next step on positive edge trigger. ENABLE Binary ON = Drum enabled OFF = Drum reset. Moves to Preset Step INTERNAL FORMAT DESCRIPTION Instruction # Number Must be unique for each DRUM instruction (includes DRUM, EDRUM, MDRMD, and MDRMW instructions) PRESET Number 1-16 Specifies step the Drum goes to when Enable is OFF (Reset). SECS/CNT Positive integer 0-32767 COUNTS Positive integer 0-32767 EVENT X, Y or C contact Time base for Drum operation (0 – 32767) Corresponds to .001 to 32.767 seconds. Time-base multiplier for each step. Time interval for each step calculated as: COUNTS * SECS/CNT Counts down to zero before advancing. Controls the Step Timer. ON = Step Timer counts down OFF = Step Timer stops and retains current value. CONTROLLED COILS Y or C coils Memory addresses controlled by EDRUM MASK 0 or 1 (OFF, ON) Specifies Coil states for each Drum Step OUTPUTS FORMAT DESCRIPTION STATUS Y or C coils ON at the completion of the last programmed step until Drum instruction is reset. IMPORTANT NOTES: The Drum-Controlled Coils ALWAYS follow the states set in the Coil Mask for the Current Step even if the Drum is disabled (Enabled = OFF). Your Drum must include a Step (usually the Preset Step) that puts all Drum-Controlled Coils in safe states that will not affect the process when the Drum is disabled. Page 88 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Drum Variables: ADDRESS NAME DESCRIPTION DSPn Drum Step Preset DSCn Drum Step Current Holds the Step number the Drum is set to when Enable OFF (reset) Holds the active Step number. DCPn.s Drum Count Preset Holds the programmed Count value for each Step. Step numbers = 1 to 16 DCCn Drum Count Current Holds the Current Count value for active Step n = Drum number; s = Step number Time Interval Calculation using Counts/Step (CNT) Time duration of a step is determined by Counts/Step (CNT) value. Time Interval = SEC/CNT * CNT/STP where: SEC/CNT is the time base for the Drum CNT/STP is the time-base multiplier for the step Example 1: SEC/CNT is set to 100 msec (0.100 sec) and CNT/STP = 25 Time Interval = 0.100 * 25 = 2.5 seconds Example 2: SEC/CNT is set to 0 and CNT/STP = 10 When SEC/CNT = 0, time-base = 1 PLC scan-time Time Interval = 10 scans Control Technology Inc. 2500 Series Training Course 1 Page 89 2500 Se We will build a simple EDRUM program to control two filters. Below is a block diagram of the application: F1 Online F2 Backwash F1 Online F2 Standby 5 sec 10 sec Y33 Y35 F1Backwash F2 Online F1 Standby F2 Online 5 sec 10 sec Y36 Filter 1 Y34 Y40 Y37 Black – Filtered flow Red – Backwash flow Filter 2 Y39 Y38 Figure 6.33 Filters Application Diagram Page 90 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Refer to Section 6.2, Open program CONFIGURED.FSS and add the following logic program to create the Filters application: Figure 6.33 Filters Application Logic Save As – FILTERS.FSS Using the steps in Section 6.4 - Download, Run, and Monitor the program Note the ‘ALWAYS ON’ contact (C10) created in Network 1. This contact is used as the Run input to the DRUM so that it runs continuously. Note that C11 is used as Enable Input and Status Output so that the DRUM resets immediately when it completes a cycle. Toggle the Jog Input (X1) ON/OFF and note the DRUM operation. Control Technology Inc. 2500 Series Training Course 1 Page 91 2500 Se 6.13.3 EDRUM and LDC Application Below is a block diagram for a Batch Paint Mixing process: Red Y34 Base Y33 Blue Y35 Solvent Y36 LSH X1 Mixer Y39 LSL X2 Packing Y37 Drain Y38 Figure 6.34 Batch Paint Mixer Application Diagram Additional signals: X3 – Start Batch X4 – Color: Red = 0, Blue = 1 X5 – Jog C10 – Batch Run C11 – Batch Done C13 and C14 - dummy coils Page 92 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Refer to Section 6.2, Open program CONFIGURED.FSS and add the following logic program to create the Batch Paint Mixer application: Control Technology Inc. 2500 Series Training Course 1 Page 93 2500 Se Figure 6.35 Batch Paint Mixer Application Logic Save As – PAINT.FSS Refer to Section 6.4 - Download, Run, and Monitor the program. Page 94 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Run the process steps listed below for both Red and Blue paint colors: 1) Batch not running – Drain (Y38) ON 2) Toggle Start Batch (X3) ON/OFF 3) Load Base to LSH1 (X1), then Mixer (Y39) ON 4) If Red (X4 = 0), add Red tint (Y34) for 5 sec., Mixer (Y39) ON and skip Blue 5) If Blue (X4=1), skip Red, add Blue tint (Y35) for 3 sec, Mixer (Y39) ON 6) Mixer (Y39) for 10 sec 7) Send to Packing (Y37) until LSL (X2), Mixer (Y39) ON 8) Load Solvent (Y36) to LSH (X1) plus 7 sec, Mixer (Y39) ON 9) Send Solvent to Drain (Y38) to LSL (X2) plus 5 sec, Mixer (Y39) ON 10) Return to Step 1 and stop Note that Event C10 in DRUM Step 1 is used to hold the DRUM in the Reset Step until a new batch is started. Similar logic is required for all Drums that run intermittently. Control Technology Inc. 2500 Series Training Course 1 Page 95 2500 Se 6.14 Shift Registers This section describes the operation of the Bit Shift Register and Word Shift Register instructions. 6.14.1 Bit Shift Register Description The Bit Shift Register instruction can be used to load, shift, and unload bit values based on a Clock input leading-edge trigger. Clock K Data-Out Data-In Enable Figure 6.36 Bit Shift Register Instruction Enable OFF – Shift Register disabled and all bits are cleared including the Data_Out bit. Enable ON – Shift Register operates. Clock ON – The state of Data_In bit (OFF or ON) is written into the first position of the Shift Register on the clock positive-going edge. All bits in the Shift Register are moved down one position. The last bit is moved to Data_Out. Page 96 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C INPUTS FORMAT DESCRIPTION CLOCK Binary Clock detected as OFF-to-ON transition. State of Data In moved into first position in Shift Register. All bits shifted one position. DATA_IN Binary Bit state moved into first position of Shift Register when Clock changes OFF-to-ON ENABLE Binary ON = Shift Register enabled OFF = SHRB disabled. All other inputs ignored. INTERNAL FORMAT DESCRIPTION Instruction # Number Must be unique for each Shift Register instruction (includes SHRW and other SHRB instructions) IR C or Y Starting bit address of Shift Register N Positive integer 1-1023 Length of Shift Register (in bits) OUTPUTS FORMAT DESCRIPTION DATA_OUT Binary Set to state (OFF or ON) of the last bit expelled from Shift Register Control Technology Inc. 2500 Series Training Course 1 Page 97 2500 Se 6.14.2 Bit Shift Register Application We have a requirement to track parts attached to carriers as they move down a production line. Below is a block diagram for the application: Pos 1 Pos 2 Pos 3 Pos 4 Pos 5 C51 =1 C52 =0 C53 =1 C54 =1 C55 =1 Pos 6 C56 =1 Figure 6.37 Production Line Application Diagram Description of line operation: There are two proximity switches at Position #1. X1 reads the presence of a carrier (Clock input) X2 reads the presence of a part (Data_In input) If part is detected at Pos #2 (C52), spray 3 sec of primer If part is detected at Pos #3 (C53) spray 3 sec of paint Use 6-bit Shift Register located at C51 - C56. Other signals: Page 98 X3 – Enable/Reset 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C We need to build a new program for this application. Select the PLC Type and Configure I/O as done in Chapter 5. When complete, go to the Ladder Editor and enter the logic as shown below and on the next page: Control Technology Inc. 2500 Series Training Course 1 Page 99 2500 Se Figure 6.38 Production Line Application Program Save As – PRODLINE.FSS Refer to Section 6.4 - Download, Run, and Monitor the program. Note the Shift Register operation: When a carrier is detected (X1 OFF-to-ON): 1) State of part (X2) is shifted into the first Shift Register position. This bit value moves down the register each time X1 detects a new carrier. 2) In Networks 2-3, 3 sec Timer for primer runs if C2 ON (when bit position #2 (C52) set ON in register). 3) In Networks 4-5, 3 sec Timer for paint runs if C3 ON (when bit position #3 (C53) set ON in register). Page 100 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 6.14.3 Word Shift Register Description The Word Shift Register instruction can be used to load, shift, and unload word values based on a Clock input leading-edge trigger. Clock K Status Enable Reset Figure 6.39 Word Shift Register Instruction Reset OFF – Register contents are cleared and Status Output set OFF. Reset ON and Enable Status Output is OFF. OFF – Shift Register disabled, Register contents retain values, and Reset ON and Enable ON – The data in address (A) is read into the Shift Register on leading edge (OFF-to-ON) of the Clock signal. All other data in the Shift Register is moved down one address position. Oldest data (at position N) is shifted out. Status Output turns ON for one scan on each successful operation into the Shift Register. Control Technology Inc. 2500 Series Training Course 1 Page 101 2500 Se INPUTS FORMAT DESCRIPTION CLOCK Binary Clock detected as OFF-to-ON transition. Data in Address A moved into start of Shift Register (Address B). All register data moved down one position. Oldest data shifted out of Shift Register. ENABLE Binary ON = Shift Register enabled OFF = SHRW disabled. All register data retained.. RESET Binary ON = Shift Register activated OFF = SHRW reset. All register data cleared. INTERNAL FORMAT DESCRIPTION Instruction # Number Must be unique for each Shift Register instruction (includes SHRB and other SHRW instructions) A V-Memory Address of data to be moved into the Shift Register B V-Memory Starting address of the Shift Register N Positive integer 1-1023 Length of Shift Register (in words) OUTPUTS FORMAT DESCRIPTION STATUS Binary Turns ON for one scan at the completion of every successful shift operation. Page 102 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 6.14.4 Word Shift Register Application Perform On-Line Edit to modify the existing program in PLC to create the logic as shown below (program logic spans 3 pages). NOTE: Remember to assign unique Instruction numbers to One-Shots, Timers, and Shift Registers. Go to RUN mode after completing Run-time Edit changes. Control Technology Inc. 2500 Series Training Course 1 Page 103 2500 Se Page 104 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Figure 6.40 Word Shift Register Application Save As – SHIFTREG.FSS Control Technology Inc. 2500 Series Training Course 1 Page 105 2500 Se Select the Data Window icon from the main toolbar and build this chart: Figure 6.41 ShiftReg Application Data Window Run the program, and watch the values move through the Bit and Word Shift Registers. Save the Data Template: Select Data on main toolbar; click Save Template, name it SHIFTREG, and then Save Close the Data Window. Verify Data Template was saved: Open new Data Window. Select Data on main toolbar; click Load Template, select SHIFTREG, and then Open Your saved template should now be open. Page 106 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Chapter 7. PLC Program Control his chapter will present the concept of Control Flow – techniques used to modify program execution so that the RLL instructions are not forced to run in sequence from top to bottom – and the effect this has on the PLC scan cycle. T 7.1 Program Structure Program control instructions allow movement within the program. There are basically three types of program structure: 1) Linear – the program runs from top to bottom, running all the logic. 2) Partitioned or Semi-Structured – The program runs from top to bottom jumping over selected portions (or partitions) of the program. 3) Structured – Each function is in a subroutine called from the ‘Kernel’ program. Control Technology Inc. 2500 Series Training Course 1 Page 107 2500 Se Partitioned Programming Example: The following flow chart shows a packaging machine that packs either 6 items or 12 items depending on a switch position. The switch controls which program section gets executed. No 6 Pack? Yes Jump 6 pack control logic 12 Pack? No Yes Jump 12 pack control logic Figure 7.1 Partitioned Programming Example Advantages: 1) Eliminates complicated control and enabling/disabling logic. 2) Could possibly reduce scan time depending on technique used to “jump” over unused logic. Options are described later in this chapter. Page 108 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Structured Programming Example The following flow chart shows the logic for the same packaging machine using a Kernel (shown in Red) with a separate subroutine for each function. Yes 6 Pack? 6-Pack Subroutine No Yes 12 Pack? 12-Pack Subroutine No Figure 7.2 Structured Programming Example Advantages: 1) Removes the need for complicated control and enabling/disabling logic. 2) Places each function in its own code section (subroutine). 3) Breaks the program into logical blocks for easier programming. 4) Troubleshooting is easier because only the subroutine needs to be monitored to verify machine operation. Eliminates the need to search through a long logic program. 5) Decreases scan time. Control Technology Inc. 2500 Series Training Course 1 Page 109 2500 Se 7.2 END Instruction Up to this point, we have been lazy by ignoring the END command. Good programming procedure includes an END instruction to indicate the end of program logic to be executed as part of the main RLL program. If no END is found, the PLC completes the RLL scan when it reaches the end of configured Ladder memory. There are 2 forms of the END command: Unconditional Conditional If a contact is inserted in the network, the END instruction automatically becomes a Conditional End (ENDC). This will terminate the main RLL program if the condition is TRUE. If the END instruction is placed on a network with no inputs, it is treated as an Unconditional End (END) and serves as the terminator for the main RLL program.. Figure 7.3 END Instruction Examples NOTE: If using subroutines as described in the Structured Programming Example, they must be located after the END command to prevent them being run as part of the normal (Kernel) program. Page 110 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 7.3 Master Control Relay (MCR) This section describes the operation of the Master Control Relay instruction. 7.3.1 MCR Description The Master Control Relay acts as a software “Emergency Stop” switch to conditionally turn OFF the Outputs within its Control Zone. When power flow to MCR is lost, it clears all Output coils between the MCR and the MCR End (MCRE) instructions. Control Zone Figure 7.4 MCR Instructions Power flow ON to MCR – the MCR is disabled and all Outputs work normally. Power flow OFF to MCR – the MCR turns OFF all Outputs coils in its Control Zone. WARNING: Do not use the MCR to replace hard-wired Emergency Shutdowns or Personnel Protection devices as it requires the PLC system to be fully functional to operate. Control Technology Inc. 2500 Series Training Course 1 Page 111 2500 Se 7.3.2 MCR Application Open program CONFIGURED.FSS and build the following program: Figure 7.5 MCR Application Refer to Sections 6.4-6.5 to Download, Run, and Monitor the program Turn X2 ON and X1 ON. Watch the logic operation. Turn X1 OFF. Watch the logic operation. Turn X2 OFF - wait several seconds; turn X2 ON; wait several seconds; repeat Note the Timer1 still runs although its Output is disabled. Page 112 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 7.4 Jump to Jump-End This section describes the operation of the Jump instruction. 7.4.1 Jump Description The Jump instruction ignores the Output coils within its Control Zone (between JMP and JMPE instructions). This instruction allows Outputs to be duplicated with the RLL program and updated only when specific input conditions are present. Control zone Figure 7.6 JMP Instruction Power flow ON to JMP – the Jump is disabled. All logic and Outputs within the Control Zone run normally. Power flow OFF to JMP – the Jump operates. The Control Zone logic runs normally, but all Outputs are not updated and are held in previous state. NOTE: The JMP instruction is overridden if located within a MCR Control Zone. When the MCR instruction loses power flow, the Outputs in the JMP zone are turned OFF regardless of the JMP state. Control Technology Inc. 2500 Series Training Course 1 Page 113 2500 Se 7.4.2 Jump Application Add these networks thru On-Line Edit to the MCR Application created in the last section. Figure 7.7 JMP Application Run and Monitor the program Observe the operation of Outputs in the JMP Control Zone with X4 ON and X4 OFF. Page 114 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 7.5 Skip-to-Label This section describes the operation of the Skip-to-Label instructions. 7.5.1 Skip-to-Label Description The Skip-to-Label instructions are similar to the JMP instruction except it ignores BOTH logic and Output coils within its Control Zone. These instructions allow Outputs to be duplicated and controlled by different logic sections within an RLL program. Control zone Figure 7.8 SKP-to-LBL Instructions Power flow OFF to SKP – the Skip-to-Label is disabled. All logic and Outputs within the Control Zone operate normally. Power flow ON to SKP – the Skip-to-Label operates. All logic and Outputs within the Control Zone are bypassed and ignored. NOTE: If the SKP is in an MCR or JMP Control Zone, the SKP takes precedence. When power flow is ON to SKP, all logic within the SKP-to-LBL Control Zone is bypassed and ignored. Control Technology Inc. 2500 Series Training Course 1 Page 115 2500 Se 7.5.2 Skip-to-Label Application Add these networks thru On-Line Edit to the Jump Application created in the last section. Figure 7.9 SKP-to-LBL Application Run and Monitor the program Observe the operation of timers in the SKP-to-LBL Control Zone with X10 ON and X10 OFF. Page 116 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 7.6 Go to Subroutine (GTS) This section describes the operation of the Go to Subroutine instruction. 7.6.1 GTS Description The GTS instruction directs the program to leave the main (linear) RLL program and call (or run) the specified subroutine. When the subroutine is completed (by RTN instruction), the program returns to the next instruction or network following the GTS instruction. Any MCR and/or JMP that is active when SBR is called remain active while the subroutine is executed. Likewise, any MCR and/or JMP set in a subroutine remains active in main program if not ended within the subroutine. A SKP-to-LBL pair must be located within the same SBR. The following rules apply to the use of subroutines: a. The END instruction must be used to mark the end of the main program. b. All subroutines must be entered in the ladder after the END instruction. c. SBR – must be used to define the start of each subroutine program. d. RTN – must be used to terminate each subroutine and return to the main program Figure 7.10 GTS/SBR Instrucitons Power flow ON to GTS – program control is transferred to specified subroutine number Power flow OFF to GTS –instruction is not executed and main program continues in sequence Control Technology Inc. 2500 Series Training Course 1 Page 117 2500 Se 7.6.2 GTS Application Add the following networks thru On-Line Edit to the Skip-to-Label Application created in the last section. Ensure Network 19 contains an Unconditional END. (program continues on next page) Page 118 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Figure 7.11 GTS/SBR Application Run and Monitor the program. Toggle X13 ON to call Subroutine 1. Toggle X13 OFF to call Subroutine 2. Observe timer runs only in the active subroutine. Since the timer in the uncalled subroutine is inactive, we can use the same timer number in both subroutines. Control Technology Inc. 2500 Series Training Course 1 Page 119 2500 Se 7.7 TASK Instruction There are two Tasks in the 2500 Series PLC: TASK1 The main RLL program TASK2 Cyclic RLL networks are high-priority instructions that execute on the specified time interval. The Cyclic RLL task interrupts all other PLC operations (Main RLL, Analog Tasks, I/O Update) in order to execute when required. 7.7.1 TASK Description The TASK instruction is entered as an unconditional RLL network output. The RLL program is limited to one main RLL task (TASK1) and one optional Cyclic RLL Task (TASK2). However, each task can consist of one or more segments of RLL instructions. Each task segment is started by the TASK instruction. A task segment is terminated by another TASK instruction or END instruction. All task segments must be placed in front of the END instruction. Each task executes RLL instructions in order from top to bottom as positioned in the program. If the first RLL network does not include a TASK instruction, TASK1 is assumed. Therefore, all RLL instructions are executed as part of the main RLL program until a TASK2 instruction is encountered. The Task Cycle Time (T) applies only to the Cyclic RLL Task (TASK2). The Cycle Time can be designated in milliseconds as a signed integer constant (0-32767) or as an unsigned integer value (0-65535) in the specified Word Memory Address. The use of a Word Address allows the cycle interval to be altered during run-time. If the Task Cycle Time = 0, the default time of 10 msec is used. If the Cyclic RLL Task consists of more than one TASK2 segment, the Task Cycle Time (T) specified in first TASK2 instruction determines the Cyclic RLL Task interval. Page 120 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Default Task 1 Task 2 - T entry specifies the interrupt cycle time in msecs T is set to 0 for Task 1 & 8. Task 2 segment Task 1 segment continued Task 2 Segment continued Notice the second Task2 definition has no time. Task 2 cycle time is defined by the first Task 2 instruction. Subsequent Task 2 times are ignored. Task 1 Segment continued Figure 7.12 TASK Instructions Control Technology Inc. 2500 Series Training Course 1 Page 121 2500 Se 7.7.2 TASK Application Open program CONFIGURED.FSS and build the following program: Figure 7.13 TASK Application Save As Page 122 - TASKS.FSS and Download to PLC. 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Before changing PLC to Run mode: Select PLC Utilities, PLC Configuration, Scan Time, and set Fixed Scan at 250 msec Go to Run. Observe the count in Task2 (V2) will be double the count in Task 1 (V1). This demonstrates that the Cyclic Task at 125 msec is running twice as often as the main RLL program at 250 msec. Immediate Contacts and/or Coils are used to read or write data to I/O modules during the scan rather than at the start of the PLC scan (as done with Normal I/O). Generally, Immediate Contacts and Coils are used in Task2 networks. Control Technology Inc. 2500 Series Training Course 1 Page 123 2500 Se Page 124 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Chapter 8. Data Formatting T his chapter describes the different types of data used in the 2500 Series CPU and how each data type is formatted for storage. 8.1 Data Elements Several different Data Elements are used in PLC to allow the logic instructions to access values stored in memory. This is general information applicable to any computer. Byte A Byte consists of 8 contiguous bits. A Byte represents a single value. Bit number 1 2 3 4 5 6 7 8 Most significant bit Word Least significant bit A Word value consists of 2 contiguous bytes or 16 bits. 1 2 Most significant bit Examples: 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 Bit number Least significant bit The contents of V-Memory address V100 is a word. The output address WY551 is a word. Control Technology Inc. 2500 Series Training Course 1 Page 125 2500 Se Double Word A Double Word consists of 2 contiguous words or 32 bits. The Double Word element represents a single value. V200 Most Significant Word 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 3 1 4 1 5 1 6 Bit number Most Significant Bit V201 Least Significant Word 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 Bit number Least Significant Bit Note that the Most Significant Word is the first (or lowest) addressed word. Page 126 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 8.2 Data Types A Data Type is simply a definition of the data format of the value in a Data Element. For instance, the data stored in a Word can represent a Signed Integer, Unsigned Integer, or BCD value. This section describes the formats used in the 2500 Series PLC. 8.2.1 Signed Integer Word data is most commonly stored as a 16-bit Signed Integer. The Signed Integer holds values16- ranging from –32,768 to +32,767. This data type uses two’s complement format as shown below. When bit 1 (the sign bit) is 0, the number is positive; when bit 1 is 1, the number is negative. Sign Bit Most Significant Bit Bit # Least Significant Bit 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 0 0 0 1 1 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0 1 1 0 1 0 Control Technology Inc. 2500 Series Training Course 1 +32767 +1 00000 -1 -32768 Page 127 2500 Se 8.2.2 Unsigned Integer Word data can also be accessed as an Unsigned Integer. The Unsigned Integer holds values ranging from 0 to 65535. Least Significant Bit Most Significant Bit Bit # 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +65535 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8.2.2 Long Integer A Double Word (32-bit) value can be accessed as a Long Integer. Long Integer data is similar to Signed Integer in that both positive and negative values are stored in sign-extended two’s complement format as shown in Section 8.1. 8.2.3 Real Number Real numbers are 32-bit floating point numbers stored as a Double Word value in accordance with ANSI/IEEE Standard 754–1985 forma as shown in the following diagram. Real numbers are not used in the 2500 Series RLL instructions. They are available for use with Loops, Alarms, and Special Function programs. Sign Bit Exponent 1 Mantissa 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Page 128 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 8.2.4 Hexadecimal Hexadecimal (Hex) formatting is often used in programming because it is actually just a concise method of representing Binary data. Each Hexadecimal digit represent 4-bits of Binary data; which means 2 Hex digits are used to represent one Byte, and 4 Hex digits represent one Word. Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Example: Bit 1 Binary 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 Hex 0 1 2 3 4 5 6 7 8 9 A B C D E F Hex B7C3 = Binary 1011 0111 1100 0011 2 3 0 B 1 4 5 6 7 1 7 1 8 9 10 11 1 C 0 12 13 14 15 16 0 3 1 1 No. Hex Bin 1 1 0 1 1 0 0 Bit numbers in this PLC are numbered 1 to 16 where Bit 1 is the most significant value and Bit 16 is the least significant value. Control Technology Inc. 2500 Series Training Course 1 Page 129 2500 Se 8.2.5 Binary Coded Decimal (BCD) BCD is a legacy data format used primarily for transferring values to/from thumbwheel switches and 7-segment LED displays using Digital I/O channels as the communications interface. BCD uses 4-bits to represent each decimal number as shown in the following table. Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Binary 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 BCD 0 1 2 3 4 5 6 7 8 9 None None None None None none Hex 0 1 2 3 4 5 6 7 8 9 A B C D E F Example: BCD 9364 = Binary 1001 0011 0110 0100 NOTE: Hexadecimal is in the table only for reference. There is no direct relation between BCD and Hex. However, there is a correlation as the binary representations for BCD 0 thru 9 is identical to Hex 0 thru 9. Although, most PLCs (including the 2500 Series) do not support BCD values directly, it is possible to access BCD data in Hexadecimal format because the BCD data format is identical to Hex digits 0-9 Page 130 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 8.2.6 BCD to Binary Conversion When using BCD input devices such as thumbwheel switches, it is usually necessary to convert the BCD data into binary (integer) format since most RLL instructions do not directly support the BCD data format. The Convert BCD to Binary instruction performs this task. Figure 8.1 BCD to Binary Instruction This instruction executes each scan the Input is ON: The value in (N) determines the number of BCD digits to convert. The number of BCD digits are counted from the least significant digit (in Bits 13-16) to most significant digit (in Bits 1-4) as shown below: BCD Digit Count: Digit 4 Digit 3 Digit 2 Digit 1 Bits 1-4 Bits 5-8 Bits 9-12 Bits 13-16 If the Input Word Address (BCD) contains a valid BCD value (0-9) in each 4-bit segment for the number of specified BCD digits (N), the equivalent binary integer is written to Output Word Address (BIN) and the Output turns ON. If any segments in Input Word Address (BCD) marked for conversion are not valid, the BCD-to-Binary conversion is aborted. The Output Address (BIN) is unchanged and the Output turns OFF. Control Technology Inc. 2500 Series Training Course 1 Page 131 2500 Se 8.2.7 Binary to BCD Conversion When using BCD output devices such as 7-segment LED displays, it is necessary to convert integer values into BCD format before writing the data to the display. The Convert Binary to BCD instruction performs this task. Figure 8.2 Binary to BCD Instruction The CBD instruction executes each scan the Input is ON: The value in (BIN) is evaluated as a 16-bit signed integer. If the value is in the positive range (0 to 32767), the BCD equivalent value is written to Addresses (BCD) and (BCD+1) as shown below and the Output turns ON. Each BCD digit occupies four bits and is written into two contiguous memory locations as shown below. Address BCD: Address BCD+1: Page 132 Bits 1-4 Bits 5-8 Bits 9-12 Bits 13-16 Unused Unused Unused Ten Thousands Bits 1-4 Bits 5-8 Bits 9-12 Bits 13-16 Thousands Hundreds Tens Ones If the value in (BIN) is negative, the BCD conversion is aborted. The values in Addresses (BCD) and (BCD+1) are unchanged and the Output turns OFF. 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Example 1: V1 = 1234 MSB 0 LSB 0 0 0 MSB 1 LSB 2 3 4 Example 2: V1 = 23456 MSB 0 LSB 0 0 2 MSB 3 LSB 4 5 6 8.3 Analog Data We have already discussed (in Chapter 4) the storage of Analog Inputs (WX) and Analog Outputs (WY) in the Word I/O Image Register. This section describes the methods used to perform the Analog-to-Digital conversion required to digitize those signals. We will explicitly discuss Analog Input signals, but the same techniques are used for the Digital-to-Analog conversion required for Analog Outputs. 8.3.1 Analog-to-Digital Conversions The digitized Analog Input theoretically is a Signed Integer in the range of -32000 to +32000. In reality, the A/D chip will over-range to approximately –32600 to +32600 so it is certainly possible to see a digital value outside of the theoretical range. It should NOT go to maximums +32767 and –32768. A/D converters are not continuous linear devices. They convert in steps. The size of each step is determined by the number of bits used for the conversion. Example: A 9-bit A/D converter generates a binary number in bits 2 thru 10. Therefore, the analog value must change by a minimum of 64 counts (see table below) before a change is detected in the digital value. For a typical analog signal with a range of 0-32000 counts, this equals to a change of 0.2% of the range ( 64 / 32000 ). This is the theoretical “best-case” resolution with 9-bit conversion. Control Technology Inc. 2500 Series Training Course 1 Page 133 2500 Se 3 2 7 6 8 1 6 3 8 4 8 1 9 2 4 0 9 6 2 0 4 8 1 0 2 4 5 1 2 2 5 6 1 2 8 6 4 3 2 1 6 8 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 0 0 1 1 1 1 1 1 1 - - - - 4 - 2 9-bit gives ~2.0% 10-bit gives ~1.3% 11-bit gives ~0.6% 12-bit gives ~0.3% 13-bit gives ~0.2% 14-bit gives ~0.1% 15-bit gives ~0.04% 1 - There are also variations in the A/D chip itself which can de-rate the conversion accuracy as much as 5-10X. Add the inaccuracies in other components and the de-rating may approach 20X the theoretical resolution. Reputable manufacturers aggressively de-rate the accuracy specifications of modules due to these variations. Examples: CTI Model 2550A (12-bit mode is guaranteed 1.0% full scale. CTI Model 2555A (14-bit mode) is guaranteed 1.0% full scale. CTI Model 2558 (13-bit mode) is guaranteed 0.5% full scale. CTI Model 2501 (15-bit mode) is guaranteed 0.5% full scale (even with resolution ~10X the 2550A) 8.3.2 Signals with 20% Offset The term 20% Offset is derived from the value used as the minimum signal level. For instance, a 4-20ma uses 4ma (or 20%) of the full signal range as the ‘zero’ point. Commonly used 20% Offset ranges are 4-20ma and 1-5V. Many input circuits use 4-20ma signals for two reasons: 1) Noise Rejection – Current circuits are low impedance. Since noise is a voltage level, it is a high-impedance signal that is shunted to Ground. 2) Open Circuit Detection – Because 4ma level is used the minimum range (or ‘zero’) point, an input value less than 3.5ma indicates a bad circuit. Certainly, 0ma indicates an open circuit. A/D converters are voltage device. Current signals must be converted to voltage. This is commonly done with a 250ohm resistor placed in parallel with the input when current mode is selected. The voltage is then brought in as 0 to 5VDC. Page 134 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Some A/D converters have built-in compensation for 20% Offset signals. If not, the A/D converter loses 20% of its resolution when 20% Offset signals are used. See the following tables: A/D Conversion with 20% Offset Compensation: Current 0ma 4ma 12ma 20ma Volts 0VDC 1VDC 3VDC 5VDC % of Range NA 0% 50% 100% Raw Data NA 0000 16000 32000 Range 32000 A/D Conversion without 20% Offset Compensation: Current 0ma 4ma 12ma 20ma Volts 0VDC 1VDC 3VDC 5VDC % of Range NA 0% 50% 100% Raw Data NA 6400 19200 32000 Range 0000 25600 When using modules with 20% Offset compensation, use the following formula to convert raw analog signals to engineering units: EU_Value = (Raw Data / 32000 * EU_ Range) + EU_Offset When using modules without 20% Offset compensation, use the following equations for converting a raw signal values: EU_Value = (Raw Data / 25600* EU_ Range) + EU_Offset Example: 4-20ma signal represents 400 to 700°F Raw signal = 9014 EU_Range = 700-400 = 300°F EU_Value = (9014-6400)/25600*300 + 400 = 430.6328°F Control Technology Inc. 2500 Series Training Course 1 Page 135 2500 Se Page 136 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Chapter 9. Math Instructions W hen used within its constraints, RLL Math is very simple. It becomes very cumbersome and awkward when pushed outside its constraints. This chapter describes the Math instructions and demonstrates these constraints. 9.1 Add and Subtract Instructions The Add instruction computes the Sum of two Signed Integer values, and the Subtract instruction computes the Difference of two Signed Integers. 9.1.1 ADD and SUB Descriptions The ADD instruction executes (R = A + B) each scan the Input is ON. The parameter values in A and B are evaluated as 16-bit Signed Integers. Contents of B can contain a Word Address or Integer constant. If the result is within the valid range for a Signed Integer (-32768 thru +32767), the Sum is written to Address R and the Output turns ON. If the result is outside of the valid range for a Signed Integer, an overflow condition occurs. The result is then written as the 16-bit truncated Sum (16 LSB) and the Output turns OFF. The Subtract instruction executes (R = A – B) each scan the Input is ON. The values in A and B are evaluated as 16-bit Signed Integers. Either A or B can contain an Integer constant. However, it is invalid for constants to be entered in both fields. If the result is within the valid range for a Signed Integer (-32768 thru +32767), the Difference is written to Address R and the Output turns ON. If the result is outside of the valid range for a Signed Integer, an overflow condition occurs. The result is then written as the 16-bit truncated Sum (16 LSB) and the Output turns OFF. The following application example shows the operation of the Add instruction. The Subtract instruction operation is identical. Control Technology Inc. 2500 Series Training Course 1 Page 137 2500 Se 9.1.2 ADD Application Open program CONFIGURED.FSS and build the following program: Figure 9.1 ADD Instruction Save as ADD.FSS. Download to PLC and Run. Open Data Window. Click Options in main toolbar, then select Program Setup, Data Window and deselect Tags, Descriptions, Time Stamp, and Status displays as shown below. Figure 9.2 Data Window Display Selection Page 138 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Reduce image sizes to display both Ladder Editor and Data Window. Figure 9.3 Resized Ladder Editor and Data Window Enter addresses and data formats in Data Window as shown below. Adjust width of cells may to display the full binary value. Figure 9.4 Display of Data Formats Control Technology Inc. 2500 Series Training Course 1 Page 139 2500 Se Enter the following values: V1 = 3000, V2 = 3000 Note the result of the ADD instruction (V3) and C2 Output is ON. Set V1 = 32766 and V2 = 1. C2 Output is ON. Note both Decimal and Binary values of V1-V3. Set V2 = 2. C2 Output is OFF. Note both Decimal and Binary values of V1-V3. It is possible to reconstruct the result by detecting C2 as Overrun bit, deleting Bit 1 (sign bit), and reconstructing the result using other Math functions BUT it is extremely awkward. It is even worse when dealing with negative numbers. Do not add or subtract values that will give a result outside the valid range (-32768 to +32767). If necessary, values can be scaled by a factor of 10 as long as the process can tolerate the reduced accuracy. Page 140 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 9.2 Multiply Instruction The Multiply instruction computes the Product of two Signed Integer values and stores the result as a Long Integer (32-bit Signed Integer). 9.2.1 Multiply Description The Multiply instruction executes (RR = A * B) each scan the Input is ON. The values to multiply are read as 16-bit Signed Integers from Memory Address A and either Word Address or constant in parameter B. The multiplication is completed and Product is stored as a Long Integer in Word Addresses RR and RR+1. Address RR contains the 15 most significant bits plus sign, and Word RR+1 holds the 16 least significant bits. Range of Long Integer: -2,147,483, 648 thru +2,147,483,647 Output is turned ON. 9.2.2 Multiply Application Add the following network to the current PLC program and addresses V4-V6 to the Data Window as shown below: Figure 9.5 Multiply Instruction Application Note result of the Multiply instruction is labeled RR. This indicates that it is stored in 2 words as a 32-bit Long Integer value. In the PLC memory, this value occupies locations V6 (MSW) and V7 (LSW). Control Technology Inc. 2500 Series Training Course 1 Page 141 2500 Se Set the size of V6 to display a 32- bit Signed Integer value. Enter V4 = 32767 and V5 = 1000. Note result in V6 and C3 Output is ON. Enter V4 = 32767 and V5 = 32767. Note that even when maximum possible values are used, the result is valid (does not Overrun) and C3 Output is ON. Producing a 32-bit result is very useful for computations, but the Long Integer is generally not supported as a parameter directly in RLL Math instructions. Therefore, it must be scaled to a 16bit Integer value. You can use the Divide instruction to accomplish this, but it causes a loss of accuracy. Page 142 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 9.3 Divide Instruction The Divide instruction performs an Integer Division operation. The results are stored as the Quotient and Remainder as standard 16-bit Signed Integers. 9.3.1 Divide Description The Divide instruction executes (R = A / B) each scan the Input is ON. 1. The Dividend is read from a memory address or constant based on the contents in A. If A contains a Word Address, the Dividend is read as a Long Integer. Word A contains the 15 most significant bits plus sign, and Word A+1 holds the 16 least significant bits. Otherwise, A is read as a 16-bit Signed Integer constant.= 2. The Divisor B is read as a 16-bit Signed Integer from a memory address or constant It is invalid for both A and B to be entered as constants. 3. The Division is completed and results are stored based on the following conditions: If the Divisor is equal to zero, the operation is aborted. The Result Words R and R+1 are unchanged, and the Output is turned OFF If the Quotient is a valid 16-bit Signed Integer, the Quotient is written to Address R, and the Remainder to written to Address R+1. The Output is turned ON. If the Quotient is invalid (greater than +32767 or less than -32768), the operation is aborted. The Result Words R and R+1 are unchanged, and Output is set OFF. Control Technology Inc. 2500 Series Training Course 1 Page 143 2500 Se 9.3.2 Divide Application Add the following network to the current PLC program and addresses V8-V10 to the Data Window as shown below: Figure 9.6 Divide Instruction Application Set V4 = 20000, V5 = 5000, and V8 = 700. Note there is no result in the Divide instruction result words V9 or V10. Since the result is 142,857 we have an overrun condition, the operation is aborted, and C4 Output is turned OFF. Change V8 = 7000. The Divide operation now completes successfully. The Result V9 (Quotient) holds 14285, V10 (Remainder) equals 5, and C4 Output is turned ON. Remember the Divide instruction uses Integer Math, and results are truncated (not rounded). Page 144 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 9.4 RLL Math Example Application This section shows an example of RLL Math instructions to convert a standard Analog Input into Engineering Units. Analog Input WX1 = 4–20 mA (20% offset). This value represents flow of 0–100.0 gph (accuracy = 0.1%) Engineering units will be 0 to 1000 (Flow*10). Store the result in V100. V200-V205 used for temporary storage for Math operations. Because decimal numbers cannot exist in Integer Math, we will compute flow in the range of 0-1000 (representing 0-100.0 gph). If this value is sent to an HMI, the HMI software must be configured to take this value and divide by 10 to convert to a Real Number 0.0 to 100.0. Engr Units = (Raw Data – 6400) / 25600 * Engr Units Range If we first divide, the result will be number less than 1 and the result will be ZERO. So we must first multiply and store as Long Integer. Then divide by 25600. V100 = (WX1 – 6400) * 1000 / 25600 Control Technology Inc. 2500 Series Training Course 1 Page 145 2500 Se Add the RLL network to the PLC program and addresses to the Data Window as shown below. Figure 9.7 RLL Math Example Application Change to Run mode. Force different values in the range of 6400-32000 into WX1 to see flow results. Page 146 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Chapter 10. Troubleshooting System status and diagnostic data is critical to any application. PLC Status Words provide this information to the programmer. T his chapter describes some of the basic diagnostic data provided by the CPU and techniques that can be used to analyze and troubleshooting the operation of your system based on this data. 10.1 PLC Status Words We can display Status Words (STW) in a Data Window and interpret the value contained in each word. Some Status Words contain a group of bits (each with a different meaning) , and others hold an Integer value. Appendix G of the Programming Reference Manual explains the Status Words provided by the 2500 Series PLC. Open program CONFIGURED.FSS and Download program to PLC. Open a new Data Window and add word STW1. Display as Binary value and expand the cell to show all 16 bits as shown below: Figure 10.1 STW1 Example Control Technology Inc. 2500 Series Training Course 1 Page 147 2500 Se A description of STW1 bits are shown in the following table: Bit 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Description Password entered Password entered and disabled Error in user program. See STW200 for further information Overflow subroutine stack Time of day failure Special Function module communications failure Failure in previous ladder instruction Failure or mismatch in I/O module Processor communication port failure Scan overrun Low battery Figure 10.2 STW1 Description In our example, Bit 15 ON indicates a Low Battery condition. 10.2 Alarming and Status Reporting Blocks of V-Memory words are typically assigned to hold data to be transferred to/from other system devices. Assume V500–V599 is designated to store data to be transmitted and V500 holds 16 status bits. In this case, we want V500 to be assigned as follows: V500.1 = STW1.11 V500.2 = STW1.12 V500.3 = STW1.13 V500.4 = STW1.14 Page 148 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C We can accomplish this using the logic shown in the following program example. Figure 10.3 Alarming and Status Reporting Example When using this technique to send data to a HMI device, you must coordinate the HMI configuration so the appropriate data can be broken out to generate alarm messages to the operator screens. Control Technology Inc. 2500 Series Training Course 1 Page 149 2500 Se 10.3 Program Control Monitoring A routine is often needed for power-up initialization. For instance, we want to ensure Outputs are set to a specific state whenever the PLC enters Run mode. STW201 holds First Scan Status Flags Bit 1 2 3 4-8 9 10 11 12 13-16 as shown in the following table: Description First scan after compiling an SFPGM First scan after change from Program mode to Run mode First scan after changing from Run-time Edit mode to Run mode Not used First scan after Power-up Restart with a bad battery First scan after Power-up Restart with a good battery First scan after a commanded Complete Restart First scan after a commanded Partial Restart Not used Figure 10.4 STW201 Description Page 150 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C The following example shows the logic required to initialize a motor controlled by Y33 to OFF whenever the PLC enters Run mode following a power cycle. We will use STW201.9 and STW201.10 since we want to initialize the motor whether the battery is good or bad. The initialization logic is placed in a Subroutine called when STW201.9 or STW201.10 is ON. Always use the END command to separate Subroutines from the main program. Figure 10.5 STW201 Application Example Ladder Network 9 ensures that Y33 is always turned OFF by the First Scan Flags. Control Technology Inc. 2500 Series Training Course 1 Page 151 2500 Se Many programmers prefer to generate their own First Scan Flag. This is accomplished by entering in the following logic as the LAST network in the program. Any previously unused non-retentive Control Relay (C) address can be used. Figure 10.6 User Generated First Scan Flag In this example, C100 is OFF for the first scan until it is turned ON when the last RLL network is executed. It is then held ON until the power is cycled. Page 152 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 10.3 PLC Status PLC Status is an On-Line function meaning it can be monitored only when connected to an active PLC. PLC Status is accessed by selecting PLC Utilities / PLC Status from the main toolbar. Figure 10.7 PLC Status Menu Selection The following screen is displayed indicating no errors: Figure 10.8 PLC Status Window Control Technology Inc. 2500 Series Training Course 1 Page 153 2500 Se Close the PLC Status window. Remove the Output Module from Slot #2, and re-open the PLC Status Status now shows a Non-Fatal Error in the I/O configuration. window. The PLC Figure 10.9 Non-Fatal Error Status The cause of the I/O configuration requires further investigation as described in the next section. Page 154 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 10.4 I/O Status I/O Status is an On-Line function that provides status for each configured I/O base. I/O Status indicates whether each slot in the base matches the I/O configuration map. I/O Status is accessed by selecting PLC Utilities / PLC Utilities/ I/O Status from the main toolbar. Figure 10.10 I/O Status Window You can now see that the I/O Error is caused a module mismatch in Slot #2 in Base 0 (Local Base). The slot is reporting Empty, but a 32-point Output module has been configured in that position. Control Technology Inc. 2500 Series Training Course 1 Page 155 2500 Se 10.5 Digital Input Module Status This section provides a simplified description of the operation of a typical Digital Input Module. LED Channel 1 LED Channel 2 M u l t i p l e x e r M e m o r y Chassis Backplane Figure 10.11 Digital Input Module Block Diagram The signal comes in thru the screw terminals and into an input buffer/amplifier. The Status LED for the channel is on the output of the buffer/amplifier. The multiplexer is a switch selecting one of the inputs and sends it to the module memory. Data is then transferred along the bus as controlled by the PLC or RBC. LED ON indicates the signal is getting to the Multiplexer. A failure after this point usually affects the entire module and is detected by the module diagnostics. LED OFF indicates either the signal is not coming into the module or the buffer/amp for this channel has failed. A failed buffer/amp will usually NOT be detected by the diagnostics. Page 156 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 10.6 Digital Output Module Status This section provides a description of the operation of a typical Digital Output Module. Both solid-state and relay modules are included. Below is a simplified block diagram of a typical solid-state Digital Output Module: Field Power LED Driver M e m o r y D e m u l t i p l e x e r Driver Driver Driver Typically field power sources 4-8 outputs Figure 10.12 Solid-State Digital Output Module Block Diagram The Output channel Status LED is located between the Demultiplexer and the output drivers LED ON indicates the Output signal is getting to the driver. A problem with the field device not operating is probably due to the fuse or other field wiring/device failure. It COULD be the Output driver. This usually will NOT be detected by the module diagnostics. LED OFF indicates the Output signal is not getting to the driver. If the corresponding Y coil is ON in the program, there is probably a failure in the module. Usually other Output signals will be affected. This situation is usually detected by the module diagnostics. Control Technology Inc. 2500 Series Training Course 1 Page 157 2500 Se Below is a simplified block diagram of a typical Relay Output Module: 24VDC Relay Coil Power Field Power NC Output D e m u l t i p l e x e r NO Output LED Driver R1 Figure 10.13 Relay Output Module Block Diagram A Relay Output is similar to a solid-state Digital Output except there are 4 items generally not detected by the diagnostics: The individual drivers The relay coils and contacts Relay coil power Field power The Status LED is located on the input to the driver. Problems before the LED will usually affect multiple channels and be detected by the diagnostics. A field device not operating when the LED is ON probably indicates a problem with field wiring or device, or loss of relay coil power. However, it is possible that the driver or relay has failed. LED OFF indicates the Output signal is not getting to the driver. If the corresponding Y coil is ON in the program, there is probably a failure in the module. Usually other Output signals will be affected. This situation is usually detected by the module diagnostics. Page 158 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 10.7 Remote I/O Communications Status Many system problems are caused by communication errors between the PLC and Remote I/O Bases. All Remote I/O cable installations should adhere strictly to the recommended wiring practices for high-speed RS-485 communication networks. Although this discussion is beyond of this class, detailed information is available. Please contact CTI Technical Support. Status Words STW145 and STW146 contain Communications Error Counts for the Remote I/O system. STW145 records the number of Receive Errors indicating “noise” on the wire. STW146 holds the number of Timeout Errors. This indicates a total loss of data, i.e., a broken wire since the most recent restart. 10.7.1 Monitoring Remote I/O Errors You may find it useful to establish a baseline for Remote I/O Communications operation as a reference to determine future degradation of performance. This can be accomplished as follows: With the system stable and running normally, create a Data Window and set STW145-STW148 to zero as shown below. Return after approximately 24 hours of operation and read the counts in these Status Words. Save these values with other system parameters. A good place for storage of this data is in the Program Header block. NOTE: There should be no more than one I/O error detected (and corrected on retry) per 20,000 scans. This is approximately 15 minutes in a system with a PLC scan of 50msec. A higher value may indicate cabling and/or interference problems. Three consecutive errors to an RBC cause the base to be logged off and a failure bit in STW2 will be set. Control Technology Inc. 2500 Series Training Course 1 Page 159 2500 Se 10.7.2 Logging Remote I/O Error Counts Communication faults often occur at random times or from odd conditions. It is difficult to stand and watch a Data Window for error events. The following program is set up to log Remote I/O Error Counts in15-minute intervals over a 24-hour period. The error counts are stored in Shift Register V502-V598. Each error count entry is be accompanied by a Hour/Minute value indicating the corresponding time period in Shift Register V602-V698. WARNING: The addresses and instruction numbers used in this example are for demonstration only. If using this logic in your program, you must change the instruction numbers and addresses to reference ones not currently being used. (program continues on next page) Page 160 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Figure 10.14 Remote I/O Error Count Logging Application Control Technology Inc. 2500 Series Training Course 1 Page 161 2500 Se Page 162 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Chapter 11. Documentation Every application requires documentation for future reference and explanation of the original requirements and thought process that went in to developing the system. T his chapter provides a brief overview for generating a documentation package for your application. 11.1 Print Dialog WorkShop provides a simplified way for printing your system documentation. The Print dialog contains two separate windows: 1. Program Elements available for printing Logic (RLL) and SFs Loops Alarms PLC Configuration Registers Documentation Cross Reference 2. Specific Data Range and Print Setup parameters With your program loaded, Open the Print Dialog by selecting File / Print from the main toolbar. Control Technology Inc. 2500 Series Training Course 1 Page 163 2500 Se 11.2 Selection of Program Elements When the Print function is opened, the following dialog opens: Figure 11.1 Print Program Elements Selection As a default setting, all program documentation is selected. All Program Elements, and all configured data is a are selected to be printed. Any of the Program Elements can be selected or de-selected using the corresponding check boxes. The window on the right shows the range of each selected Program Element. The default setting includes all configured data. For instance, our example shows Ladder Networks 1-7 which includes our entire RLL program. No SF Programs or SF Subroutines are shown because none exist in our program. Page 164 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C 11.3 Data Range and Print Setup When the button for one of the selected Program Elements (checkmark displayed) is pressed, the second Print dialog appears. This window is used to enter the Data Range for the selected Program Element and Print Setup parameters. For example, press the Logic and SFs button. The following dialog is displayed: Figure 11.1 Print Selection Dialog Here you can select the range of RLL Network numbers, SF Programs, and SF Subroutines to be printed along with Print Setup information. Control Technology Inc. 2500 Series Training Course 1 Page 165 2500 Se Page 166 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Appendix A. CTI Contact Information Control Technology Inc. 5734 Middlebrook Pike Knoxville, TN 37921 Website: www.controltechnology.com Office: 865-584-0440 Fax: 865-584-5720 Technical Support John Ottinger Scott Simpson Ed Hibbard Fred Wilson ext 401 ext 209 ext 461 ext 270 email: jottinger@controltechnology.com email: ssimpson@controltechnology.com email: ehibbard@controltechnology.com email: fwilson@controltechnology.com Sales Robert Peck Ron Soderberg Alan Jenkins Perry Bright ext. 210 ext 452 ext 450 ext 456 email: rpeck@controltechnology.com email: rsoderberg@controltechnology.com email: ajenkins@controltechnology.com email: pbright@controlotechnology.com Inside Sales Manager Missy Johnson Control Technology Inc. ext 281 email: mjohnson@controltechnology.com 2500 Series Training Course 1 Page 167 2500 Se Page 168 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Appendix B. Replacement/Compatibility Guide Control Technology Inc. 2500 Series Training Course 1 Page 169 2500 Se Page 170 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Appendix C. CPU Product Models The CTI 2500 Series controller is available in four models. The following table lists the characteristics for each model. Feature 2500-C100 User Program Memory Discrete I/O Points Word I/O Points Control Relays Retentive Control Relays Timers/Counters Compiled SF Cyclic PID Loops RLL Initiated PID Loops Analog Alarms Special Function Programs Special Function Subroutines Maximum Serial Port Data Rate Flash O/S Removable User Storage 128K 256K 512K 3072K 1024 2048 8192 8192 1024 1024 8192 8192 4096 32,768 32,768 32,768 1024 4096 4096 4096 1024 20,480 20,480 20,480 Yes Yes Yes Yes 16 64 128 128 0 0 384 384 32 128 512 512 64 1023 1023 1023 64 1023 1023 1023 115,200 baud 115,200 baud 115,200 baud 115,200 baud Yes Yes Yes Yes SD Card – SD Card – SD Card – SD Card – Up Up to 1GB Up to 1GB Up to 1GB to 1GB Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes No Yes Yes Yes 5-yr storage (0-60ºC) 3-yr continuous operation @ 25º C, 6 mos. @ 60º C On-Board User Flash Local Ethernet Port USB Port Remote I/O Profibus-DP I/O Battery Control Technology Inc. 2500-C200 2500-C300 2500 Series Training Course 1 2500-C400 Page 171 2500 Se Page 172 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C Appendix D. 2500 Series Status Words Word: Bit 505 Description STW 1 Bit 1 Bit 2 Bit 3 Bit 4 Bit 5 Bit 6 Misc. Status and Non-Fatal Errors Set by SSI Instruction to inhibit HBU synch Set to indicate Online Standby HBU Preference Switch Password has been entered Password is currently disabled User Program Error Flag Bit 7 Bit 8 Bit 9 Bit 10 Bit 11 Subroutine Stack Overflow Time of Day Clock Failure TIWAY II Failure SF Module Communications Failure Previous RLL Instruction Failed Bit 12 I/O Module Failure Bit 13 Bit 14 Communications Port Failure Scan Overrun Bit 15 Bit 16 Battery Low Ladder Memory Checksum Error STW 2 Base Controller Status Remote I/O. Corresponding bit is set to 1 if a base is: Failed Not Present Not Configured Not Enabled. Status of DP channel slaves. Set to 1 if slave is: Not Present Not Enabled Offline Not Configured Configured but Not Active Configured and Activated but Profibus state is set to STOP STW 3: STW 9 STW 10 Dynamic Scan Time Control Technology Inc. Comments Not used. Set to 0 Not Used. Set to 0 Not Used. Set to 0 Standard Password Only Standard Password Only Set ON when RLL error detected. When set, STW200 is valid. Subroutines nested more than 32 deep Use TBD Not Used TBD. Set ON when error detected. Set OFF when instruction successful. Set if any I/O module reports a failure. I/O failure may be exhibited even if the slot containing the module is a mismatch or not configured. If the base is not configured or the base is disabled, this bit will not be set. Failed modules in a Profibus base are not reported in this bit by the 505. Determine what constitutes “failure” Set if scan time exceeds the Fixed Time or Upper Limit Time Set if battery is low or bad/off This is the checksum for the “source” ladder not the compiled ladder. There is one bit for the local base and each remote base controller address. LSB (bit 16) is the local base; bit 15 is base 1; etc. Tested and observed the following conditions that set the bit: Slave Not Present Slave Not Enabled Slave Offline Slave in Stop Mode The Profibus base can be configured so that it goes Offline if there is a configuration error. Scan time of previous scan. 2500 Series Training Course 1 Page 173 2500 Se STW 11: STW 26 I/O Module Status Slot bit is set to 1 if any of the following conditions is true: Installed Module does not match configuration for the slot The slot is configured but no module is installed in the slot. The slot is not configured but a module is installed. Module fail is asserted and fail bit is set Bit is set to 0 if: Module is configured and configuration matches Slot is not configured and no module is present No slots in the base are configured, regardless of whether a module is present. See comments. STW 27: STW 138 Profibus Module Status. Provides module status for modules in a 505 base using a Profibus RBC. The conditions for setting the bit are the same as the I/O Module Status words. STW 139 STW 140 STW 141 Bit 1 – 4 Bit 5 – 8 Bit 9 – 12 Bit 13 - 16 STW 142 Bit 1 – 4 Bit 5 – 8 Bit 9 – 12 Bit 13 - 16 STW 143 Bit 1 – 4 Bit 5 – 8 Bit 9 – 12 Bit 13 - 16 Page 174 Number of Forced Bits. Current count of forced X, Y, and C. Number of Forced Words Current count of forced WX and WY. BCD Time of Day – Word 1 Year – Tens Year – Units Month – Tens Month - Units BCD Time of Day – Word 2 Day - Tens Day - Units Hour - Tens Hour - Units BCD Time of Day – Word 3 Minute - Tens Minute - Units Second - Tens Second - Units LSB (bit 16) is the first slot. STW 11 is local base. STW 12 is remote base 1. STW 13 is remote base 2, etc. Remote bases must be enabled and configured before the module status will be reported. Otherwise, all words will be set to 0. When an SF module is configured without the SF indicator, this does NOT show up as a mismatched module. STW 127 is Station 1, STW 128 is Station 2, etc. If a station is not a Profibus RBC, the corresponding status word will be set to 0. Profibus bases must be enabled, configured, and online before the module status will be reported. Otherwise, all words will be set to 0 The Profibus RBC can be configured to go offline if there is a configuration error. If the RBC is offline, the status words will report all zeroes. Count of Word forces includes words with one or more bits forced. 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C STW 144 Bit 1 – 4 Bit 5 – 8 Bit 9 – 12 Bit 13 - 16 STW 145 STW 146 STW 147 STW 148 STW 149: STW 160 STW 161 Bit 1 Bit 2 Bit 3 Bit 4 Bit 5 Bit 6 Bit 7 Bit 8 Bit 9 - 16 STW 162 Bit 1 Bit 2 Bit 3 Bit 4 Bit 5 Bit 6 Bit 7 Bit 8 Bit 9 Bit 10 Bit 11 Bit 12 Bit 13 Bit 14 - 15 Bit 16 STW 163 STW 164 STW 165 BCD Time of Day – Word 4 Second - Tenths Second - Hundredths Unused – Set to 0 Day of Week Remote I/O Channel Receive Errors Cumulative count of all RIO Receive Errors. Remote I/O Channel Timeout Errors Cumulative counts of all RIO Timeout Errors Number of DP-related Errors Counts all DP errors on the Profibus Channel. This includes timeouts, etc. Number of Token-related Errors Counts errors related to token passingon the Profibus channel. Not used SF Processor Fatal Errors ROM Error RAM Error OS Error Invalid Control Block Encountered Diagnostic Failure Unused S-Memory is inconsistent SF Program number from SF is invalid Unused SF Processor (Loop) Non-Fatal Errors Port 1 Communications Error Port 2 Communications Error Loops are Overrunning Analog Alarms are Overrunning Cyclic SF programs are overrunning Normal SF Queue is Full Priority SF Queue is Full Cyclic SF Queue is Full Error Occurred during loop calculation Error occurred during analog alarm calculation A control Block is disabled Attempt to execute undefined SFP or SFS Attempt to execute restricted SFPGM from RLL Unused Scan-time Error RLL Subroutine Stack Overflow Contains the number of the subroutine that caused a stack overflow L memory checksum C0 Contains checksum as a 32 bit unsigned integer Control Technology Inc. Sunday = Day 1 Reset on PLC restart and power cycle Reset on PLC restart and power cycle. Indicates problems with cables or station addressing/configuration. Reset on PLC restart and power cycle. Total failure of Profibus network, i.e., cable unplugged from PLC. Reset on PLC restart and power cycle. Set to 0 Set to 0 Set to 0 Not currently used The checksum algorithm is a Fletcher Checksum with two terms, C0 and C1. 2500 Series Training Course 1 Page 175 2500 Se STW 166 STW 167 L memory checksum C1 Contains checksum as a 32-bit unsigned integer STW 168 Dual Media RBC Status (Remote I/O) Status of 0 indicates that the base is present and configured with a redundant RBC Unused STW 169: STW 175 STW 176 STW 177: STW 183 STW 184 Bit 1 Bit 2-4 Bit 5 – 8 Bit 9 - 16 STW 185: STW 191 STW 192 STW 193: STW 199 STW 200 Page 176 The checksum shall be validated as part of runtime diagnostics. This checksum in on the “source” RLL, not the compiled RLL. LSB (bit 16) is the local base TBD: 505 testing Set to 0xFFFF Redundant Power Supply Status Status of 0 indicates that the base is present, dual supplies are present, and they are both good. Unused LSN (bit 16) is the local base Module Mismatch or Unclaimed MODFAIL signal (Channel 0) Unclaimed MODFAIL is not reported on PLCs that have Profibus I/O. Set to 1 if there is a module mismatch on any base Unused Number of base with mismatch Unused Unused Set to 0xFFFF Set to 0 The highest numbered base with the a mismatch will be indicated Set to 0 Time in msec Discrete Execution Scan Time Indicates the time spent in the last discrete scan Set to 0 COMAU PLC STATUS Not used User Program Error Cause Reason Code associated with STW1/Bit 6 and STW1/Bit 11. 0 No Error 1 Uninstalled Application Referenced (Not used) 2 Attempt to unlock a semaphore that is not held (Use TBD) 3 Mismatched LOCK/UNLOCK instructions 4 Subroutine nesting level exceeded 5 Table Overflow 6 Attempt to call a non-existent subroutine 7 VME bus access failed (timeout) (Not used) 8 SFPGM has not been compiled 9 SFPGM is currently disabled 10 SFPGM type is not Normal or Priority 11 S-Memory is busy, e.g. due to an edit operation 12 Invalid context for in-line SFPGM/SFSUB 13 User-scheduled fast loop is not configured 14 User scheduled fast loop is disabled 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C STW 201 User Program First Scan Flags Bit 1 First Scan After Compile Bit 2 Bit 3 First scan after Program Mode First scan after Edit Mode Bit 4 Bit 5 – 8 Bit 9 First scan after Auto Recompile Unused First Scan following a Battery Bad Power-up restart First Scan following a Battery Good Power-up restart (or power-on start) First Scan following a Complete Restart First Scan following a Partial Restart Unused Application Mode Flags Bit 10 Bit 11 Bit 12 Bit 13 – 16 STW 202: STW 203 STW 204: STW 204 STW 205: STW 206 STW 207: STW 208 STW 210 STW 211: STW 217 NOTE: These flags are cleared at the end of the first Main RLL scan. Set on first RUN or SINGLE SCAN after RLL program is compiled. Set on transition to PROGRAM mode Set on first RUN mode scan after a transition from EDIT mode. Set when Autocompile has completed Set to 0 Set at completion of restart Set at completion of restart Set at completion of restart Set at completion of restart Set to 0 Always set to 0 Application Installed Flags Always set to 0 U Memory Checksum C0 These words are currently unused. U memory Checksum C1 Remote I/O Base Poll Enable Flag Base 0 (local base) is in the LSB (Bit 1). Bases corresponding to a clear bit (0) shall not be polled. Flags shall be set to the default of 0xFFFF after a Clear PC or a battery bad Power Up restart (or a power cycle with battery bad). All other restarts leave this word unchanged. If the user selects RUN FROM ROM (flash), the contents of this status word shall be stored in flash also. NOTE: Run from Flash is TBD. Profibus Poll Enable Flags Polling applies to remote bases. When a base is not enabled, it will not be polled. Bases that are enabled but not configured will be polled in rotational sequence for a pending task code (SF I/O). A base that is failed but enabled and configured will be polled once per scan and logged-in if present and functional. External requests for Read Base or Base Diagnostics shall be performed independently of this status word. Poll bit shall be set equal to the “activated” bit of the corresponding slave S1_Flag. STW 218 STW 219 STW 220 Poll bits of undefined slaves shall be set to 0. My Application ID (575 Only) RLL Task Overrun The overrun status of each RLL task is indicated by a corresponding bit. Bit 1 corresponds to Task 1. This bit is set if the task does not complete in the user specified cycle time. Interrupting Slots on Backplane The contents of this word shall be established when the interrupt occurs. The bit shall be set for each module that has just asserted its interrupt to the CPU. All other bits are cleared. Control Technology Inc. Unused. Set to 0 The bit remains set until cleared by TC6A (Reset SF/LOOP errors) Applies only to Cyclic Task (TASK2) Unused in 2500 Series CPUs 2500 Series Training Course 1 Page 177 2500 Se STW 221 STW 222 STW 223 STW 224 STW 225 STW 226 Bit 1 Bit 2 – 9 Bit 10 Bit 11 Bit 12 - 13 Bit 14 Bit 15 Bit 16 STW 227: STW 228 STW 229: STW 230 STW 231 Bit 1 Bit 2 Bit 3 – 15 Bit 16 STW 232: STW 238 STW 239: STW 240 STW 241: STW 242 STW 243 Bit 1 Bit 2 – 8 Bit 9- 16 Page 178 Module Interrupt Count Incremented any time an interrupt is received from any interrupting module in the local base. Spurious Interrupt Count Binary Time of Day Contains the relative millisecond of the current data expressed as a 32-bit unsigned integer. Binary Relative Day Contains the relative day, with January 1, 1984 being day 0. Time of Day Status 1 = Current time is prior to time reported in the last Main RLL scan Reserved 1 = Time is Valid (has been set) 1 = Time is synchronized over a network Time Resolution 00 = Time Resolution is .001 second 01 = Time Resolution is .01 second 02 = Time Resolution is 0.1 second 03 = Time Resolution is 1 second Time synchronization error. Module has lost synchronization with network or has failed to request synchronization by the scheduled time No Time synchronization inputs. Reserved Bus Error Access Address (575 Only) Bus Error Program Offset (575 Only) Profibus I/O Status DP-mode set to OPERATE DP-mode set to CLEAR Unused. DP Bus Parameter Set is inactive Profibus I/O Slave Diagnostic Status The corresponding bit will be set to 1 if the slave signals a diagnostic that has not been read by a RSD RLL instruction. CS Memory Checksum C0 Unused in 2500 Series CPUs Incremented each time a spurious interrupt is received. Set for one scan when the current time is earlier than the previous clock value. Set to 0 Set when the PLC Clock is set to any value. Cleared on power cycle or PowerUp Reset when the battery is bad. Always set to 0 Always set to 01 = .01 second Always set to 0 Always set to 0 Set to 0 Always set to 0 Always set to 0 Set to 0 Slave ID 1 is in the LSB of the first word. CS Memory Checksum C1 Auto Recompile Status 1 = Auto-compile enabled Unused Auto Recompile Count Not used in 2500 Series CPUs 2500 Series Training Course 1 Control Technology Inc. 2500 Series Advanced C