Emerson PACSystems GFK-2950K Reference Manual

Emerson PACSystems GFK-2950K Reference Manual

Cpu programmer's
Table of Contents

Advertisement

Quick Links

CPU Programmer's Reference Manual
GFK-2950K
Feb 2023
PACSystems ™ CPU Programmer's
Reference Manual

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the PACSystems GFK-2950K and is the answer not in the manual?

Questions and answers

Summary of Contents for Emerson PACSystems GFK-2950K

  • Page 1 CPU Programmer’s Reference Manual GFK-2950K Feb 2023 PACSystems ™ CPU Programmer’s Reference Manual...
  • Page 2: Table Of Contents

    CPU Programmer’s Reference Manual Contents GFK-2950K Feb 2023 Contents Section 1 Introduction ............1 Revisions in this Manual ..................2 PACSystems Programming and Configuration ..........2 Migrating Series 90 Applications to PACSystems ..........3 PACSystems Documentation ................3 1.4.1 PACSystems Manuals ................. 3 1.4.2 RSTi-EP Manuals ..................
  • Page 3 CPU Programmer’s Reference Manual Contents GFK-2950K Feb 2023 Variables ....................... 33 3.1.1 Mapped Variables ..................33 3.1.2 Symbolic Variables ................... 33 3.1.3 I/O Variables ....................35 3.1.4 Arrays ......................38 3.1.5 Variable Indexes and Arrays ..............38 Reference Memory ....................42 3.2.1 Word (Register) References ..............
  • Page 4 CPU Programmer’s Reference Manual Contents GFK-2950K Feb 2023 4.1.1 Exponential/Logarithmic Functions ............71 4.1.2 Square Root ....................72 4.1.3 Trig Functions ................... 74 4.1.4 Inverse Trig – ASIN, ACOS, and ATAN ............ 75 Bit Operation Functions ..................76 4.2.1 Data Lengths for the Bit Operation Functions ........78 4.2.2 Bit Position ....................
  • Page 5 CPU Programmer’s Reference Manual Contents GFK-2950K Feb 2023 4.5.5 Mask I/O Interrupt ................136 4.5.6 Read Switch Position ................137 4.5.7 Scan Set IO....................138 4.5.8 Suspend I/O .................... 140 4.5.9 Suspend or Resume I/O Interrupt ............142 Conversion Functions ..................143 4.6.1 Convert Angles ..................
  • Page 6 CPU Programmer’s Reference Manual Contents GFK-2950K Feb 2023 4.8.12 Move Data ....................191 4.8.13 Move Data Explicit ................. 192 4.8.14 Move From Flat ..................193 4.8.15 Move to Flat .................... 195 4.8.16 Shift Register ..................197 4.8.17 Size Of ..................... 199 4.8.18 Swap ......................
  • Page 7 CPU Programmer’s Reference Manual Contents GFK-2950K Feb 2023 4.11.5 Master Control Relay/End Master Control Relay ......241 4.11.6 Wires ......................243 4.12 Relational Functions..................244 4.12.1 Compare ....................245 4.12.2 Equal, Not Equal, Greater or Equal, Greater Than, Less or Equal, Less Than 4.12.3 EQ_DATA ....................
  • Page 8 CPU Programmer’s Reference Manual Contents GFK-2950K Feb 2023 5.9.5 Multiply ....................300 5.9.6 Negate ..................... 301 5.9.7 Subtract ....................302 5.10 Program Flow Functions ................. 304 5.11 Timers ........................ 305 5.11.1 Built-in Timer Function Blocks ............. 305 5.11.2 Standard Timer Function Blocks ............306 5.12 Type Conversion Functions ................
  • Page 9 CPU Programmer’s Reference Manual Contents GFK-2950K Feb 2023 6.6.1 To disable the Background Task window: ......... 323 6.6.2 To enable the Background Task window mode: ....... 323 SVC_REQ 6: Change/Read Number of Words to Checksum....... 325 6.7.1 To read the word count: ............... 325 6.7.2 To set a new word count: ..............
  • Page 10 CPU Programmer’s Reference Manual Contents GFK-2950K Feb 2023 6.32.2 Restoring data values on CPE200 Series ..........377 6.32.3 Storage Disabled Conditions ............... 377 6.32.4 Maximum of One Active Instruction ........... 378 6.32.5 ENO and Power Flow To The Right ............. 378 6.32.6 Parameter Block ..................
  • Page 11 CPU Programmer’s Reference Manual Contents GFK-2950K Feb 2023 Reference Array for the PID Function ............400 7.2.1 Scaling Input and Outputs ..............400 7.2.2 Reference Array Parameters ..............401 Operation of the PID Function ............... 407 7.3.1 Automatic Operation ................407 7.3.2 Manual Operation .................
  • Page 12 CPU Programmer’s Reference Manual Contents GFK-2950K Feb 2023 8.2.4 IF Statement ................... 431 8.2.5 CASE Statement ..................433 8.2.6 FOR … DO Statements ................435 8.2.7 WHILE Statement ................... 437 8.2.8 REPEAT Statement ................. 438 8.2.9 ARG_PRES Statement ................439 8.2.10 Exit Statement ..................
  • Page 13 CPU Programmer’s Reference Manual Contents GFK-2950K Feb 2023 9.4.11 Program or Block Checksum Failure (Group 17) ......473 9.4.12 Battery Status (Group 18) ..............474 9.4.13 Constant Sweep Time Exceeded (Group 19) ........475 9.4.14 System Fault Table Full (Group 20) ............. 475 9.4.15 I/O Fault Table Full (Group 21).............
  • Page 14 CPU Programmer’s Reference Manual Contents GFK-2950K Feb 2023 9.5.16 Extra Block (Category 17) ..............505 9.5.17 IOC Hardware Failure (Category 18) ........... 505 9.5.18 GBC Stopped Reporting Faults (Category 19) ........506 9.5.19 GBC Software Exception (Category 21) ..........506 9.5.20 Block Switch (Category 22) ..............
  • Page 15 These instructions do not purport to cover all details or variations in equipment, nor to provide for every possible contingency to be met during installation, operation, and maintenance. The information is supplied for informational purposes only, and Emerson makes no warranty as to the accuracy of the information included herein. Changes, modifications, and/or improvements to equipment and specifications are made periodically and these changes may or may not be reflected herein.
  • Page 16: Introduction

    CPU Programmer’s Reference Manual Section 1 GFK-2950K Feb 2023 Section 1 Introduction This manual contains general information about programming a PACSystems CPU. It also provides detailed descriptions of specific programming requirements. For a general introduction to the PACSystems family of products, including new features, product overviews, and specifications, see PACSystems RX3i and RSTi-EP CPU Reference Manual, GFK-2222.
  • Page 17: Revisions In This Manual

    Updates to Section 6.33.2, Write Frequency Secure Remote STOP-Halt Restart Mechanism. Updates to the %S reference table, Section 3.8.1. 2020 Following Emerson’s acquisition of this product, changes have been • made to apply appropriate branding and registration of the product with Nov 2019 required certification agencies.
  • Page 18: Migrating Series 90 Applications To Pacsystems

    CPU Programmer’s Reference Manual Section 1 GFK-2950K Feb 2023 Machine Edition programming software provides a universal engineering development environment for all programming, configuration and diagnostics of PACSystems. A PACSystems CPU is programmed and configured using the programming software to perform process and discrete automation for various applications.
  • Page 19: Rsti-Ep Manuals

    CPU Programmer’s Reference Manual Section 1 GFK-2950K Feb 2023 PACSystems Battery and Energy Pack Manual GFK-2741 PAC Machine Edition Logic Developer Getting Started GFK-1918 Proficy Process Systems Getting Started Guide GFK-2487 PACSystems RXi, RX3i, RX7i and RSTi-EP Controller Secure GFK-2830 Deployment Guide PACSystems RX3i &...
  • Page 20: Distributed I/O Systems Manuals

    GEK-90486-1 Genius I/O Analog and Discrete Blocks User’s Manual GEK-90486-2 In addition to these manuals, datasheets and product update documents describe individual modules and product revisions. The most recent PACSystems documentation is available on the Emerson support website https://www.emerson.com/Industrial-Automation-Controls/support. Introduction...
  • Page 21: Program Organization

    CPU Programmer’s Reference Manual Section 2 GFK-2950K Feb 2023 Section 2 Program Organization This chapter provides information about the operation of application programs in a PACSystems CPU. Structure of a PACSystems Application Program • Controlling Program Execution • Interrupt-Driven Blocks •...
  • Page 22: Functions And Function Blocks

    CPU Programmer’s Reference Manual Section 2 GFK-2950K Feb 2023 2.1.2 Functions and Function Blocks A function is a type of instruction that has no internal storage (instance data). Therefore, it produces the same result for the same set of input values every time it executes.
  • Page 23: Nested Calls

    CPU Programmer’s Reference Manual Section 2 GFK-2950K Feb 2023 2.1.4 Nested Calls The CPU allows nested block calls as long as there is enough execution stack space to support the call. If there is not enough stack space to support a given block call, an Application Stack Overflow fault is logged.
  • Page 24: Program Blocks

    CPU Programmer’s Reference Manual Section 2 GFK-2950K Feb 2023 the block call instruction when the block completes execution, unless Y0 is set to FALSE within the logic of the block. For all block types, the maximum number of input parameters is one less than the maximum number of output parameters.
  • Page 25 CPU Programmer’s Reference Manual Section 2 GFK-2950K Feb 2023 Parameterized Blocks Any block except _MAIN can be a parameterized block. When you declare a parameterized block, you must assign it a unique block name. A parameterized block can be configured with up to 63 input and 64 output parameters. A parameterized block executes when called from the program logic in the _MAIN block, another block, or itself.
  • Page 26 CPU Programmer’s Reference Manual Section 2 GFK-2950K Feb 2023 The following table lists the TYPEs, LENGTHs, and parameter-passing mechanisms allowed for parameterized block parameters (For definitions of the parameter passing types, refer to Parameter Passing Mechanisms.). Type Length Default Parameter Passing Mechanism INPUTS: by reference BOOL 1 to 256...
  • Page 27 CPU Programmer’s Reference Manual Section 2 GFK-2950K Feb 2023 to be %R10, and %R10 is passed in as the argument to the block. During execution of the block, the argument remains as %R10, regardless of whether the value in %R1 changes. In general, formal parameters within a parameterized block may be used with any instruction or with any block call, if their TYPE and LENGTH are compatible with what the instruction, function, or block call requires.
  • Page 28 CPU Programmer’s Reference Manual Section 2 GFK-2950K Feb 2023 Defining a UDFB To create a UDFB in the programming software, create an LD, FBD or ST block in the Program Blocks folder. In the Properties for the block, select Function Block. To define instance data for a UDFB, select Parameters in the block’s properties.
  • Page 29 CPU Programmer’s Reference Manual Section 2 GFK-2950K Feb 2023 Figure 6 Use of User-Defined Function Block in Ladder Logic Instance Data Structures A variable with the format function_block_name.instance_name is automatically created for each instance of a UDFB. The instance data makes up a single composite variable that is of a structure type.
  • Page 30 CPU Programmer’s Reference Manual Section 2 GFK-2950K Feb 2023 UDFBs and Scope Unlike a parameterized subroutine, a UDFB has its own %L memory. By default, internal variables of a UDFB have local scope, making them visible only to the logic inside the UDFB. They cannot be read or written by any external logic or by the hardware configuration.
  • Page 31 CPU Programmer’s Reference Manual Section 2 GFK-2950K Feb 2023 Type Length Parameter Passing Retentiveness of Mechanism Instance Data for Parameters DINT, REAL, and 1 to 256 INPUTS: by reference, constant Retentive for value or value DWORD reference, value, or value result. result.
  • Page 32 CPU Programmer’s Reference Manual Section 2 GFK-2950K Feb 2023 A UDFB type. Such member variables are known as nested instances. For • example, the function block Motor can have an internal variable of type Valve, where Valve is a UDFB type. Note that defining a member variable as a UDFB type does not create an instance.
  • Page 33 CPU Programmer’s Reference Manual Section 2 GFK-2950K Feb 2023 be written to by their UDFB logic. Note that the restriction on writing to input parameters passed by value does not apply to other types of blocks. All UDFB output parameters can be both read and written to by their logic. UDFB Operation with Other Blocks A UDFB instance that is of global scope can be invoked by another UDFB’s logic or any other block’s logic.
  • Page 34 CPU Programmer’s Reference Manual Section 2 GFK-2950K Feb 2023 Figure 8: Calling an External Block in Ladder Logic Note: Unlike other block types, external blocks cannot call other blocks. External Blocks and Local Data External blocks support the use of %P global data. External blocks do not have their own %L data, but instead inherit the %L data of their calling blocks.
  • Page 35: Local Data

    CPU Programmer’s Reference Manual Section 2 GFK-2950K Feb 2023 Type Length Default Parameter Passing Mechanism BOOL 1 to 256 INPUTS: by reference OUTPUTS: by reference; except Y0, which is by initial-value result BYTE 1 to 1024 INPUTS: by reference OUTPUTS: by reference INT, UINT, and 1 to 512 INPUTS: by reference...
  • Page 36: Parameter Passing Mechanisms

    CPU Programmer’s Reference Manual Section 2 GFK-2950K Feb 2023 Figure 9: Relationship of %L & %P to Program Blocks All blocks within the program can use data associated with the _MAIN block (%P). Blocks and UDFBs can use their own %L data as well as the %P data that is available to all blocks.
  • Page 37 CPU Programmer’s Reference Manual Section 2 GFK-2950K Feb 2023 PACSystems supports the following parameter-passing mechanisms: pass by reference, pass by constant reference, pass by value, pass by value result, pass by result and pass by initial-value result. An additional type, pass by friend, is available when the input Data Type is a UDFB.
  • Page 38 CPU Programmer’s Reference Manual Section 2 GFK-2950K Feb 2023 In the logic of a UDFB, when you want to pass the UDFB as a friend, assign the pseudo- variable #This to the input that expects an instance variable of that UDFB type. In the following example, the In2 input of the LDPSB parameterized block expects a UDFB instance variable friend of the ABC data type.
  • Page 39: Languages

    CPU Programmer’s Reference Manual Section 2 GFK-2950K Feb 2023 2.1.8 Languages Ladder Diagram (LD) Logic written in Ladder Diagram language consists of a sequence of rungs that execute from top to bottom. The logic execution is thought of as power flow, which proceeds down along the left rail of the ladder, and from left to right along each rung in sequence.
  • Page 40: Function Block Diagram

    CPU Programmer’s Reference Manual Section 2 GFK-2950K Feb 2023 Function Block Diagram Function Block Diagram (FBD) is an IEC 61131-3 graphical programming language that represents the behavior of functions, function blocks and programs as a set of interconnected graphical blocks. FBD depicts a system in terms of the flow of signals between processing elements, in a manner very similar to signal flows depicted in electronic circuit diagrams.
  • Page 41: Controlling Program Execution

    CPU Programmer’s Reference Manual Section 2 GFK-2950K Feb 2023 If the previous instruction can be resolved, the compiler calculates the output. The output of the previous instruction then becomes the input to the current instruction, the current instruction is resolved, and scanning continues for the next instruction.
  • Page 42: Interrupt-Driven Blocks

    CPU Programmer’s Reference Manual Section 2 GFK-2950K Feb 2023 The Suspend I/O function can be used to stop both the input scan and output • scan for one sweep. I/O can be updated, as necessary, during the logic execution using DO I/O instructions. The Service Request function can be used to suspend or change the time allotted •...
  • Page 43 CPU Programmer’s Reference Manual Section 2 GFK-2950K Feb 2023 Interrupt Block Scheduling. If a parameterized block or external block is triggered by an interrupt, it inherits %P data as its %L local data. For example, a %L00005 reference in the parameterized block or C block actually references %P00005.
  • Page 44: Timed Interrupts

    CPU Programmer’s Reference Manual Section 2 GFK-2950K Feb 2023 2.3.2 Timed Interrupts A block can be configured to execute on a specified time interval with an initial delay (if specified) applied on a STOP Mode to RUN Mode transition of the CPU. To configure a timed interrupt block, specify the following parameters in the scheduling properties for the block: Time Base...
  • Page 45: Interrupt Block Scheduling

    CPU Programmer’s Reference Manual Section 2 GFK-2950K Feb 2023 2.3.5 Interrupt Block Scheduling You can select one of two types of interrupt block scheduling at the target level: Normal block scheduling allows you to associate a maximum of 64 I/O and •...
  • Page 46 CPU Programmer’s Reference Manual Section 2 GFK-2950K Feb 2023 If an incoming interrupt has a lower priority than the interrupt associated with • the block that is currently executing, the incoming interrupt is placed in the queue. When the CPU completes the execution of an interrupt block, the block associated with the interrupt trigger that has the highest priority in the queue begins execution —...
  • Page 47: Program Data

    CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 Section 3 Program Data This chapter describes the types of data that can be used in an application program and explains how that data is stored in the PACSystems CPU’s memory. Variables •...
  • Page 48: Variables

    CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 Variables A variable is a named storage space for data values. It represents a memory location in the target PACSystems CPU. A variable can be mapped to a reference address (for example, %R00001). If you do not map a variable to a specific reference address, it is considered a symbolic variable.
  • Page 49 CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 The memory required to support symbolic variables counts against user space. The amount of space reserved for these variables is configured on the Memory tab in the CPU hardware configuration. Restrictions on the Use of Symbolic Variables Symbolic variables cannot be used with indirect references (for example, •...
  • Page 50: I/O Variables

    CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 3.1.3 I/O Variables An I/O variable is a symbolic variable that is mapped to a terminal in the hardware configuration. A terminal can be one of the following: Physical discrete or analog I/O point on a PACSystems module or on a Genius device, a discrete or analog status returned from a PACSystems module, or Global Data.
  • Page 51 CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 Restrictions on the Use of I/O Variables Since I/O variables are a form of symbolic variable, the same restrictions that apply to • other symbolic variables of the same data type and array bounds apply to I/O variables. Only a global variable can become an I/O variable.
  • Page 52 CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 Supported I/O Variable Types Data Type Supported Data Number of Consecutive Terminals Mnemonic Types Required BOOL variable BOOL array Number of elements in array. BYTE variable BYTE array 8n, where n is the number of array elements. DINT variable DINT array Number of elements in array times 2...
  • Page 53: Arrays

    CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 3.1.4 Arrays An array is a complex data type composed of a series of variable elements with identical data types. Any variable can become an array, except for another array, a variable element, or a UDFB.
  • Page 54 CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 Array element with a constant index • Array element with a variable index • Alias variable • In the logic of a UDFB or parameterized block: formal parameter • The following support a variable index: Array elements of any data type except STRING •...
  • Page 55 CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 Where Array Elements with Variable Indexes are Not Supported: The following do not support array elements with variable indexes: Indirect references • EGD variables • Reference ID variables (RIVs) and I/O variables when accessed in the Hardware •...
  • Page 56 CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 Ensuring that a Variable Index does not Exceed the Upper Boundary of an Array One-Dimensional Array Once per scan, execute ARRAY_SIZE_DIM1 to count the number of elements in the array. Note: The array size of a variable can be changed in a RUN Mode Store but it will not be changed while logic is executing.
  • Page 57: Reference Memory

    CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 Reference Memory The CPU stores program data in bit memory and word memory. Both types of memory are divided into different types with specific characteristics. By convention, each type is normally used for a specific type of data, as explained below. However, there is great flexibility in actual memory assignment.
  • Page 58 CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 Indirect references can be useful when you want to perform the same operation to many word registers. Use of indirect references can also be used to avoid repetitious logic within the application program. They can be used in loop situations where each register is incremented by a constant or by a value specified until a maximum is reached.
  • Page 59 CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 Examples: %R2.X [0] addresses the first (least significant) bit of %R2 %R2.X [1] addresses the second bit of %R2. In the examples In the examples [0] and [1] are the bit indexes. Valid bit indexes for the different variable types are: BYTE variable [0] through [7]...
  • Page 60: Bit (Discrete) References

    CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 3.2.2 Bit (Discrete) References Type Description Represents input references. %I reference are located in the input status table, which stores the state of all inputs received from input modules during the last input scan. A reference address is assigned to discrete input modules using your programming software.
  • Page 61: User Reference Size And Default

    CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 User Reference Size and Default Maximum user references and default reference sizes are listed in the table below. Item Range Default EPXCPE205 EPXCPE210 EPXCPE215 EPXCPE220 EPXCPE240 Reference Points %I reference 1024 2048 2048 4096...
  • Page 62: G User References And Cpu Memory Locations

    CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 3.3.1 %G User References and CPU Memory Locations The CPU contains one data space for all the global data references (%G). The internal CPU memory for this data is 7680 bits long. For Series 90-70 systems, the programming software subdivides this range using %G, %GA, %GB, %GC, %GD, and %GE prefixes—allowing each of these prefixes to be used with bit offsets in the range 1–1280.
  • Page 63: Retentiveness Of Logic And Data

    CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 Retentiveness of Logic and Data Data is defined as retentive if it is saved by the CPU when the CPU transitions from STOP Mode to RUN Mode. The following items are retentive: program logic •...
  • Page 64: Data Scope

    CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 Data Scope Each of the user references has scope; that is, it may be available throughout the system, available to all programs, restricted to a single program, or restricted to local use within a block. User Reference Type Range Scope...
  • Page 65: System Status References

    CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 System Status References System status references in the CPU are assigned to %S, %SA, %SB, and %SC memory. The four timed contacts (time tick references) include #T_10MS, #T_100MS, #T_SEC, and #T_MIN. Examples of other system status references include #FST_SCN, #ALW_ON, and #ALW_OFF Note: %S bits are read-only bits;...
  • Page 66 CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 Reference System Variable Definition %S0012 #FRC_PRE Set when force exists on a Genius point. %S0013 #PRG_CHK Set when background program check is active. %S0014 #PLC_BAT CPUs with batteries, including CPU310, CPU315, CPU/CRU320 and NIU001 If the battery is disconnected, this contact is set to 1.
  • Page 67: Sa, %Sb, And %Sc References

    CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 Reference System Variable Definition %S0051 #DATA_SRC Set to 1 if the CPU reference data is retrieved from Flash (R9.98 and later) memory during last powerup. If set to 0, the CPU reference data was retrieved from RAM or was not retrieved.
  • Page 68 CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 Reference System Definition Variable %SA0008 #OVR_TMP Set when the operating temperature of the CPU exceeds the normal operating temperature, 58ºC. To clear this bit, clear the CPU fault table or power cycle the CPU. %SA0010 #HRD_CPU Set when the diagnostics detects a problem with the CPU hardware.
  • Page 69 CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 Reference System Definition Variable %SA0032 #SBUS_ER Set when a bus error occurs on the VME bus backplane. To clear this bit, clear the I/O Fault Table or power cycle the CPU. %SA0081 –...
  • Page 70 CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 Reference System Definition Variable %SC0014 #HRD_FLT Set when a hardware fault occurs. Cleared when both fault tables are cleared or when the CPU is power cycled. %SC0015 #SFT_FLT Set when a software fault occurs. Cleared when both fault tables are cleared or when the CPU is power cycled.
  • Page 71: Fault References

    CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 3.8.3 Fault References The fault references are discussed in Section 9 of this manual but are also listed here for your convenience. System Fault References System Fault Description #ANY_FLT Any new fault in either table since the last power-up or clearing of the fault tables #SY_FLT Any new system fault in the CPU fault table since the last power-up or clearing...
  • Page 72 CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 Non-Configurable Faults Non-Configurable Faults (Action) Description #SBUS_FL (fatal) System bus failure. The CPU was not able to access the VME bus. BUSGRT- NMI error. #HRD_CPU (fatal) CPU hardware fault, such as failed memory device or failed serial port. #HRD_SIO (diagnostic) Non-fatal hardware fault on any module in the system.
  • Page 73: How Program Functions Handle Numerical Data

    CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 How Program Functions Handle Numerical Data Regardless of where data is stored in memory – in one of the bit memories or one of the word memories – the application program can handle it as different data types.
  • Page 74: Floating Point Numbers

    CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 Type Name Description Data Format LREAL Double Uses consecutive bits (four Precision consecutive 16-bit memory Floating Point locations). The range of numbers that can be stored this format from ±2.2250738585072020E-308 ±1.7976931348623157E+308. For the IEEE format, refer to Floating Point Numbers.
  • Page 75 CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 variables are typically used to store data from analog I/O devices, calculated values, and constants. Types of Floating-Point Variables Data Type Precision and Range REAL Limited to 6 or 7 significant digits, with a range of approximately ±1.401298x10 through ±3.402823x10 LREAL Limited...
  • Page 76 CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 Internal Format of LREAL Numbers Figure 19 Errors in Floating Point Numbers and Operations Overflow occurs when a REAL or LREAL function generates a number outside the allowed range. When this occurs, the Enable Out output of the function is set Off, and the result is set to positive infinity (for a number greater than the upper limit) or negative infinity (for a number less than the lower limit).
  • Page 77: User Defined Types (Udts)

    CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 3.10 User Defined Types (UDTs) A UDT is a structured data type consisting of elements of other selected data types. Each top-level UDT element can be one of the following: Top-level UDT Element Example Simple data type, except STRING Another UDT, except any in which the current...
  • Page 78: Udt Properties

    CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 3.10.2 UDT Properties Name: The UDT’s name. Maximum length: 32 characters. Description: The user-defined description of the UDT. Memory Type: The type of symbolic or I/O variable memory in which a variable of this UDT resides.
  • Page 79: Udt Limits

    CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 3.10.3 UDT Limits Maximum number of UDTs per target: 2048 • Maximum UDT size: 65,535 bytes • Note: Bit spares created to line up the end of a section of BOOL variables or arrays with the end of a byte will count toward the maximum size.
  • Page 80: Udt Operational Notes

    CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 3.10.5 UDT Operational Notes By default, a UDT variable resides in symbolic memory. You can convert the • symbolic variable to an I/O variable. All UDT elements are public and, therefore, readable and writeable. •...
  • Page 81: Operands For Instructions

    CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 Issue the COMMREQs based on the % memory registers that you just populated with the Move to Flat instruction. Although you can populate the memory registers directly without a UDT and Move to Flat, there are advantages when working with UDT variables: UDT variables reside in symbolic or I/O variable memory, which protects them •...
  • Page 82 CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 stored in a temporary memory and any updated value assigned to it would be inaccessible to the user application. The arguments to EN, OK, and many other BOOLEAN input and output •...
  • Page 83: Word-For-Word Changes

    CPU Programmer’s Reference Manual Section 3 GFK-2950K Feb 2023 3.12 Word-for-Word Changes Many changes to the program that do not modify the size of the program are considered word-for-word changes. Examples include changing the type of contact or coil or changing a reference address used for an existing function block. The following are word-for-word changes: Switching between two symbolic variables •...
  • Page 84: Ladder Diagram (Ld) Programming

    CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Section 4 Ladder Diagram (LD) Programming This chapter describes the programming instructions that can be used to create ladder logic programs for the PACSystems control system. For an overview of the types of operands that can be used with instructions, refer to Operands for Instructions in Section 3.
  • Page 85: Advanced Math Functions

    CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Advanced Math Functions The Advanced Math functions perform logarithmic, exponential, square root, trigonometric, and inverse trigonometric operations. Function Mnemonic Description Exponential EXP_REAL Raises e to the value specified in IN (e ).
  • Page 86 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.1.1 Exponential/Logarithmic Functions When an exponential or logarithmic function receives power flow, it performs the appropriate operation on the REAL or LREAL input value(s) and places the result in output Q. The inverse natural log (EXP) function raises e to the power specified by IN.
  • Page 87: Square Root

    CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Operands of the Exponential/Logarithmic Functions Parameter Description Allowed Optional Operands IN or IN1 For EXP, LOG, and LN, IN contains the REAL or except variables LREAL value to be operated on. located in %S—%SC The EXPT function has two inputs, IN1 and IN2.
  • Page 88 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Example The square root of the integer number located at %AI0001 is placed into %R00003 when %I00001 is ON. Figure 21 Operands for the Square Root Function Parameter Description Allowed Operands Optional The value to calculate the square root All except variables located in %S...
  • Page 89: Trig Functions

    CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.1.3 Trig Functions Mnemonics: SIN_REAL SIN_LREAL COS_REAL COS_LREAL TAN_REAL TAN_LREAL The SIN, COS, and TAN functions are used to find the trigonometric sine, cosine, and tangent, respectively, of an input whose units are radians. When one of these functions receives power flow, it computes the sine (or cosine or tangent) of IN and stores the result in output Q.
  • Page 90 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.1.4 Inverse Trig – ASIN, ACOS, and ATAN Mnemonics: ASIN_REAL ASIN_LREAL ACOS_REAL ACOS_LREAL ATAN_REAL ATAN_LREAL When an Inverse Sine (ASIN), Inverse Cosine (ACOS), or Inverse Tangent (ATAN) function receives power flow, it respectively computes the inverse sine, inverse cosine or inverse tangent of IN and stores the result in radians in output Q.
  • Page 91 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Parameter Description Allowed Operands Optional The REAL or LREAL value to process. All except variables located in %S - %SC ASIN and ACOS: -1  IN  1 ATAN: – ∞ ≤ IN ≤ + ∞ Trigonometric value of IN.
  • Page 92 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Function Mnemonics Description Rotate Bits ROL_DWORD Rotate Left. Rotates all the bits in a string a specified number of places to the left. ROL_WORD ROR_DWORD Rotate Right. Rotates all the bits in a string a specified number of places to the right.
  • Page 93: Bit Position

    CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.2.1 Data Lengths for the Bit Operation Functions The Bit Operation functions operate on a single WORD or DWORD of data or up to 256 WORDs or DWORDs that occupy adjacent memory locations. Bit Operation functions treat the WORD or DWORD data as a continuous string of bits, with bit 1 of the first WORD or DWORD being the Least Significant Bit (LSB).
  • Page 94 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 POS is set to the position within the bit string of the first non-zero bit; POS is set to zero if no non-zero bit is found. A string length of 1 to 256 WORDs or DWORDs can be selected. The function passes power flow to the right whenever it receives power.
  • Page 95 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.2.3 Bit Sequencer The Bit Sequencer (BIT_SEQ) function performs a bit sequence shift through a series of contiguous bits. The operation of BIT_SEQ depends on the value of the reset input (R), and both the current value and previous value of the enabling power flow input (EN): Figure 26 R Current...
  • Page 96 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 BIT_SEQ passes power to the right whenever it receives power. Note: • Before using the BIT_SEQUENCER function block, the current step number (Word 1 in the control block) must be set to an integer value between 1 and the length, as defined in the function block properties.
  • Page 97 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Operands for Bit Sequencer WARNING Do not write to the Control Block memory with other instructions. Overlapping references may cause erratic operation of BIT_SEQ. Parameter Description Allowed Optional Operands Address (????) Beginning address of the Control Block, which is Symbolic variables, a three-word array:...
  • Page 98 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Example In the following example, a #FST_SCN system variable is used to set CLEAR to ON for one scan. This sets the step number in Word 1 of the Bit Sequencer’s control block to an initial value of 3.
  • Page 99 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 the transition information for that bit is updated. The transition status of all the other bits in the bit string is not affected. The function passes power flow to the right, unless the value for BIT is outside the specified range.
  • Page 100 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.2.5 Bit Test Figure 31 When the Bit Test function receives power flow, it tests a bit within a bit string to determine whether that bit is currently 1 or 0. The result of the test is placed in output Q.
  • Page 101 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Example 1 Figure 32 When input V_I0001 is set, the bit at the location contained in reference PICKBIT is tested. The bit is part of string PRD_CDE. If it is 1, output Q passes power flow to the ADD function, causing 1 to be added to the current value of the ADD function input IN1.
  • Page 102 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Logical AND If both bits examined by the Logical AND function are 1, AND places a 1 in the corresponding location in output string Q. If either bit is 0 or both bits are 0, AND places a 0 in string Q in that location.
  • Page 103 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Tip for Logical XOR • If string IN2 and output string Q begin at the same reference, a 1 placed in string IN1 will cause the corresponding bit in string IN2 to alternate between 0 and 1, changing state with each scan if power is received.
  • Page 104 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Example: Logical AND When input v_I0001 is set, the 16-bit strings represented by variables WORD1 and WORD2 are examined. The logical AND places the results in output string RESULT. Figure 35 Example: Logical XOR Whenever V_I0001 is set, the bit string represented by the variable WORD3 is cleared (set to all zeroes).
  • Page 105 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 When the Logical Not or Logical Invert (NOT) function receives power flow, it sets the state of each bit in the output bit string Q to the opposite of the state of the corresponding bit in bit string IN1.
  • Page 106 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 The Masked Compare (MASK_COMP_DWORD and MASK_COMP_WORD) function compares the contents of two-bit strings. It provides the ability to mask selected bits. Input string 1 might contain the states of outputs such as solenoids or motor starters.
  • Page 107 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Sets the corresponding mask bit in M to 1. Sets the miscompare (MC) output to 1. Updates the output bit string Q to match the new content of mask string Sets the bit number output (BN) to the number of the miscompared bit. Stops the comparison.
  • Page 108 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Masked Compare Example 1 Figure 40 When %I00001 is set, MASK_COMP_WORD compares the bits represented by the reference VALUES against the bits represented by the reference EXPECT. Comparison begins at BITNUM+1. If an unmasked miscompare is detected, the comparison stops.
  • Page 109 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Masked Compare Example 2 Figure 41 On the first scan, the Masked Compare Word function executes. %M0001 through %M0016 is compared with %M0017 through %M0032. %M0033 through %M0048 contains the mask value. The value in %R0001 determines the bit position in the two input strings where the comparison starts.
  • Page 110 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 The #FST_SCN contact forces one and only one execution; otherwise, the function would repeat with possibly unexpected results. 4.2.9 Rotate Bits Mnemonics: ROL_DWORD ROL_WORD ROR_DWORD ROR_WORD When receiving power flow, the Rotate Bits Right (ROR_DWORD and ROR_WORD) and Rotate Bits Left (ROL_DWORD and ROL_WORD) functions rotate all the bits in a string of WORDs or DWORDs N positions respectively to the right or to the left.
  • Page 111: Shift Left

    CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Example Figure 43 Whenever input V_I0001 is set, the input bit string in location %R0001 is rotated left 3 bits and the result is placed in %R00002. The actual input bit string %R0001 is left unchanged.
  • Page 112: Shift Right

    CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Shift Right When the Shift Right (SHIFTR_WORD) function receives power flow, it shifts all the bits in a word or group of words a specified number of places to the right (N). When the shift occurs, the specified number of bits is shifted out of the output string to the right.
  • Page 113 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Operands for Shift Left, Shift Right, Shift Left and Shift Right Parameter Description Allowed Operands Optional Length (??) The number of WORDs or DWORDs in the Constants. string. 1  Length  256. The string of WORDs or DWORDs to shift All.
  • Page 114 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Coils Coils are used to control the discrete (BOOL) references assigned to them. Conditional logic must be used to control the flow of power to a coil. Coils cause action directly. They do not pass power flow to the right. If additional logic in the program should be executed as a result of the coil condition, you can use an internal reference for the coil or a continuation coil/contact combination.
  • Page 115: Negated Coil

    CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Valid memory areas: %I, %Q, %M, %T, %SA - %SC, and %G. Symbolic discrete variables are permitted. Bit-in-word references on any word-oriented memory except %AI, including symbolic non-discrete memory, are also permitted. Continuation Coil Figure 49 A continuation coil instructs the PLC to continue the present rung's LD logic power...
  • Page 116 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.3.3 Set Coil, Reset Coil Figure 51 The SET and RESET coils can be used to keep (i.e. latch) the state of a reference either ON or OFF. WARNING SET / RESET coils write an undefined result to the transition bit for the given reference. This result differs from that written by Series 90-70 CPUs and could change for future PACSystems CPU models.
  • Page 117 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Example of Set Coil, Reset Coil Figure 52 The coil represented by E1 is turned ON when reference E2 or E6 is ON and is turned OFF when reference E5 or E3 is ON 4.3.4 Transition Coils PACSystems controllers provide four transition coils: PTCOIL, NTCOIL, POSCOIL,...
  • Page 118 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 POSCOIL and NEGCOIL WARNING These transition coil instructions should not be used in a parameterized block or user- • defined function block (UDFB) with a parameter or member. In these cases, an R_TRIG or F_TRIG should be used instead.
  • Page 119 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Example for POSCOIL and NEGCOIL When reference E1 goes from OFF to ON, coils E2 and E3 receive power flow, turning E2 ON. When E1 goes from ON to OFF, power flow is removed from E2 and E3, turning coil E3 ON.
  • Page 120 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Positive Transition Coil (PTCOIL) Negative Transition Coil (NTCOIL) the transition bit is OFF, and the transition bit is OFF, and • • the input power flow is ON the input power flow is OFF •...
  • Page 121 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 POSCOIL If a POSCOIL is used in place of the PTCOIL in the example below (keeping the rest of the logic identical and same alternation of power flow into the POSCOIL), the behavior of the logic will be different.
  • Page 122 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Contact Display Mnemonic Contact Passes Power to Right... Normally Closed NCCON if associated BOOL variable is OFF Contact Normally Open NOCON if associated BOOL variable is ON Contact Transition NEGCON (negative transition contact) if BOOL reference Contacts transitions from ON to OFF.
  • Page 123: Fault Contact

    CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.4.2 Fault Contact Figure 56 A Fault contact (FAULT) detects faults in discrete or analog reference addresses, or locates faults (rack, slot, bus, module). To guarantee correct indication of module status, use the reference address (%I, •...
  • Page 124 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.4.3 High and Low Alarm Contacts Figure 57 The high alarm contact (HIALR) is used to detect a high alarm associated with an analog reference. Use of this contact and the low alarm contact must be enabled during CPU configuration.
  • Page 125 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.4.4 No Fault Contact Figure 58 A No Fault (NOFLT) contact detects faults in discrete or analog reference addresses, or locates faults (rack, slot, bus, module). NOFLT passes power flow if its associated variable or location does not have a point fault.
  • Page 126 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.4.5 Normally Closed and Normally Open Contacts Figure 59 A normally closed contact (NCCON) acts as a switch that passes power flow if the BOOLV operand is OFF (false, 0). A normally open contact (NOCON) acts as a switch that passes power flow if the BOOLV operand is ON (true, 1).
  • Page 127 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.4.6 Transition Contacts PACSystems controllers provide four transition contacts: POSCON, NEGCON, PTCON and NTCON. The power flow out of the POSCON and NEGCON transition contacts is • determined by the last write to the BOOL variable associated with the contact. The associated transition bit is updated every time the function is called.
  • Page 128 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Positive Transition Contact POSCON Negative Transition Contact NEGCON POSCON starts passing power flow and continues NEGCON starts passing power flow and continues passing power flow to the right only when all of passing power flow to the right only when all of the the following conditions are met: following conditions are met:...
  • Page 129 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Operands for POSCON and NEGCON Parameter Description Allowed Operands Optional BOOLV The variable associated BOOL variable: I, Q, M, T, S, SA, SB, SC, and G, with the transition contact symbolic discrete variables, I/O variables Bit reference in BOOL variable: I, Q, M, T, S, SA, SB, SC.
  • Page 130 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 PTCON and NTCON WARNING PTCON or NTCON instructions should not be used in a parameterized block or user-defined function block with a parameter or member. In these cases, an R_TRIG or F_TRIG should be used instead.
  • Page 131 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Operands for PTCON and NTCON Parameter Description Allowed Operands Optional BOOL_V The variable associated with BOOL variable: I, Q, M, T, S, SA, SB, SC, PTCON or NTCON contact and G memories, symbolic discrete variables, I/O variables.
  • Page 132 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Logic Example Using PTCON Figure 62 Ladder Diagram (LD) Programming...
  • Page 133: Control Functions

    CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Control Functions The control functions limit program execution and change the way the CPU executes the application program. Function Mnemonic Description Do I/O DO_IO For one scan, immediately services a specified range of inputs or outputs (All inputs or outputs on a module are serviced if any reference locations on that module are included in the DO I/O function.
  • Page 134 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.5.1 Do I/O Figure 63 When the DO I/O (DO_IO) function receives power flow, it updates inputs or outputs for one scan while the program is running. You can also use DO_ IO to update selected I/O during the program in addition to the normal I/O scan.
  • Page 135 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Note The Do I/O function skips modules that do not support DO_IO scanning: IC693BEM331 90-30 Genius Bus Controller IC694BEM331 RX3i Genius Bus Controller IC693BEM341 90-30 2.5 GHz FIP Bus Controller IC693DNM200 90-30 DeviceNet Master IC695PBM300 RX3i PROFIBUS Master...
  • Page 136 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 associated with the output modules. The values need to be explicitly written to the reference memory of ALL output modules. Operands Parameter Description Allowed Operands Optional The starting address of the set of input or output I, Q, AI, AQ, I/O Variable No points or words to be serviced.
  • Page 137 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Example - Do I/O for Inputs Figure 64 When DO_IO receives power flow, the PLC scans references %I0001—64 and %Q0001 is turned on. A copy of the scanned inputs is placed in internal memory from %M0001-64.
  • Page 138: Edge Detectors

    CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.5.2 Edge Detectors Figure 66 These function blocks detect the changing state of a Boolean signal and produce a single pulse when an edge is detected. When transitional instructions, such as Transition Coils or Ladder Diagram (LD) Programming...
  • Page 139 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Transition Contacts, are used inside a function block, there is a problem when the same function block is called more than once per scan. The first call executes the transition correctly, but subsequent calls do not because they see the state as adjusted from the first call.
  • Page 140 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Instance Data Structure These elements cannot be published or written to. Element Name Type Description BOOL Edge detection input. Not accessible in user logic. BOOL Edge detection output. Accessible in user logic. Read only. STATE BOOL Internal value.
  • Page 141 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 R_TRIG Operation Figure 68 When the CLK input transitions from false to true, the output Q is true for one function block execution. The output Q then remains false until a new rising edge is detected.
  • Page 142 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.5.3 Drum Figure 70 The Drum function operates like a mechanical drum sequencer, which steps through a set of potential output bit patterns and selects one based on inputs to the function. The selected value is copied to a group of 16 discrete output references.
  • Page 143 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 are not followed, the operation of the Drum function in parameterized blocks is undefined. Note: These rules are not enforced by the programming software. It is your responsibility to ensure these rules are followed. The best use of a Drum function is to invoke it with a particular reference address exactly one time each scan.
  • Page 144 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Parameterized block called from multiple blocks When calling the parameterized block from multiple blocks, it is imperative to separate the Drum reference memory used by each call to the parameterized block. Follow these rules and guidelines: Call the parameterized block exactly one time per execution of each source block that it appears in.
  • Page 145 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 In the case of multiple calls to a UDFB during a logic scan, only the first call will add elapsed time to its timer functions. This behavior matches the behavior of the Drum function timer in a normal program block.
  • Page 146 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Parameter Description Allowed Operands Optional (Dwell Time) If you use the DT operand, you must All except S, SA, SB, SC also use the DTO operand and vice-versa. The DT and constant operand is the starting address of Length words of memory, where Length is the number of steps.
  • Page 147 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Parameter Description Allowed Operands Optional (First Follower) The starting address of All except S and (Length/8+1) bytes of memory, where Length is constant the number of steps. If MOD (Length/8+1)>0, FF has (Length/8+1) bytes.
  • Page 148 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.5.4 For Loop Figure 71 A FOR loop repeats rung logic a specified number of times while varying the value of the INDEX variable in the loop. A FOR loop begins with a FOR_LOOP instruction and ends with an END_FOR instruction.
  • Page 149 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 When the START and END values are set equal, the statements of the FOR loop are executed only once. When START cannot be incremented or decremented to reach the END, the statements within the FOR loop are not executed.
  • Page 150 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 For Loop Example 1 Figure 72 The value for %M00001 (START) is 1 and the value for %M00017 (END) is 10. The INDEX (%R00001) increments by the value of the INC operand (which is assumed to be 1 when omitted) starting at 1 until it reaches the ending value 10.
  • Page 151 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 30, 40, 50, 60, 70, 80, 90, and 100. However, when the INDEX (%R00001) is 0, the EXIT statement is enabled, and power flow jumps directly to the statement after the END_FOR statement.
  • Page 152 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Example In the following example, the variable Mod_Int is mapped to an I/O point on a hardware module and is configured as an I/O interrupt to a program block. When the BOOL variable MaskOn_Off transitions from OFF to ON and A1 is set to ON, the interrupt Mod_Int is masked (not executed) for one scan.
  • Page 153 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Operands Parameter Description Allowed Operands Optional Memory location at which to write current switch All except S, SA, SB, SC position value. 1 - °RUN I/O Enabled 2 - °RUN Outputs Disabled 3 - °STOP Mode MODE Memory location to which switch configuration...
  • Page 154 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Operands for SCAN_SET_IO Parameter Description Allowed Types Allowed Operands Optional If true, the inputs will be BOOL variable or bit Power flow scanned. reference in a non- BOOL variable If true, the outputs will be BOOL variable or bit Power flow scanned.
  • Page 155 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.5.8 Suspend I/O Figure 79 The Suspend I/O (SUS_IO) function stops normal I/O scans from occurring for one CPU sweep. During the next output scan, all outputs are held at their current states. During the next input scan, the input references are not updated with data from inputs.
  • Page 156 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Example Figure 80 The example at right shows a SUS_IO function and a DO_IO function used to stop I/O scans, then cause certain I/O to be scanned from the program. Inputs %I00010 and %I00011 form a latch circuit with the contact from %M00001. This keeps the SUS_IO function active on each sweep until %I00011 goes on.
  • Page 157 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.5.9 Suspend or Resume I/O Interrupt Figure 81 Suspend or resume an I/O interrupt when using I/O variables. If not using I/O variables, use SVC_REQ 32. The function executes successfully and passes power to the right unless: The I/O module associated with the interrupt trigger specified in IN1 is not •...
  • Page 158: Conversion Functions

    CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Conversion Functions The Conversion functions change a data item from one number format (data type) to another. Many programming instructions, such as math functions, must be used with data of one type. As a result, data conversion is often required before using those instructions.
  • Page 159 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Function Description INT_TO_REAL Converts INT to REAL DINT_TO_REAL Converts DINT to REAL LREAL_TO_REAL Converts LREAL to REAL Convert to LREAL(64-bit signed real or floating-point values) DINT_TO_LREAL Converts DINT to LREAL REAL_TO_LREAL Converts REAL to LREAL Truncate TRUNC_DINT...
  • Page 160 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.6.2 Convert UINT or INT to BCD4 Figure 84 When this function receives power flow, it converts the input unsigned (UINT) or signed single-precision integer (INT) data into the equivalent 4-digit Binary-Coded- Decimal (BCD) values, which it outputs to Q.
  • Page 161 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Example - INT to BCD4 Figure 86 Whenever input %I0002 is set and no errors exist, the INT values at input locations %I0017 through %I0032 are converted to four BCD digits, and the result is stored in memory locations %Q0033 through %Q0048.
  • Page 162 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.6.3 Convert DINT to BCD8 Figure 87 When DINT_TO_BCD8 receives power flow, it converts the input signed double- precision integer (DINT) data into the equivalent 8-digit Binary-Coded-Decimal (BCD) values, which it outputs to Q. DINT_TO_BCD8 does not change the original DINT data.
  • Page 163 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.6.4 Convert BCD4, UINT, DINT, or REAL to INT Figure 89 BDC4, UINT, and DINT When this function receives power flow, it converts the input data into the equivalent single-precision signed integer (INT) value, which it outputs to Q. This function does not change the original input data.
  • Page 164 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Operands Parameter Description Allowed Operands Optional The value to convert to INT. All except S, SA, SB, and SC No The INT equivalent value of the original value All except S, SA, SB, and SC No in IN.
  • Page 165 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Example: DINT to INT Figure 92 Whenever input %M00031 is set, the DINT value in %R00055 is converted to a signed integer (INT) and passed to the ADD function, where it is added to the INT at %R02345.
  • Page 166 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Example: BCD4 to UINT One use of BCD4_TO_UINT is to convert BCD data from the I/O structure into integer data and store it in memory. This can provide an interface to BCD thumbwheels or external BCD electronics, such as high-speed counters and position encoders.
  • Page 167 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Whenever input %I00002 is set and no errors exist, the double precision signed integer (DINT) at input location %R00007 is converted to an unsigned integer (UINT) and passed to the SUB function, where the constant value 145 is subtracted from it.
  • Page 168 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 WARNING Converting from LREAL or REAL to DINT may result in Overflow. For example, REAL 5.7E20, which equals 5.7 × 1020, converts to DINT OVERFLOW. To truncate a REAL value and express the result as a DINT, i.e., to remove the fractional part of the REAL number and express the remaining integer value as a DINT, use TRUNC_DINT.
  • Page 169 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Example: INT to DINT Figure 101 Whenever input %I00002 is set, the signed single-precision integer (INT) value at input location %I00017 is converted to a double-precision signed integer (DINT) and the result is placed in location %L00001. The output %Q01001 is set whenever the function executes successfully.
  • Page 170 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 WARNING Converting from BCD8 to REAL may result in the loss of significant digits. • This is because a BCD8 value is stored in a DWORD, which uses 32 bits to store a value, whereas a REAL (32-bit IEEE floating point number) uses 8 bits to store the exponent and the sign and only 24 bits to store the mantissa.
  • Page 171 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 The integer value of input IN is -678. The value placed in %R00010 is -678.000. Example: LREAL to REAL Figure 106 The double-precision floating point value of the square root of 2 is rounded to the nearest single-precision floating point value and placed in R00300.
  • Page 172 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.6.9 Convert DINT to LREAL Figure 109 When DINT_TO_LREAL receives power flow, it converts the double-precision input data to 64-bit double-precision floating point data. 4.6.10 Truncate Figure 110 When power is received, the Truncate functions TRUNC_DINT and TRUNC_INT round a floating-point (REAL) value down respective to the nearest signed double- precision signed integer (DINT) or signed single-precision integer (INT) value.
  • Page 173 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Example The displayed constant is truncated, and the integer result 562 is placed in %T0001. Figure 111 Ladder Diagram (LD) Programming...
  • Page 174 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Counters Function Mnemonic Description Down Counter DNCTR Counts down from a preset value. The output is ON whenever the Current Value is  0. Up Counter UPCTR Counts to a designated value. The output is ON whenever the Current Value is ...
  • Page 175: Down Counter

    CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 WARNING The third word (Control) can be read but should not be written to; otherwise, the function will not work. Word 3: Control Word Structure Figure 112 Note: Bits 0 through 13 are not used for counters. 4.7.2 Down Counter Figure 113...
  • Page 176 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 WARNING Do not use the Address of the down counter with other instructions. Overlapping references cause erratic counter operation. Note: For DNCTR to function properly, you must provide an initial reset to set the CV to the value in PV.
  • Page 177 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.7.3 Up Counter Figure 115 The Up Counter (UPCTR) function counts to the Preset Value (PV). The range is 0 to +32,767 counts. When the Current Value (CV) of the counter reaches 32,767, it remains there until reset.
  • Page 178 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Example – Up Counter Every time input %I0012 transitions from OFF to ON, the Up Counter counts by 1; internal coil %M0001 is energized whenever 100 parts have been counted. Whenever %M0001 is ON, the accumulated count is reset to zero. Figure 116 Example –...
  • Page 179 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Data Move Functions The Data Move functions provide basic data move capabilities. Function Mnemonics Description Array Size ARRAY_SIZE Counts the number of elements in an array. Array Size ARRAY_SIZE_DIM1 Returns the value of the Array Dimension 1 property of a one- Dimension 1 or two-dimensional array.
  • Page 180: Array Size

    CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Function Mnemonics Description Move MOVE_BOOL Copies data as individual bits, so the new location does not MOVE_DATA have to be the same data type. Data can be moved into a MOVE_DINT different data type without prior conversion.
  • Page 181 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Operands Parameter Description Allowed Operands Optional Array of any data type whose Data flow, I, Q, M, T, S, SA, SB, SC, G, elements are counted. discrete symbolic, I/O variable If a non-array variable is assigned to IN, the value of Q is Number of elements in the array DINT or DWORD variable.
  • Page 182 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Operands Parameter Description Allowed Operands Optional Array of any data type. Data flow, I, Q, M, T, S, SA, SB, SC, G, discrete symbolic, I/O variable The value of the Array Dimension 1 DINT or DWORD variable.
  • Page 183 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Operands Parameter Description Allowed Operands Optional Array of any data type. Data flow, I, Q, M, T, S, SA, SB, SC, G, discrete symbolic, I/O variable The value of the Array Dimension 2 DINT or DWORD variable.
  • Page 184 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Figure 123 You can use a FOR_LOOP to iterate through an array’s second dimension in a method similar to this example. You can also use nested FOR_LOOPs to ensure that operations on elements using two variable indexes each do not exceed their array dimension.
  • Page 185 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Operands Parameter Description Allowed Operands Optional Length (??) The number of words to clear, Constant starting at the IN location. 1  Length  256 words. The first WORD of the memory block All except %S and data flow.
  • Page 186: Block Move

    CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.8.4 Block Move When the Block Move (BLKMOV) function receives Mnemonics: power flow, it copies a block of seven constants into BLKMOV_DINT consecutive locations beginning at the destination BLKMOV_DWORD specified in output Q. BLKMOV passes power to the right BLKMOV_INT whenever it receives power.
  • Page 187 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Example When the enabling input represented by the name #FST_SCN is ON, BLKMOV_INT copies the seven input constants into memory locations %R0010 through %R0016. Figure 126 4.8.5 BUS_ Functions Four program functions allow the PACSystems CPU to communicate with modules in the system.
  • Page 188 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 BUS Read The BUS_RD function reads data from the bus. Mnemonics: BUS_RD_DINT This function should be executed before the data is needed in the program. If the amount of data to be read BUS_RD_DWORD is greater than 32767 BYTES, WORDS, or DWORDS, use BUS_RD_WORD...
  • Page 189 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 BUS_RD Status in the ST Output The BUS_RD function returns one of the following values to the ST output: Value Description Operation successful. Bus error Module does not exist at rack/slot location. Module at rack/slot location is an invalid type.
  • Page 190 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 BUS Read Modify Write The BUS_RMW function updates one byte, word, or Other mnemonic: double word of data on the bus. This function locks BUS_RMW_WORD the bus while performing the read-modify-write operation.
  • Page 191 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Operands for BUS_RMW For BUS_RMW_WORD, the absolute bus address must be a multiple of 2. For BUS_RMW_DWORD, it must be a multiple of 4. The absolute bus address is equal to the base address plus the offset value. Parameter Description Allowed Operands Optional...
  • Page 192 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 BUS Test and Set The BUS_TS function uses semaphores to control Other mnemonic: access to specific memory in a module located BUS_TS_WORD on the bus. The BUS_TS function exchanges a Boolean TRUE (1) for the value currently at the semaphore location.
  • Page 193 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 BUS Write When the BUS_WRT function receives power flow through its Mnemonics: enable input, it writes the data located at reference (IN) to BUS_WRT_DINT the module at the specified rack (R), slot (S), subslot (SS) and BUS_WRT_DWORD optional address region (RGN) and offset (OFF).
  • Page 194 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.8.6 Communication Request (COMMREQ) Figure 127 The Communication Request (COMMREQ) function communicates with an intelligent module, such as a Genius Communications Module or High-Speed Counter. Notes: • The information presented in this section shows only the basic format of the COMMREQ function.
  • Page 195 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Command Block The command block provides information to the intelligent module on the command to be performed. The command block starts at the reference specified by the operand IN. This address may be in any word-oriented area of memory (%R, %P, %L, %W, %AI, %AQ, or symbolic non-discrete variables).
  • Page 196 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Status Pointer Memory Type Status pointer memory type contains a numeric code that specifies the user reference memory type for the status word. The table below shows the code for each reference type: For this memory type Enter this decimal value Discrete input table (BIT mode)
  • Page 197 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Parameter Description Allowed Operands Optional Function Faulted output. FT is energized if Power flow an error is detected processing the COMMREQ: • This is a WAIT mode COMMREQ and the CPU does not support it •...
  • Page 198 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 When enabling input %M0020 is ON, a command block starting at %R0016 is sent to communications task 1 in the device located at rack 1, slot 2 of the PLC. If an error occurs processing the COMMREQ, %Q0100 is set.
  • Page 199: Data Initialization

    CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 MOVE functions supply the following command block data for the COMMREQ. The first MOVE function places the length of the data being communicated in • %R00016. The second MOVE function places the constant 0 in %R00017. This specifies NO •...
  • Page 200 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 function type is copied to consecutive reference addresses starting at output Q. DATA_INIT passes power to the right whenever it receives power. Notes: • The output parameter is not included in coil checking. •...
  • Page 201 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.8.8 Data Initialize ASCII Figure 133 The Data Initialize ASCII (DATA_INIT_ASCII) function copies a block of constant ASCII text to a reference range. When DATA_INIT_ASCII is first programmed, the constants are initialized to zeroes. To specify the constant data to copy, double-click the DATA_INIT_ASCII instruction in the LD editor.
  • Page 202 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.8.9 Data Initialize Communications Request Figure 135 The Data Initialize Communications Request (DATA_INIT_COMM) function initializes a COMMREQ function with a block of constant data. The IN parameter of the COMMREQ must correspond with output Q of this DATA_INIT_COMM function. When DATA_INIT_COMM is first programmed, the constants are initialized to zeroes.
  • Page 203 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 On the first scan (as restricted by the #FST_SCN system variable), a command block consisting of 100 words of data, including the 6 header words, is copied to %P00001 through %P00100. %Q00002 receives power. 4.8.10 Data Initialize DLAN The Data Initialize DLAN (DATA_INIT_DLAN) function is used with a DLAN Interface...
  • Page 204 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.8.11 Move When the MOVE function receives power flow, it copies data Mnemonics: as individual bits from one location in PLC memory to another. MOVE_BOOL Because the data is copied in bit format, the new location does MOVE_DINT not need to be the same data type as the original.
  • Page 205 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 MOVE Operands Parameter Description Allowed Optional Operands Length (??) The length of IN; the number of bits, words, or Constant double words to copy. If IN is a constant and Q is BOOL, then 1  Length ...
  • Page 206 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 MOVE_WORD Example Figure 139 V_M00001 and V_M00033 are both WORD arrays of length 3, for a total of 48 bits in each array. Since PLCs do not recognize arrays, Length must be set at 3, for the total number of WORDs to be moved.
  • Page 207 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.8.13 Move Data Explicit Figure 140 MOVE_DATA_EX provides optional data coherency by locking the symbolic memory being written to during the copy operation. This allows data to be copied coherently when accessed by multiple logic threads (i.e. interrupt blocks). Note that copying large amounts of data with coherency enabled can increase interrupt latency.
  • Page 208: Operation

    CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Example Figure 141 Enum_Array and Enum_Array_Out are arrays of enumerated variables, with three elements each. To copy all elements in Enum_Array, input Length should be 3. When the enabling input Q00014 is on, MOVE_DATA_EX copies three elements from memory location Enum_Array to memory location Enum_Array_Out.
  • Page 209 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Copying to specified array elements For output Q, a single element of a UDT array can be specified, for example, myUDT_array[4] (5th element of myUDT_array). In this case, the input LEN (Length) operand applies to the array elements starting from and including myUDT_array[4].
  • Page 210 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Parameter Description Allowed Operands Optional UDT variable or UDT array to which IN is copied. Discrete or non- discrete symbolic, discrete or non-discrete I/O variable. Example A WORD variable mapped to %R1 is assigned to input IN and a value of 1 is assigned to Length.
  • Page 211 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Copying Arrays and Array Elements The Length determines the number of UDT array elements to be copied to the reference memory of the variable assigned to output Q. Example: If the value 6 is assigned to Length, there should be a UDT array of at least six elements assigned to input IN.
  • Page 212: Shift Register

    CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Example A UDT variable or UDT array is assigned to input IN. The constant value 8 is assigned to input LEN (Length). A DWORD variable mapped to %R1 is assigned to output Q. If the constant value 8 is assigned to LEN (length), there should be a UDT array of at least eight elements assigned to IN.
  • Page 213 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Operands for Shift Register Parameter Description Allowed Optional Operands Length (??) The number of data items in the shift register, ST. 1  Length  256 Reset. When R is ON, the shift register Power flow located at ST is filled with zeroes.
  • Page 214 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Example Figure 144 SHFR_WORD operates on register memory locations %R0001 through %R0100. When the reset reference CLEAR is active, the Shift Register words are set to zero. When the NXT_CYC reference is active and CLEAR is not, the two words at the starting address V_Q00033 are shifted into the Shift Register at %R0001.
  • Page 215 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Example Figure 145 The single-segment structure named Var assigned to input IN contains eight BOOL elements (8 × 1 = 8 bits) and twelve WORD elements (12 × 16 = 192 bits). SIZE_OF outputs the value 8 + 192 = 200 to the variable R00001 assigned to output Q.
  • Page 216 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Figure 146 Character (ASCII) strings or BCD data require no adjustment since the Intel and Motorola conventions for storage of character strings are identical. Operands for Swap The two parameters, IN and Q, must both be the same type, WORD or DWORD. Parameter Description Allowed Operands Optional...
  • Page 217 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Data Table Functions Function Mnemonic Description Array Move ARRAY_MOVE_BOOL Copies a specified number of data elements from a source ARRAY_MOVE_BYTE memory block to a destination memory block. ARRAY_MOVE_DINT Note: The memory blocks do not need to be defined ARRAY_MOVE_INT as arrays.
  • Page 218 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Function Mnemonic Description SEARCH_GT_BYTE Searches for all array values greater than a specified value SEARCH_GT_DINT SEARCH_GT_DWORD SEARCH_GT_INT SEARCH_GT_UINT SEARCH_GT_WORD SEARCH_LE_BYTE Searches for all array values less than or equal to a SEARCH_LE_DINT specified value SEARCH_LE_DWORD...
  • Page 219 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.9.1 Array Move When the Array Move function receives power flow, Mnemonics: it copies a specified number of elements from a ARRAY_MOVE_BOOL source memory block to a destination memory ARRAY_MOVE_BYTE block. Starting at the indexed location (SR+SNX-1) of ARRAY_MOVE_DINT the input memory block, it copies N elements to the ARRAY_MOVE_DWORD...
  • Page 220 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Parameter Description Allowed Operands Optional The index of the source memory block All except variables in %S - %SC. The index of the destination memory All except variables in %S - block %SC.
  • Page 221 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Array Move Example 2 Figure 149 Using bit memory blocks, the input block starts at SR=%M0009, the output block starts at %Q0022, and the length of both blocks is 16 one-bit registers (Length=16). To copy the seven registers %M0011 - %M0017 to %Q0026 - %Q0032, N is set to 7, SNX is set to 3 (to designate the third register, %M0011, of the block starting at %M0009), and DNX is set to 5 (to designate the fifth register, %Q0026, of the block...
  • Page 222 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.9.2 Array Range The ARRAY_RANGE function compares a single input Mnemonics: value against two arrays of delimiters that specify an ARRAY_RANGE_DINT upper and lower bound to determine if the input ARRAY_RANGE_DWORD value falls within the range specified by the ARRAY_RANGE_INT delimiters.
  • Page 223 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Parameter Description Allowed Operands Optional Length (??) The number of elements in each array. Constant The lower limit of the range All except constants and %S - %SC for INT, DINT. The upper limit of the range All except constants and %S - %SC for INT, DINT.
  • Page 224 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Array Range Example 2 Figure 152 The lower limit (LL) array contains %T00001 through %T00016, %T00017 through %T00032, and %T00033 through %T00048. The lower limit values are 100, 65, and 1. The upper limit (UL) values are 29, 165, and 2. The resulting Q values of 0, 1, and 0 will be placed in %Q00001 through %Q00003.
  • Page 225 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 FIFO_RD passes power to the right if the pointer is greater than zero and less than the value specified for LEN. Note: A FIFO table is a queue. A LIFO table is a stack. Operands for FIFO Read Note: For each mnemonic, use the corresponding data type for the TB and Q operands.
  • Page 226 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.9.4 FIFO Write The First-In-First-Out (FIFO) Write (FIFO_WRT) function Mnemonics: moves data into tables. The function increments the FIFO_WRT_DINT table pointer by one and adds an entry at the new FIFO_WRT_DWORD pointer location in a FIFO table.
  • Page 227 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Example for FIFO Write Figure 154 PRODUCT is a FIFO table with 100 word-sized elements. When the enabling input UNPACK is ON, a data item from P_CODE is copied to the table location pointed to by the value in STK_PTR.
  • Page 228 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Operands for LIFO Read Note: For each mnemonic, use the corresponding data type for the TB and Q operands. For example, LIFO_RD_DINT requires TB and Q to be DINT variables. Parameter Description Allowed Operands Optional...
  • Page 229 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 location.) Additional program logic must then be used to place the data in the input reference. Steps 1 and 2 are repeated each time LIFO_WRT is executed, until the table is full (PTR=LEN). The pointer does not wrap around when the table is full.
  • Page 230 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 PRODUCT is a LIFO table with 100 word-sized elements. When the enabling input STORE is ON, a data item from NEW_ITEM is copied to the table location pointed to by the value in STK_PTR. Output FL passes power when PTR = LEN, firing the FULL coil.
  • Page 231 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 If no register is found before the end of the block is reached, the Found • Indication (FD) is set OFF and the Output Index (ONX) is set to zero. The input index (INX) is zero-based, that is, 0 the means first reference, whereas the output index (ONX) is one-based, that is, 1 means the first reference.
  • Page 232 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Parameter Description Allowed Operands Optional The one-based position within the data flow, I, Q, M, T, memory block of the search target. A G, R, P, L, AI, AQ value of 1 point to the first reference. Valid range: 1 ...
  • Page 233 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.9.8 Sort When it receives power flow, the SORT function sorts the Mnemonics: elements of the memory block 'IN' in ascending order. The SORT_INT output memory block Q contains integers that give the index SORT_UINT that the sorted elements had in the original memory block or SORT_WORD...
  • Page 234 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 If PLIST were an array of five elements and contained the values 25, 67, 12, 35, 14 before the sort, then after the sort it would contain the values 12, 14, 25, 35, 67. PPOSN would contain the values 3, 5, 1, 4, 2.
  • Page 235 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Parameter Description Allowed Operands Optional Energized when the last Power flow element of the table is read Q (must be the The element read from All except constants, S. SA, SB, SC same type as TB) the table allowed only for WORD, DWORD...
  • Page 236 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 When TBL_WRT receives power flow, the pointer (PTR) increments by 1. If this new pointer location is the last item in the table, the output FL is set to ON. The next time TBL_WRT executes, PTR is automatically set back to 1.
  • Page 237: Math Functions

    CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.10 Math Functions Your program may need to include logic to convert data to a different data type before using a Math or Numerical function. The description of each function includes information about appropriate data types. Refer to the Conversion Functions section to understand how to convert one data type to a different data type.
  • Page 238: Absolute Value

    CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.10.1 Overflow When an operation results in overflow, there is no power flow. If an operation on signed operands (INT, DINT, REAL) results in overflow, the output reference is set to its largest possible value for the data type. For signed numbers, the sign is set to show the direction of the overflow.
  • Page 239 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Example The absolute value of –2,976, which is 2,976, is placed in %R00010: Figure 162 4.10.3 When the ADD function receives power flow, it adds the two Mnemonics: operands IN1 and IN2 of the same data type and stores the sum ADD_DINT in the output variable assigned to Q, also of the same data type.
  • Page 240 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Example1 for ADD Figure 163 The first example is a failed attempt to create a counter circuit that would count the number of times switch %I00001 closes. The running total is stored in register %R00002.
  • Page 241 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.10.4 Divide When the DIV function receives power flow, it divides the operand Mnemonics: IN1 by the operand IN2 of the same data type as IN1 and stores DIV_DINT the quotient in the output variable assigned to Q, also of the same DIV_INT data type as IN1 and IN2.
  • Page 242 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Operands for the DIV Function Parameter Description Allowed Operands Optional Dividend: the value to be divided; shown to All except S, SA, SB, SC the left of DIV in the equation IN1 DIV IN2=Q.
  • Page 243 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.10.5 Modulus When the Modulo Division (MOD) function receives power flow, it Mnemonics: divides input IN1 by input IN2 and outputs the remainder of the MOD_DINT division to Q. MOD_INT MOD_UINT All three operands must be of the same data type.
  • Page 244 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 0 x ∞ • I1 and/or I2 is NaN (Not a Number). • Mnemonic Operation Displays as MUL_INT Q(16-bit) = IN1(16-bit) × IN2(16-bit) base 10 number with sign, up to 5 digits long MUL_DINT Q(32-bit) = IN1(32-bit) ×...
  • Page 245 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Figure 165 An alternate, but less accurate, way of programming this circuit using INT values involves placing the DIV_DINT instruction first, followed by the MUL_DINT instruction. The value of IN2 for the DIV instruction would be 32, and the value of IN2 for the MUL would be 25.
  • Page 246 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.10.7 Scale When the SCALE function receives power Mnemonics: flow, it scales the input operand IN and SCALE_DINT places the result in the output variable SCALE_INT assigned to output operand OUT. The power SCALE_DINT flow output is energized when SCALE is SCALE_UINT...
  • Page 247 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Example Figure 166 In the example at right, the registers %R0120 through %R0123 are used to store the high and low scaling values. The input value to be scaled is analog input %AI0017.
  • Page 248 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Operands for Subtract Parameter Description Allowed Operands Optional The value to subtract from; the value to the left of All except S, SA, SB, the minus sign (-) in the equation IN1-IN2=Q. The value to subtract from IN1;...
  • Page 249 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.11.1 Argument Present Figure 167 The ARG_PRES function determines whether an input parameter value was present when the function block instance of the parameter was invoked. This may be necessary if the parameter is optional. This function must be called from a function block instance or a parameterized block.
  • Page 250 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Example for ARG_PRES The following sample rung calls the user defined function block, ReadTemp, which has two parameters, TempVal and Temp1. Figure 168 The function block ReadTemp contains the following logic, which uses an ARG_PRES function to determine whether a value for TempVal is present.
  • Page 251 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.11.2 Call Non-parameterized Parameterized. May call a parameterized external block or a parameterized block. May have up to 7 input and 8 output parameters. When the CALL function receives power flow, it causes the logic execution to go immediately to the designated program block, external C block (parameterized or not), or parameterized block and execute it.
  • Page 252 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Operands for Call Parameter Description Block Name (????) Block name; the name of the block to transfer to. You cannot CALL the _MAIN block. A program block or a parameterized block can call itself. (Parameterized calls only) Notes for External (C) blocks: •...
  • Page 253 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Example 1 for Call Figure 170 In the example at right, if Enable is set, the C block named C_123 is executed. C_123 operates on the input data located at reference addresses Data1, Data2, and Data 3, and produces values located at reference addresses Data4, Data5, and Data6.
  • Page 254 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 E=(A+B+C+D)/4, a parameterized block named AVG_4 could be called as shown in the example to the right. In this example, the average of the values in R00001, R00002, R00003, and R00004 would be placed in R00005.
  • Page 255 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.11.3 Comment Figure 173 The Comment function is used to enter a text explanation in the program. When you insert a Comment instruction into the LD logic, it displays????. After you key in a comment, the first few words are displayed.
  • Page 256 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 A JUMPN and its associated LABELN can be placed anywhere in a program, if the JUMPN / LABELN range: does not overlap the range of a MCRN / ENDMCRN pair. • does not overlap the range of a FOR_LOOP / END_FOR pair.
  • Page 257 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Unlike JUMP instructions, MCRNs can only move forward. An ENDMCRN instruction must appear after its corresponding MCRN instruction in a program. The following controls are imposed by an MCRN: Timers do not increment or decrement. TMR types are reset. For an ONDTR •...
  • Page 258 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Example of MCRN/ENDMCRN Figure 176 The example at right an MCRN named Sec_MCRN nested inside the MCRN named First_MCRN. Whenever the V_I0002 contact allows power flow into the MCRN function, program execution will continue without power flow to the coils until the associated ENDMCRN is reached.
  • Page 259: Relational Functions

    CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.12 Relational Functions Relational functions compare two values of the same data type or determine whether a number lies within a specified range. The original values are unaffected. Function Mnemonic Description Compare CMP_DINT Compares two numbers, IN1 and IN2, of the data type specified...
  • Page 260 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.12.1 Compare When the Compare (CMP) function receives power Mnemonics: flow, it compares the value IN1 to the value IN2. CMP_DINT CMP_INT If IN1 < IN2, CMP energizes the LT • CMP_REAL (Less Than) output.
  • Page 261 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Example Figure 178 When %I00001 is ON, the integer variable SHIPS is compared with the variable BOATS. Internal coils %M0001, %M0002, and %M0003 are set to the results of the compare. 4.12.2 Equal, Not Equal, Greater or Equal, Greater Than, Less or Equal, Less Than...
  • Page 262 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Overflow occurs with a _UINT operation, the result wraps around – refer to the section on Ladder Diagram (LD) Programming...
  • Page 263 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Overflow. If the _DINT or _INT operations are fed the largest possible value with any sign, they cannot determine if it is an overflow value. The power flow output of the previous operation would need to be checked.
  • Page 264 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.12.3 EQ_DATA The EQ_DATA function compares two input variables, IN1 Mnemonic: and IN2 of the same data type. If IN1 and IN2 are equal, EQ_DATA output Q is energized. If they are not equal, Q is cleared. Operands Parameter Description Allowed Operands...
  • Page 265 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.12.4 Range When the Range function is enabled, it compares the value of Mnemonics: input IN against the range delimited by operands L1 and L2. RANGE_DINT Either L1 or L2 can be the high or low limit. When L1 ≤ IN ≤ L2 or RANGE_DWORD L2 ≤...
  • Page 266: Timed Contacts

    CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.13 Timers This section describes the PACSystems timed contacts and timer function blocks that are implemented in the LD language. 4.13.1 Timed Contacts The PACSystems has four timed contacts that can be used to provide regular pulses of power flow to other program functions.
  • Page 267 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 4.13.2 Timer Function Blocks Function Block Function Mnemonic Description Type The Current Value (CV) of the timer resets to OFDT_HUNDS zero when power flow input is on. CV OFDT_SEC increments while power flow is off. When Off Delay Timer OFDT_TENTHS CV=PV (Preset Value), power flow is no...
  • Page 268 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Data Required for Built-in Timer Function Blocks The data associated with these functions is retentive through power cycles. Each timer uses a three-word array of %R, %W, %P, %L or symbolic memory to store the following information: Current value (CV) Word 1...
  • Page 269 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Word 3: Control word The control word stores the state of the Boolean inputs and outputs of its associated timer or counter, as shown in the following diagram: Figure 181 WARNING The third word (Control) can be read but should not be written to;...
  • Page 270 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 rules described here are not followed, the operation of the timer functions in parameterized blocks is undefined. Note: These rules are not enforced by the programming software. It is your responsibility to ensure these rules are followed. The best use of a timer function is to invoke it with a reference address exactly one time each scan.
  • Page 271 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Parameterized block called from multiple blocks When calling the parameterized block from multiple blocks, it is imperative to separate the timer reference memory used by each call to the parameterized block. Follow these rules and guidelines: Call the parameterized block exactly one time per execution of each source block in which it appears.
  • Page 272 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 In the case of multiple calls to a UDFB during a logic scan, only the first call will add elapsed time to its timer functions. This behavior matches the behavior of timers in a normal program block.
  • Page 273 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Notes: • The best way to use an OFDT function is to invoke it with a particular reference address exactly one time each scan. Do not invoke an OFDT with the same reference address more than once per scan (inappropriate accumulation of time would result).
  • Page 274 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 WARNING Do not use the Address, Address+1, or Address+2 addresses with other instructions. Overlapping references cause erratic timer operation. Parameter Description Allowed Operands Optional Address The beginning address of a three-word WORD R, W, P, L, symbolic (????) array:...
  • Page 275 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 On Delay Stopwatch Timer retentive On-Delay Stopwatch Timer Mnemonics: ONDTR_SEC (ONDTR) increments while it receives power flow ONDTR_TENTHS and holds its value when power flow stops. ONDTR_HUNDS Time counted following ONDTR_THOUS increments: Seconds •...
  • Page 276 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Notes: • The best way to use an ONDTR function is to invoke it with a reference address exactly one time each scan. Do not invoke an ONDTR with the same reference address more than once per scan (inappropriate accumulation of time would result).
  • Page 277 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Timing diagram Figure 184 ENABLE goes high; timer starts accumulating. Current value (CV) reaches preset value (PV); Q goes high. Timer continues to accumulate time until ENABLE goes low, RESET goes high or current value becomes equal to the maximum time.
  • Page 278 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Example for On Delay Stopwatch Timer Figure 185 A retentive on-delay timer is used to create a signal (%Q0011) that turns on 8.0 seconds after %Q0010 turns on, and turns off when %Q0010 turns off. On Delay Timer The On-Delay Timer (TMR) increments while it receives Mnemonics:...
  • Page 279 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Notes: • The best way to use a TMR function is to invoke it with a particular reference address exactly one time each scan. Do not invoke a TMR with the same reference address more than once per scan (inappropriate accumulation of time would result).
  • Page 280 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Timing Diagram Figure 186 ENABLE goes high; timer begins accumulating time. CV reaches PV; Q goes high and timer continues accumulating time. ENABLE goes low; Q goes low; timer stops accumulating time and CV is cleared. ENABLE goes high;...
  • Page 281 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Example for On Delay Timer Figure 187 An on-delay timer with address TMRID is used to control the length of time that a coil is on. This coil has been assigned the variable DWELL. When the normally open (momentary) contact DO_DWL is ON, coil DWELL is energized.
  • Page 282 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Data Required for Standard Timer Function Blocks Each invocation of a timer has associated instance data that persists from one execution of the timer to the next. Instance variables are automatically located in symbolic memory.
  • Page 283 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Parameter Description Allowed Types Allowed Optional Operands ???? Structure variable containing the TOF, TON, or TP. internal data for the timer Must be same type instance. (Refer to as the instruction. Data Required for Standard Timer Function Blocks.) Timer input.
  • Page 284 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Timer Off Delay Figure 188 When the input IN transitions from ON to OFF, the timer starts timing until a specified period of time (PT) has elapsed, then sets the output Q to OFF. Timing Diagram Figure 189 When input IN is set to ON, the output Q follows and remains ON.
  • Page 285 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Example In the following sample rung, a TOF function block is used to keep Light ON for 30,000ms (30 seconds) after Door_Open is set to OFF. As long as Door_Open is ON, Light remains ON.
  • Page 286 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 When input IN is set to ON, the timer starts to measure time and the elapsed time output ET starts to increment. The output Q remains OFF and ET continues to increment until its value equals the preset time, PT.
  • Page 287 CPU Programmer’s Reference Manual Section 4 GFK-2950K Feb 2023 Timing Diagram Figure 195 When input IN is set to ON, the timer starts to measure time and the elapsed time output, ET, increments until its value equals that of the specified preset time, PT. Q is set to 0 on until ET equals PT.
  • Page 288 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 Section 5 Function Block Diagram (FBD) Function Block Diagram (FBD) is an IEC 61131-3 graphical programming language that represents the behavior of functions, function blocks and programs as a set of interconnected graphical blocks.
  • Page 289 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 Note on Reentrancy When a function block is created using the FBD language, the wires are created as global variables, not as members. This has two consequences. First, if there are multiple instances of that block in the program, the wires will show the values from the last instance executed during the sweep, not the values for the instance being viewed.
  • Page 290 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 Function Description Exponential. Calculates IN1 to the power of IN2 (IN1 For details, refer to EXPT Function below. Inverse trig. Calculates the inverse cosine of the IN operand and expresses the result in radians.
  • Page 291 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 5.2.1 EXPT Function The Power of X (EXPT) function raises the value of input IN1 to the power specified by the value IN2 and places the result in Q. The EXPT function operates on REAL or LREAL input value(s) and place the result in output Q.
  • Page 292 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 Function Description Logical AND. Compares the bit strings IN1 and IN2 bit by bit. When the corresponding bits are both 1, places a 1 in the corresponding location in output string Q; otherwise, places a 0 in the corresponding location in Q. If additional inputs (IN3 through IN8) are used, each additional bit string is compared to the string in Q and the result is placed in Q.
  • Page 293 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 Function Description Shift Bits Left. Shifts all the bits in a word or string of words to the left by a specified number of places. For details, refer to Bit Operation Functions in Section 4. Shift Bits Right.
  • Page 294 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 Logical OR If either bit examined by the Logical OR function is 1, OR places a 1 in the corresponding location in output string Q. If both bits are 0, Logical OR places a 0 in string Q in that location.
  • Page 295 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 Operands for AND, OR, and XOR Parameter Description Allowed Types Allowed Optional Operands Solve Order Calculated by the FBD editor. The value to operate BOOL, WORD DWORD IN2 (Must be The value to operate BOOL, WORD the same data DWORD...
  • Page 296 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 Operands Parameter Description Allowed Allowed Optional Types Operands Solve Order Calculated by the FBD editor. The input string to NOT. WORD DWORD Q (Must be the same The NOT's result. WORD All except constants data type as IN1) DWORD...
  • Page 297: Comparison Functions

    CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 Comparison Functions Comparison functions compare two values of the same data type or determine whether a number lies within a specified range. The original values are unaffected. Function Description Compare. Compares two numbers, IN1 and IN2. For details, refer to Relational Functions in Section 4.
  • Page 298 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 Function Description Not Equal. Tests whether two numbers are not equal. For details, refer to Comparison Functions. Range. Tests whether one number is within the range defined by two other supplied numbers. For details, refer to Relational Functions in Section 4.
  • Page 299 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 Operands Parameter Description Allowed Allowed Optional Types Operands Solve Order Calculated by the FBD editor. The first value to be compared; the BOOL (for EQ value on the left side of the and NE relational statement.
  • Page 300 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 Function Description Proportional Integral Derivative (PID) Control. Provides two PID closed-loop control algorithms: Standard ISA PID algorithm (PID_ISA) Independent term algorithm (PID_IND) Note: For details, refer to Section 7. Service Request. Requests a special control system service. Note: For details, refer to Section 6.
  • Page 301 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 Function Description Rising Edge Trigger. Detects a low-to-high transition of a Boolean input. Produces a single output pulse when a rising edge is detected. For details, refer to Control Functions in Section 4. Counters Function Description...
  • Page 302 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 Data Move Functions The Data Move functions provide basic data move capabilities. Function Description Array Size. Counts the number of elements in an array. For details, refer to Data Move Functions in Section 4. Array Size Dim1.
  • Page 303 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 Function Description Bus Read Modify Write. Uses a read/modify/write cycle to update a data element in a module on the bus. Other BUS_RMW functions: BUS_RMW_DWORD BUS_RMW_WORD For details, refer to Data Move Functions in Section 4. Bus Test and Set.
  • Page 304 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 Function Description Communication Request. Allows the program to communicate with an intelligent module, such as a Genius Bus Controller or a High- Speed Counter. For details, refer to Communication Request in Section 4. Fan Out.
  • Page 305 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 Function Description Move from Flat. Copies reference memory data to a UDT variable or UDT array. Provides the option of locking the symbolic or I/O variable memory area being written to during the copy operation. For details, refer to Data Move Functions in Section 4.
  • Page 306 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 Operands Parameter Description Allowed Types Allowed Optional Operands Solve Order Calculated by the FBD editor. The input to copy to the BOOL, DINT, DWORD, All except SA, SB, outputs. INT, REAL, UINT, or WORD variable or constant OUT1 …OUT8 Variables of the same...
  • Page 307 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 The result of the MOVE depends on whether the data type for the Q operand a bit reference or a non-bit reference is: If Q is a non-bit reference, LEN (the length) indicates the number of memory •...
  • Page 308 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 MOV Operands Parameter Description Allowed Allowed Optional Types Operands Solve Order Calculated by the FBD editor. Enable BOOL variable data flow, I, Q, M, T, G, S, SA, SB, SC, discrete symbolic, I/O variable Bit reference R, P, L, AI, AQ, W,...
  • Page 309 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 Parameter Description Allowed Allowed Optional Types Operands If ENO = ON (1), the operation was Bit reference I, Q, M, T, G, R, P, L, initiated. Results of the operation in a non-BOOL AI, AQ, W, non- are indicated in the FT output.
  • Page 310 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 Math Functions Your program may need to include logic to convert data to a different type before using a Math or Numerical function. The description of each function includes information about appropriate data types. The Type Conversion Functions section explains how to convert one data type into a different data type.
  • Page 311 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 Function Description Scales an input parameter and places the result in an output location. For details, refer to Math Functions in Section 4. Subtraction. Subtracts one or up to seven numbers from the input IN1 and places the result in an output location.
  • Page 312 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 5.9.2 Figure 202 Adds the operands IN1 and IN2 … IN8 and stores the sum in Q. IN1 … IN8 and Q must be of the same data type. The result is output to Q when ADD is performed without Overflow, unless one of the following invalid conditions occurs: (+ ∞...
  • Page 313 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 Operands of the ADD Function Parameter Description Allowed Types Allowed Optional Operands Solve Order Calculated by the FBD editor. IN1 … IN8 The values to be added. INT, DINT, REAL, LREAL, All except S, UINT SA, SB, SC and...
  • Page 314 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 Operands for DIV_UINT, DIV_INT, DIV_DINT, and DIV_REAL Parameter Description Allowed Types Allowed Optional Operands Solve Order Calculated by the FBD editor. NA Dividend: the value to be INT, DINT, UINT, REAL, All except S, divided;...
  • Page 315 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 Operands for Modulus Function Parameter Description Allowed Allowed Optional Types Operands Solve Order Calculated by the FBD editor. NA Dividend: the value to be INT, DINT, UINT All except S, SA, SB, divided into in order to obtain the remainder;...
  • Page 316 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 Mnemonic Operation Displays as Q(16-bit) = IN1(16-bit) * IN2(16-bit) base 10 number with sign, up to 5 digits long DINT Q(32-bit) = IN1(32-bit) * IN2(32-bit) base 10 number with sign, up to 10 digits long REAL Q(32-bit) = IN1(32-bit) * IN2(32-bit) base 10 number, sign and decimals, up...
  • Page 317 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 Operands Parameter Description Allowed Allowed Optional Types Operands Solve Order Calculated by the FBD editor. The value to be negated. INT, DINT, All except S, SA, REAL SB, SC The result, -1(IN) INT, DINT, All except S, SA, REAL...
  • Page 318 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 Mnemonic Operation Displays as SUB_INT Q(16-bit) = IN1(16-bit) – IN2(16-bit) base 10 number with sign, up to 5 digits long SUB_DINT Q(32-bit) = IN1(32-bit) – IN2(32-bit) base 10 number with sign, up to 10 digits long SUB_REAL Q(32-bit) = IN1(32-bit) –...
  • Page 319 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 5.10 Program Flow Functions The program flow functions limit program execution or change the way the CPU executes the application program. Function Description The CALL function causes the logic execution to go immediately to the designated program block, external C block (parameterized or not), or parameterized block and execute it.
  • Page 320 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 5.11 Timers This section describes the PACSystems timing functions that are implemented in the FBD language. 5.11.1 Built-in Timer Function Blocks These function blocks use WORD Array instance data. The parameter that appears above the function block is a one-dimensional, three-word array in %R, %W, %P, %L, or symbolic memory that the timer uses to store its current value, preset value and control word.
  • Page 321 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 5.11.2 Standard Timer Function Blocks These functions blocks use Structure Variable instance data. Each invocation of a timer has associated instance data that persists from one execution of the timer to the next.
  • Page 322 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 5.12 Type Conversion Functions The Conversion functions change a data item from one number format (data type) to another. Many programming instructions, such as math functions, must be used with data of one type. As a result, data conversion is often required before using those instructions.
  • Page 323 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 Function Description WORD_TO_UINT: Converts a 16-bit string (WORD) value to UINT. For details, refer to Convert DWORD to DINT below. Convert to DINT (32-bit signed integer) BCD8_TO_DINT: Converts BCD8 to DINT. UINT_TO_DINT: Converts UINT to DINT.
  • Page 324 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 Function Description Convert to DWORD (32-bit bit string) Converts a double-precision signed integer (DINT) value to DWORD. For details, refer to Convert DINT to DWORD below. Truncate Rounds a REAL (32-bit signed real or floating-point) number down to a DINT number For details, refer to Conversion Functions in Section 4.
  • Page 325 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 5.12.2 Convert WORD to UINT Figure 209 These functions convert the input data into the equivalent single-precision unsigned integer (UINT) value, which it outputs to Q. The conversion to UINT does not change the original data. The output data can be used directly as input for another program function, as in the example.
  • Page 326 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 Operands Parameter Description Allowed Allowed Optional Types Operands Solve Order Calculated by the FBD editor. The value to convert to DINT. DWORD All except S, SA, SB, and SC The DINT equivalent value of the UINT All except S, SA, original input value in IN.
  • Page 327 CPU Programmer’s Reference Manual Section 5 GFK-2950K Feb 2023 5.12.5 Convert DINT to DWORD Figure 213 When DINT_TO_DWORD receives data, it converts the input double-precision signed integer (DINT) data into the equivalent DWORD (32-bit bit string) value, which it outputs to Q. DINT_TO_DWORD does not change the original DINT data. The output data can be used directly as input for another program function.
  • Page 328: Service Request Function

    CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 Section 6 Service Request Function Use a Service Request function to request one of the following control system services: SVC_REQ 1: Change/Read Constant Sweep Timer • SVC_REQ 2: Read Window Modes and Time Values •...
  • Page 329: Ladder Diagram

    CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 The following Service Requests are used in CPU HSB redundancy applications. Refer to the PACSystems Hot Standby CPU Redundancy User’s Guide, GFK-2308. For non-HSB applications, refer to PACSystems RX7i, RX3i and RSTi-EP TCP/IP Ethernet Communications User Manual, GFK-2224.
  • Page 330 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 Operands Note: Indirect referencing is available for all register references (%R, %P, %L, %W, %AI, and %AQ). Operand Data Type Memory Area Description INT variable or All except %S - %SC Function number;...
  • Page 331 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 6.1.2 Function Block Diagram Figure 216 The SVC_REQ function requests the CPU to perform the special service identified by the FNC operand. Parameters for SVC_REQ are in the parameter block, which begins at the reference identified by the PRM operand.
  • Page 332 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 SVC_REQ 1: Change/Read Constant Sweep Timer Use SVC_REQ function 1 to: Disable Constant Sweep mode • Enable Constant Sweep mode and use the old Constant Sweep timer value • Enable Constant Sweep mode and use a new Constant Sweep timer value •...
  • Page 333 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 6.2.3 To enable Constant Sweep mode and use a new timer value: Enter SVC_REQ 1 with this parameter block: Address Address + 1 New timer value Note: If the timer value does not already exist, entering 0 causes the function to set the OK output to OFF.
  • Page 334 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 SVC_REQ 1 Example If contact OV_SWP is set, the Constant Sweep Timer is read, the timer is increased by 2 ms, and the new timer value is sent back to the CPU. The parameter block is at location %R3050.
  • Page 335 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 Mode Values Mode Name Value Description Limited Mode The execution time of the window is limited to its respective default value or to a value defined using SVC_REQ 3 for the controller communications window or SVC_REQ 4 for the systems communications window.
  • Page 336 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 SVC_REQ 3: Change Controller Communications Window Mode Use SVC_REQ 3 to change the controller communications window mode and timer value. The change takes place during the next CPU sweep after the function is called.
  • Page 337 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 SVC_REQ 4: Change Backplane Communications Window Mode and Timer Value Use SVC_REQ 4 to change the Backplane Communications window mode and timer value. The change takes place during the next CPU sweep after the function is called.
  • Page 338 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 Figure 220 SVC_REQ 5: Change Background Task Window Mode and Timer Value Use SVC_REQ 5 to change the Background Task window mode and timer value. The change takes place during the next CPU sweep after the function is called. SVC_REQ 5 executes unless a mode other than 0 (Limited) or 2 (Run-to-Completion) is selected.
  • Page 339 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 SVC_REQ 5 Example When enabling contact #FST_SCN is set in the first scan, the MOVE function establishes a value of 20ms for the Background task window, using a parameter block beginning at %P00050. Later in the program, when input %I00500 transitions on, the state of the Background task window toggles on and off.
  • Page 340 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 SVC_REQ 6: Change/Read Number of Words to Checksum Use SVC_REQ 6 to read the current word count in the program to be check-summed or set a new word count. By default, 16 words are checked. The function is successful unless some number other than 0 or 1 is entered as the requested operation.
  • Page 341: Contents

    CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 SVC_REQ 6 Example Figure 222 When enabling contact #FST_SCN is set, the parameter blocks for the checksum task function are built. Later in the program, when input %I00137 transitions on, the number of words being check-summed is read from the CPU operating system. This number is increased by 16, with the results of the ADD_UINT function being placed in the hold new count for set parameter.
  • Page 342 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 SVC_REQ 7: Read or Change the Time-of- Day Clock Use SVC_REQ 7 to read or change the time of day clock in the CPU. The function is successful unless: An invalid number is entered for the requested operation. •...
  • Page 343 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 The format and length of the parameter block depends on the data format and numbe r of digits required for the year: Data Format and N-digit Year Length of parameter block (number of words) BCD, 2-digit year BCD, 4-digit year...
  • Page 344 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 BCD, 2-Digit Year In BCD format, each time and date item occupy one byte, so the parameter block has six words. The last byte of the sixth word is not used. When setting the date and time, this byte is ignored;...
  • Page 345 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 POSIX The POSIX format of the Time-of-Day clock uses two signed 32-bit integers (two DINTs) to represent the number of seconds and nanoseconds since midnight January 1, 1970. Reading the clock in POSIX format might make it easier for your application to calculate time differences.
  • Page 346 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 Unpacked BCD (2-Digit Year) In Unpacked BCD format, each digit of the time and date items occupies the low- order four bits of a byte. The upper four bits of each byte are always zero. This format requires nine words.
  • Page 347 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 Numeric, 2-Digit Year In numeric format, the year, month, day of month, hours, minutes, seconds and day of week each occupy one unsigned integer. To read and/or change the date and time using the numeric format, enter SVC_REQ function #7 with this parameter block: Example Parameter Block Format...
  • Page 348 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 Packed ASCII, 2-Digit Year In Packed ASCII format, each digit of the time and date items is an ASCII formatted byte. Spaces and colons are embedded into the data to format it for printing or display.
  • Page 349 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 Packed ASCII, 4-Digit Year ASCII format for a 4-digit year requires 13 words in the parameter block. Values are hexadecimal. Example (Mon., Oct. 5, 2005, at 11:13:25 p.m. = Parameter Block Format Address 23:13:25 in 24-hour format) 1 = change or 0 = read Address...
  • Page 350 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 Figure 223 SVC_REQ 8: Reset Watchdog Timer Use SVC_REQ 8 to reset the watchdog timer during the scan. Ordinarily, when the watchdog timer expires, the CPU stops and goes into an error state without warning.
  • Page 351 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 6.10 SVC_REQ 9: Read Sweep Time from Beginning of Sweep Use SVC_REQ 9 to read the time in milliseconds since the start of the sweep. The data format is unsigned 16-bit integer. Output The parameter block is an output parameter block only;...
  • Page 352 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 6.11 SVC_REQ 10: Read Target Name Use SVC_REQ 10 to read the name of the currently executing target. Output The output parameter block has a length of four words. It returns eight ASCII characters: the target name (from one to seven characters) followed by null characters (00h).
  • Page 353 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 6.12 SVC_REQ 11: Read Controller ID Use SVC_REQ 11 to read the name of the controller executing the program. Output The output parameter block has a length of four words. It returns eight ASCII characters: the Controller ID (from one to seven characters) followed by null characters (00h).
  • Page 354 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 6.13 SVC_REQ 12: Read Controller Run State Use SVC_REQ 12 to read the current RUN state of the CPU. Output The output parameter block has a length of one word. Address 1 = run/disabled 2 = run/enabled SVC_REQ 12 Example...
  • Page 355 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 6.14 SVC_REQ 13: Shut Down (STOP) CPU Use SVC_REQ 13 to stop the CPU after the specified number of scans has been performed. All outputs go to their designated default states at the start of the next CPU scan.
  • Page 356 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 6.15 SVC_REQ 14: Clear Controller or I/O Fault Table Use SVC_REQ 14 to clear either the Controller Fault Table or the I/O Fault Table. The SVC_REQ output is set ON unless some number other than 0 or 1 is entered as the requested operation.
  • Page 357 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 6.16 SVC_REQ 15: Read Last-Logged Fault Table Entry Use SVC_REQ 15 to read the last entry logged in the Controller Fault Table or the I/O Fault Table. The SVC_REQ output is set ON unless some invalid number is entered as the requested operation or the fault table is empty.
  • Page 358 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 Long/Short Value The first byte (low byte) of word address +1 contains a number that indicates the length of the fault-specific data in the fault entry. Possible values are as follows: Controller extended and non-extended 00 = 8 bytes (short) 01 = 24 bytes (long) fault tables...
  • Page 359 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 SVC_REQ 15 Example 2 Figure 235 The CPU is shut down when any fault occurs on an I/O module except when the fault occurs on modules in rack 0, slot 9 and in rack 1, slot 9. If faults occur on these two modules, the system remains running.
  • Page 360 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 High Byte Low Byte %R0600 %R0601 reference address long/short memory type %R0602 reference address offset %R0603 slot number rack number %R0604 block (bus address) I/O bus no. %R0605 point address %R0606 fault data In the program, the EQ_INT blocks compare the rack/slot address in the table to hexadecimal constants.
  • Page 361 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 SVC_REQ 16 Example The following logic is used in a block that is called infrequently. The screen shot was taken between calls to the block. The logic displayed calculates the number of seconds that have elapsed since the last time the block was called.
  • Page 362 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 Figure 236 Note: Higher resolution (in nanoseconds) can be obtained by using SVC_REQ 50: Read Elapsed Time Clock. Service Request Function...
  • Page 363 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 6.18 SVC_REQ 17: Mask/Unmask I/O Interrupt Use SVC_REQ 17 to mask or unmask an interrupt from an input/output board. When an interrupt is masked, the CPU does not execute the corresponding interrupt block when the input transitions and causes an interrupt.
  • Page 364 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 When the interrupt is not masked, the CPU processes the interrupt and schedules the associated program logic for execution. When the interrupt is masked, the CPU processes the interrupt but does not schedule the associated program logic for execution.
  • Page 365 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 SVC_REQ 17 Example 2 Figure 238 When %T00001 transitions on, alarm interrupts from input %AI0006 are masked. The parameter block at %R00100 is set up on the first scan. 6.19 SVC_REQ 18: Read I/O Forced Status Use SVC_REQ 18 to read the current status of forced values in the CPU's %I and %Q memory areas.
  • Page 366 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 6.20 SVC_REQ 19: Set Run Enable/Disable Use SVC_REQ 19 to permit the LD program to control the RUN mode of the CPU. The parameter passed indicates which function to perform. The OK output is turned ON if the function executes successfully.
  • Page 367 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 6.21 SVC_REQ 20: Read Fault Tables Use SVC_REQ 20 to retrieve the entire Controller or I/O Fault Table and return it to the LD program in designated registers. The first input parameter designates which table is to be read. A second input parameter (always zero for the standard Read Fault Tables) is used by the extended format to read a designated fault entry or to read a range of fault entries.
  • Page 368 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 Non-Extended Output Parameter Block Format Controller Fault Table Output I/O Fault Table Output Format Format Address High Byte Low Byte High Byte Low Byte 2018 00h = Controller Fault 01h = I/O Fault Address+0 Unused Table...
  • Page 369 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 Format of Returned Data for Fault Table Entries Format for Parameter Setting 00h or 01h Controller Fault Table (00h) I/O Fault Table (01h) Output Output Format Format Address High Byte Low Byte High Byte Low Byte Unused...
  • Page 370 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 Format for Parameter Setting 41h Address I/O Fault Table with Remote Fault Record (0x41) Output Format High Byte Low Byte Address+21 Memory type Long/Short Address+22 Offset Address+23 Slot Rack Address+24 Remote Slot Remote Rack Address+25 Remote Sub-Slot...
  • Page 371 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 6.21.2 Extended Formats Each extended format request can read a maximum of 64 faults, or the size of the fault table if it contains fewer than 64 faults. For extended formats (Read Extended Controller Fault Table (80h), Read Extended I/O Fault Table (81h) or Read Extended I/O Fault Table with Remote Fault Record (C1h)), the controller calculates the number of entries being read.
  • Page 372 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 Address I/O Fault Table Output Format High Byte Low Byte Address Unused C1h = Extended I/O Fault Table with Remote Fault Record Address+1 Starting index of faults to be read Address+2 Number of faults to be read Address+3—Address+14 Unused...
  • Page 373 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 Format of Returned Data for Fault Table Entries Format for Parameter Setting 0x80h & 0x81h Controller Fault Table (0x80) I/O Fault Table (0x81) Output Output Format Format Address High Byte Low Byte High Byte Low Byte Reference...
  • Page 374 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 Format for Parameter Setting 0xC1h I/O Fault Table with Remote Fault Record (0xC1) Output Format Address High Byte Low Byte Address+37 Reference address memory type Long/Short Value Address+38 Reference address offset Address+39 Slot Rack...
  • Page 375 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 SVC_REQ 20 Example 1: Non-Extended Format When Read_PLC transitions on, a value of 0 is moved to the parameter block, which is located at %R00500, and the Controller Fault Table is read. When Read_IO transitions on, a value of 1 is moved to the parameter block and the I/O Fault Table is read.
  • Page 376 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 6.22 SVC_REQ 21: User-Defined Fault Logging Use SVC_REQ 21 to define a fault that can be displayed in the Controller Fault Table. The fault contains binary information or an ASCII message. The user-defined fault codes start at 0 hex.
  • Page 377 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 The fault text bytes 1 – 24 can be used to pass binary or ASCII data with the fault. If the first byte of the fault text data is non-zero, the data will be an ASCII message string.
  • Page 378 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 For IN2, the input is 2D45. The low byte, 45, decodes to the letter E and the high byte, 2D, decodes to -. Continuing in this manner, the string continues with S T O P O and N.
  • Page 379 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 6.24 SVC_REQ 23: Read Master Checksum Use SVC_REQ 23 to read master checksums for the set of user program(s) and the configuration, and to read the checksum for the block from which the service request is made.
  • Page 380 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 SVC_REQ 23 Example Figure 245 When the timer using registers %P00013 through %P00015 expires, the checksum read is performed. The checksum data returns in registers %P00016 through %P00030. The master program checksum in registers %P00022 and %P00023 (the program checksum is a DWORD data type and occupies two adjacent registers) is compared with the last saved master program checksum.
  • Page 381 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 6.25 SVC_REQ 24: Reset Module Use SVC_REQ 24 to reset a daughterboard or some modules. Modules that support SVC_REQ 24 include: RX3i IC693BEM331, IC694BEM331, IC693APU300, IC694APU300, IC695ETM001, IC693ALG2222, IC694ALG2222, IC695PNC001 RX7i: Embedded Ethernet Interface module, IC697BEM731, IC698BEM731, IC697HSC700, IC697ALG230, IC698ETM001 The SVC_REQ output is set ON unless one of the following conditions exists:...
  • Page 382 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 SVC_REQ 24 Example Figure 246 This example resets the module in rack0/slot 2. In rung 1, when contact %I00200 is closed, the positive transition coil sets %I00250 to ON for one sweep. The MOVE_WORD instruction in rung 2 receives power flow and moves the value 2 into %R00500.
  • Page 383 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 6.26 SVC_REQ 25: Disable/Enable EXE Block and Standalone C Program Checksums Use SVC_REQ 25 to enable or disable the inclusion of EXE in the background checksum calculation. The default is to include the checksums. This service request uses only an input parameter block.
  • Page 384 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 6.27 SVC_REQ 29: Read Elapsed Power Down Time Use SVC_REQ 29 to read the amount of time elapsed between the last power-down and the most recent power-up. If the watchdog timer expired before power-down, the CPU is not able to calculate the power down elapsed time, so the time is set to This service request cannot be accessed from a C block.
  • Page 385 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 6.28 SVC_REQ 32: Suspend/Resume I/O Interrupt Use SVC_REQ 32 to suspend a set of I/O interrupts and cause occurrences of these interrupts to be queued until these interrupts are resumed. The number of I/O interrupts that can be queued depends on the I/O module’s capabilities.
  • Page 386 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 SVC_REQ 32 Example Figure 249 Interrupts from the high-speed counter module whose starting point reference address is %I00065 will be suspended while the CPU solves the logic of the second rung. Without the Suspend, an interrupt from the HSC could occur during execution of the third rung and %T00006 could be set while %R000001 has a value other than 3,400.
  • Page 387 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 6.29 SVC_REQ 45: Skip Next I/O Scan Use the SVC_REQ function #45 to skip the next output and input scans. Any changes to the output reference tables during the sweep in which the SVC_REQ #45 was executed will not be reflected on the physical outputs of the corresponding modules.
  • Page 388 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 6.30 SVC_REQ 50: Read Elapsed Time Clock Use SVC_REQ 50 to read the system’s elapsed time clock. The elapsed time clock measures the time in seconds since the CPU was powered on. The parameter block has a length of four words used for output only.
  • Page 389 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 SVC_REQ 50 Example The following logic is used in a block that is called occasionally. The screen shot was taken between calls to the block. The second rung of logic calculates the number of seconds that have elapsed since the last time the block was called.
  • Page 390 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 6.31 SVC_REQ 51: Read Sweep Time from Beginning of Sweep Use SVC_REQ 51 to read the time in nanoseconds since the start of the sweep. The data is unsigned 32-bit integer. Output The parameter block is an output parameter block only;...
  • Page 391: Nonvolatile Storage

    CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 6.32 SVC_REQ 56: Logic Driven Read of Nonvolatile Storage CAUTION This Service Request is not supported on CPE330 and CPE400 CPUs. PACSystems controllers support a 64 KB nonvolatile flash memory area, which can be accessed by the logic-driven read/write service requests.
  • Page 392 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 6.32.2 Restoring data values on CPE200 Series Criteria for a successful restoration from removable media to internal PLC storage: The data must be from the same family of PLC (CPE200 Series) •...
  • Page 393: Parameter Block

    CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 6.32.4 Maximum of One Active Instruction When SVC_REQ 56 is active, it does not support an interrupt that attempts to activate SVC_REQ 57 or a second instance of SVC_REQ 56. If an attempt fails, an error indicating that another instance is active will be returned.
  • Page 394 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 Address + 4 Destination memory. The CPU memory area to write the read data to. This does not need to be the same memory area as specified at [address]. Writing to a different memory area enables you to compare the values that were already in the CPU with the values read from nonvolatile storage.
  • Page 395 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 Memory Type Codes Type Decimal Value Type Decimal Value %G (byte mode) %I (bit mode) %Q (bit mode) %I (byte mode) %T (bit mode) %Q (byte mode) %M (bit mode) %T (byte mode) %G (bit mode) %M (byte mode) Response Status Codes for SVC_REQ 56...
  • Page 396 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 SVC_REQ 56 Example The following LD logic reads ten continuous bytes written to nonvolatile storage from %G1—%G80 into %G193—%G273. The value applied to IN1, 56, selects byte mode. The parameter block starts at %R00040. The response words are returned to %R00049 and %R00050.
  • Page 397 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 6.33 SVC_REQ 57: Logic Driven Write to Nonvolatile Storage PACSystems controllers support a 64 KB nonvolatile flash memory area that can be accessed by the logic-driven read/write service requests. Values are stored in the nonvolatile storage area using SVC_REQ 57.
  • Page 398 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 You can write up to 32 words (64 bytes) inclusively per invocation of SVC_REQ 57. Each invocation requires 4 words of command data (8 bytes). A 1-byte write requires 9 bytes whereas a 64-byte write requires 72 bytes. You can generally make the most efficient use of nonvolatile storage by transferring data in 56-byte increments, since this will actually write 64 bytes to the device.
  • Page 399 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 6.33.4 Discrete Memory Discrete memory can be written to as individual bits or as bytes. For more information, see Address. Force and transition information is not written to nonvolatile storage. 6.33.5 Creating a Removable Nonvolatile Storage Backup On PACSystems controllers that support creation of backup data on removeable media, the user only needs to execute a write service request with the removable...
  • Page 400: Error Checking

    CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 6.33.6 Retentiveness Writing values to nonvolatile storage for non-retentive memory such as %T does not make the memory retentive. For example, all values stored to %T memory are set to zero on power-up or a STOP Mode to RUN Mode transition. You can, however, read such values from storage after power-up or STOP Mode to RUN Mode transition by using SVC_REQ 56.
  • Page 401 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 6.33.10 Fragmentation Due to the nature of the media in PACSystems CPUs, writes may produce fragmentation of the memory. That is, small portions of the memory may become unavailable, depending upon the sequence of the writes and the size of each one. Data is stored on the device in 128 512-byte sections.
  • Page 402 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 Clear the flash memory, or Write to flash. The flash is erased prior to writing, which frees up some space. Download the initial values to the controller. Start the controller. Use SVC_REQ 57 to write the desired values from controller memory to nonvolatile storage.
  • Page 403 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 6.33.15 Parameter Block for SVC_REQ 57 Address + Offset Description Address+0 Memory type. Refer to Memory Type Codes above. Address+1 The zero-based offset N to write to nonvolatile storage. Contains the complete offset for any memory area except %W, which also requires the use of address + 2 for Address+2 offsets greater than 65,535.
  • Page 404 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 Response Status Codes for SVC_REQ 57 Minor Major Description Success. All values requested were written. Existing values found. All values requested are in storage, but one or more values were already stored. Insufficient source memory.
  • Page 405 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 SVC_REQ 57 Example The following LD logic writes ten continuous bytes to nonvolatile storage, ranging from %G1 through %G80. The value applied to IN1, 56, determines byte mode. The parameter block starts at %R00050. The response words are returned to %R00056—%R00059.
  • Page 406 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 6.34 SVC_REQ 63: Logic Driven Write of Reference Memory This Service Request is supported on the CPE330 only. However, when a CPU is configured for Hot Standby Redundancy, this Service Request will not be available. PACSystems controllers support four storage locations in nonvolatile memory, which can be written to or deleted by this Service Request.
  • Page 407: Data Deletion

    CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 6.34.2 Data Deletion The data in the storage locations can be deleted by one of several methods: Use of the Service Request function block in Run mode (See below.) • Any Stop Mode store to RAM •...
  • Page 408 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 There are two special values for the Length parameter. If the Length is set to zero, any data in the specified storage location will be deleted. The Memory Type and Starting Offset are ignored. If the Length is set to the maximum DWORD value of 16#FFFF FFFF, then the entire table specified by the Memory Type (Address+2) will be written to the storage location.
  • Page 409: Status Word

    CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 6.34.5 Status Word The Status Word is the first word of the Command Block. The least-significant byte (LSB) is the major code, and the most-significant byte (MSB) is the minor code. These are defined in the table below.
  • Page 410 CPU Programmer’s Reference Manual Section 6 GFK-2950K Feb 2023 Parameter Block Address + Input Address Definition Offset Value Address+0 %R00001 Status Word. Always initialized to zero. Address+1 %R00002 Writing to Storage Location 0. Address+2 %R00003 Saving data from the %AI table. Address+3 %R00004 Starting offset is %AI00021...
  • Page 411 CPU Programmer’s Reference Manual Section 7 GFK-2950K Feb 2023 Section 7 PID Built-In Function Block This chapter describes the PID (Proportional plus Integral plus Derivative) built-in function block, which is used for closed-loop process control. The PID function compares feedback from a process variable (PV) with a desired process set point (SP) and updates a control variable (CV) based on the error.
  • Page 412 CPU Programmer’s Reference Manual Section 7 GFK-2950K Feb 2023 Operands of the PID Function • Reference Array for the PID Function • Operation of the PID Function • PID Algorithm Selection (PIDISA or PIDIND) and Gain Calculations • Determining the Process Characteristics •...
  • Page 413 CPU Programmer’s Reference Manual Section 7 GFK-2950K Feb 2023 Operands of the PID Function Figure 256 7.1.1 Operands for LD Version of PID Function Block Parameter Description Allowed Allowed Optional Types Operands Instance Variable name of the PID Parameter WORD R, L, P, W (????) Block array, which contains user-configurable and...
  • Page 414 CPU Programmer’s Reference Manual Section 7 GFK-2950K Feb 2023 Parameter Description Allowed Allowed Optional Types Operands The control variable output to the process. Often INT, BOOL All except a %AQ output. array of %S and length 16 constant or more 7.1.2 Operands for FBD Version of PID Function Block Figure 257...
  • Page 415 CPU Programmer’s Reference Manual Section 7 GFK-2950K Feb 2023 Parameter Description Allowed Allowed Optional Types Operands If energized along with MAN, decreases the control BOOL, Power variable by 1 CV count per solution of the PID function Flow block. The control variable output to the process. Often a %AQ INT, BOOL All except %S output.
  • Page 416 CPU Programmer’s Reference Manual Section 7 GFK-2950K Feb 2023 7.2.2 Reference Array Parameters Note: Machine Edition software allows you to modify the configurable parameters for a PID instruction in real time in online programmer mode. To customize PID parameters, right click the PID function and select Tuning. Low Bit Words Parameter/Description...
  • Page 417 CPU Programmer’s Reference Manual Section 7 GFK-2950K Feb 2023 Low Bit Words Parameter/Description Range Units Error changes by 4 PV Counts every 30ms. Kd can be used to speed up a slow loop response but is very sensitive to PV input noise. This noise sensitivity can be reduced by using the derivative filter, which is enabled by setting bit 5 of the Config Word .
  • Page 418 CPU Programmer’s Reference Manual Section 7 GFK-2950K Feb 2023 Low Bit Words Parameter/Description Range Units The integral term value is adjusted if the CV rate limit is exceeded. When Minimum Slew Time is 0, there is no CV rate limit. Set Minimum Slew Time to 0 while tuning or adjusting PID loop gains.
  • Page 419 CPU Programmer’s Reference Manual Section 7 GFK-2950K Feb 2023 Low Bit Words Parameter/Description Range Units When this bit is set to 0, no filtering is applied to the derivative term. When set to 1, a first order filter is applied. This will limit the effects of higher frequency process disturbances, such as measurement noise, on the derivative term.
  • Page 420 CPU Programmer’s Reference Manual Section 7 GFK-2950K Feb 2023 Low Bit Words Parameter/Description Range Units Word is set to 1. Internal CV Set and Non-configurable. maintained (Address+16) Tracks CV output. by the CPU. Internal PV Set and Non-configurable, maintained unless bit 0 (Address+17) Tracks PV input.
  • Page 421 CPU Programmer’s Reference Manual Section 7 GFK-2950K Feb 2023 Low Bit Words Parameter/Description Range Units (Address+29) Word 30 is reserved. Do not use this location. 31, 32 Previous Derivative Term Storage Set and Non-configurable. (Address+30, Used in calculations for derivative filter. Do not write to these locations. maintained Address+31) by the CPU.
  • Page 422: Automatic Operation

    CPU Programmer’s Reference Manual Section 7 GFK-2950K Feb 2023 Operation of the PID Function 7.3.1 Automatic Operation When the PID function block is called, it compares the current CPU time with the last PID solution time stored in the reference array. If the interval between the two times is equal to or greater than the Sample Period (word 3 of the reference array) and also equal to or greater than 10 ms, the PID algorithm is solved using this time interval.
  • Page 423 CPU Programmer’s Reference Manual Section 7 GFK-2950K Feb 2023 by the Minimum Slew Time, and the CV cannot go above the CV Upper Clamp limit or below the CV Lower Clamp limit. In order to assure a bump-less transfer from Manual back to Automatic mode, the user program should copy the PV to the SP before switching back to Automatic mode.
  • Page 424 CPU Programmer’s Reference Manual Section 7 GFK-2950K Feb 2023 The Independent term PID (PID_IND) algorithm calculates the output as: PID Output = Kp * Error + Ki * Error * dt + Kd * Derivative + CV Bias where Kp is the proportional gain, Ki is the integral rate, Kd is the derivative time, and dt is the time interval since the last solution.
  • Page 425 CPU Programmer’s Reference Manual Section 7 GFK-2950K Feb 2023 7.4.1 Derivative Term The Derivative Term is Kd (word 7 of the reference array) multiplied by the time rate of change of the Error term in the interval since the last PID solution. Derivative = Kd * Δ...
  • Page 426 CPU Programmer’s Reference Manual Section 7 GFK-2950K Feb 2023 7.4.4 Combined Operation of Error Term and Derivative Action Modes Bit 0 of Config Word Bit 2 of Config Word Error Term Derivative Value Value Error Term Mode Value Action Reverse Acting (default) Δ...
  • Page 427 CPU Programmer’s Reference Manual Section 7 GFK-2950K Feb 2023 to be limited. For example, windup would prevent the CV output from moving off a clamp value immediately. There are two optional methods for preventing reset windup. If the Anti-reset- windup Action bit (bit 4) of Config Word (word 13 of the reference array) is zero (the default), the integral term is adjusted at each PID solution to match the error input and limited CV output exactly.
  • Page 428 CPU Programmer’s Reference Manual Section 7 GFK-2950K Feb 2023 The Sample Period should be no bigger than the total time constant divided by 10 (or down to 5 worst case). For example, if PV seems to reach about 2/3 of its final value in 2 seconds, the Sample Period should be less than 0.2 seconds, or 0.4 seconds worst case.
  • Page 429 CPU Programmer’s Reference Manual Section 7 GFK-2950K Feb 2023 Plotting the response to a step input at time t0 in the time domain provides an open-loop unit reaction curve: Figure 259 The following process model parameters can be determined from the PV unit reaction curve: Process open loop gain = final change in PV/change in CV at time t (Note no subscript on K)
  • Page 430 CPU Programmer’s Reference Manual Section 7 GFK-2950K Feb 2023 Setting Tuning Loop Gains 7.6.1 Basic Iterative Tuning Approach Because PID parameters are dependent on the process being controlled, there are no predetermined values that will work. However, a simple iterative process can be used to find acceptable values for Kp, Ki, and Kd gains.
  • Page 431 CPU Programmer’s Reference Manual Section 7 GFK-2950K Feb 2023 7.6.2 Setting Loop Gains Using the Ziegler and Nichols Tuning Approach This approach provides good response to system disturbances with gains producing an amplitude ratio of 1/4. The amplitude ratio is the ratio of the second peak over the first peak in the closed loop response.
  • Page 432 CPU Programmer’s Reference Manual Section 7 GFK-2950K Feb 2023 PID Example The following PID example has a sample period of 100ms, a Kp gain of 4.00 and a Ki gain of 1.500. The set point is stored in %R0001, the control variable is output in %AQ0002, and the process variable is returned in %AI0003.
  • Page 433 CPU Programmer’s Reference Manual Section 7 GFK-2950K Feb 2023 Figure 260 : PID Example Logic PID Built-In Function Block...
  • Page 434: Structured Text (St)

    CPU Programmer’s Reference Manual Section 8 GFK-2950K Feb 2023 Section 8 Structured Text (ST) Programming The Structured Text (ST) programming language is an IEC 61131-3 textual programming language. This chapter describes how structured text is implemented in PACSystems. For information on using the structured text editor in the programming software, refer to the online help.
  • Page 435 CPU Programmer’s Reference Manual Section 8 GFK-2950K Feb 2023 Structured Text (ST) Programming...
  • Page 436 CPU Programmer’s Reference Manual Section 8 GFK-2950K Feb 2023 Statement Types. 8.1.2 Expressions Expressions use operators to calculate values from variables and constants. An example of a simple expression is (x+5). Composite expressions can be created by nesting simpler expressions, for example, (a+b)*(c+d)–3.0 ** 4.
  • Page 437 CPU Programmer’s Reference Manual Section 8 GFK-2950K Feb 2023 INT, DINT, UINT, REAL, Division 9, 11 LREAL INT, DINT, UINT Modulus operation Group 5 INT, DINT, UINT, REAL, Addition LREAL INT, UINT, DINT, REAL, Subtraction LREAL Group 6 <, >, <=, >= INT, DINT, UINT, REAL, Comparison LREAL, BYTE, WORD,...
  • Page 438 CPU Programmer’s Reference Manual Section 8 GFK-2950K Feb 2023 [ ] used for array indexing where the array index is an integer. For example, this sets the third element of an array to the value j+10: intarray[3]: = j + 10; (* *) designates a comment.
  • Page 439 CPU Programmer’s Reference Manual Section 8 GFK-2950K Feb 2023 Structured Text (ST) Programming...
  • Page 440: Statement Types

    CPU Programmer’s Reference Manual Section 8 GFK-2950K Feb 2023 Statement Types The Structured Text statements, which specify the actual program execution, consist of the following types, which are described in more detail on the following pages. Statement Description Example Type Assignment Sets an object to a specified value.
  • Page 441: Assignment Statement

    CPU Programmer’s Reference Manual Section 8 GFK-2950K Feb 2023 Statement Description Example Type ARG_PRESENT Determines whether a parameter value was present when ARG_PRES (IN :=In1, Q:>Out1, ENO:>Out2); the function block instance of the parameter was invoked. For example, a parameter can be optional (pass by value). Empty Statement 8.2.1...
  • Page 442: Function Call

    CPU Programmer’s Reference Manual Section 8 GFK-2950K Feb 2023 8.2.2 Function Call The structured text function call executes a predefined algorithm that performs a mathematical, bit string or other operation. The function call consists of the name of the function or block followed by required input or output parameters. The structured text logic can call blocks or the PACSystems built-in functions listed in the table below.
  • Page 443 CPU Programmer’s Reference Manual Section 8 GFK-2950K Feb 2023 Category Functions More information Data Conversion BCD4_TO_INT, BCD4_TO_UINT, Section 4 BCD4_TO_REAL BCD8_TO_DINT, BCD8_TO_REAL DINT_TO_BCD8, DINT_TO_DWORD, DINT_TO_INT, DINT_TO_UINT, DINT_TO_REAL, DINT_TO_LREAL DWORD_TO_DINT INT_TO_BCD4, INT_TO_DINT, INT_TO_UINT, INT_TO_REAL, INT_TO_WORD UINT_TO_BCD4, UINT_TO_BCD8, UINT_TO_INT, UINT_TO_DINT, UINT_TO_REAL, UINT_TO_WORD REAL_TO_INT, REAL_TO_UINT, REAL_TO_DINT, REAL_TO_LREAL LREAL_TO_DINT, LREAL_TO_REAL...
  • Page 444 CPU Programmer’s Reference Manual Section 8 GFK-2950K Feb 2023 Format of Calls to Standard Timer Function Blocks Notes: • TOF, TON and TP have the same input and output parameters, except for the instance variable, which must be the same type as the instruction. •...
  • Page 445 CPU Programmer’s Reference Manual Section 8 GFK-2950K Feb 2023 Block Types Supported for ST Calls An ST block can call blocks of type Block, Parameterized Block, or user defined Function Block (UDFB) or External Block (C block). For more information on block types, refer to Section 2.
  • Page 446: Return Statement

    CPU Programmer’s Reference Manual Section 8 GFK-2950K Feb 2023 8.2.3 RETURN Statement The return statement provides an early exit from a block. For example, in the following lines of code the third line will never execute. The variable a will have the value 4.
  • Page 447: Operation

    CPU Programmer’s Reference Manual Section 8 GFK-2950K Feb 2023 Operation The following of evaluation occurs if both optional parts are present: sequence If BooleanExpression1 is TRUE (1), StatementList1 is executed. Program • execution continues with the statement following the END_IF keyword. If BooleanExpression1 is FALSE (0) and BooleanExpression2 is TRUE (1), •...
  • Page 448: Case Statement

    CPU Programmer’s Reference Manual Section 8 GFK-2950K Feb 2023 8.2.5 CASE Statement The CASE …. OF construct offers conditional execution of statement lists. It uses the value of an ST integer expression to determine whether to execute a statement list. The statement list to be executed can be selected from multiple statement lists, depending on the value of the associated integer expression.
  • Page 449 CPU Programmer’s Reference Manual Section 8 GFK-2950K Feb 2023 Operation The Int values are compared to Integer_Expression. The statement list following the first Int value that matches Integer_Expression is executed. If the optional ELSE keyword is used and no Int value matches Integer_Expression, the statement list following ELSE is executed.
  • Page 450 CPU Programmer’s Reference Manual Section 8 GFK-2950K Feb 2023 8.2.6 FOR … DO Statements The FOR loop repeatedly executes a statement list contained within the FOR…DO…END_FOR construct. It is useful when the number of iterations can be predicted in advance, for example to initialize an array. The number of iterations is determined by the value of a control variable which is incremented (or decremented) from an initial value to a final value by the FOR statement.
  • Page 451 CPU Programmer’s Reference Manual Section 8 GFK-2950K Feb 2023 The termination condition of a FOR loop depends on the sign of the step value. Step Value Termination Condition > 0 Control_Variable > End_Value < 0 Control Variable < End Value None.
  • Page 452: While Statement

    CPU Programmer’s Reference Manual Section 8 GFK-2950K Feb 2023 8.2.7 WHILE Statement The WHILE loop repeatedly executes (iterates) a statement list contained within the WHILE…END_WHILE construct as long as a specified condition is TRUE (1). It checks the condition first, then conditionally executes the statement list. This looping construct is useful when the statement list does not necessarily need to be executed.
  • Page 453 CPU Programmer’s Reference Manual Section 8 GFK-2950K Feb 2023 8.2.8 REPEAT Statement The REPEAT loop repeatedly executes (iterates) a statement list contained within the REPEAT…END_REPEAT construct until an exit condition is satisfied. It executes the statement list first, then checks for the exit condition. This looping construct is useful when the statement list needs to be executed at least once.
  • Page 454 CPU Programmer’s Reference Manual Section 8 GFK-2950K Feb 2023 8.2.9 ARG_PRES Statement The ARG_PRES function determines whether an input parameter value was present when the function block instance of the parameter was invoked. This may be necessary if the parameter is optional (pass by value). This function must be called from a function block instance or a parameterized block.
  • Page 455: Exit Statement

    CPU Programmer’s Reference Manual Section 8 GFK-2950K Feb 2023 8.2.10 Exit Statement The EXIT statement is used to terminate and exit from a loop (FOR, WHILE, REPEAT) before it would otherwise terminate. Program execution resumes with the statement following the loop terminator (END_FOR, END_WHILE, END_REPEAT). An EXIT statement is typically used within an IF statement.
  • Page 456 CPU Programmer’s Reference Manual Section 8 GFK-2950K Feb 2023 8.2.11 Data_Qual Function Blocks for Structured Text The below functions implement the CHECK_DATA_QUAL function blocks. These are only supported using the structured text language (ST). They are used to determine whether a data item was transmitted without error from an input device into an I/O module or from an I/O module to an output device.
  • Page 457 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 Section 9 Diagnostics This chapter explains the PACSystems fault handling system, provides definitions of fault extra data, and suggests corrective actions for faults. Faults occur in the control system when certain failures or conditions happen that affect the operation and performance of the system.
  • Page 458 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 Fault Handling Overview • Using the Fault Tables • System Handling of Faults • • Controller Fault Descriptions and Corrective Actions Diagnostics...
  • Page 459 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 I/O Fault Descriptions and Corrective Actions • Diagnostics...
  • Page 460: Fault Handling Overview

    CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 Fault Handling Overview The PACSystems CPU detects three classes of faults: Fault Class Examples Internal Failures (Hardware) Non-responding modules Failed battery Failed Energy Pack (CPE302/CPE305/CPE310/CPE330 models) Memory checksum errors External I/O Failures (Hardware) Loss of rack or module Addition of rack or module Loss of Genius I/O block...
  • Page 461 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 9.1.3 Fault Actions and Fault Action Configuration Fatal faults cause the fault to be recorded in the appropriate table, diagnostic variables to be set, and the system to be stopped. Only fatal faults cause the system to stop.
  • Page 462 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 Using the Fault Tables To display the fault tables in Logic Developer software, Go online with the PACSystems. Select the Project tab in the Navigator, right click the Target node and choose Diagnostics.
  • Page 463 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 Viewing Controller Fault Details Note The fault action displayed in the expanded fault details indicates the fault action specified by the fault that was logged, but not necessarily the executed fault action. To determine what action was executed for a particular fault in a configurable fault group, you must refer to the hardware configuration settings.
  • Page 464 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 9.2.2 I/O Fault Table The I/O Fault Table displays I/O faults such as circuit faults, address conflicts, forced circuits, I/O module addition/loss faults and I/O bus faults. The fault table displays a maximum of 64 faults. When the fault table is full, it displays the earliest 32 faults (33—64) and the last 32 faults (1—32).
  • Page 465 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 Viewing I/O Fault Details To see I/O fault details, click the fault entry. The detailed information box for the fault appears. (To close this box, click the fault.) Figure 264 : I/O Fault Table Fault Entry Detail Display The detailed information for I/O faults includes: I/O Bus When the module in the slot is a Genius Bus Controller (GBC), this number is...
  • Page 466 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 System Handling of Faults The system fault references listed below can be used to identify the specific type of fault that has occurred. (A complete list of System Status References is provided in Section 3.) System Address...
  • Page 467 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 9.3.1 System Fault References When a system fault reference is set, additional fault references are also set. These other types of faults are listed in Fault References for Configurable Faults below and Note: If the fault action for a fault logged to the fault table is informational, the configured action is not used.
  • Page 468 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 Fault (Default Address Description May Also Be Set Action) #CFG_MM %SA0009 Configuration mismatch. #SY_FLT, #SY_PRES (fatal) Wrong module type detected. The CPU does not check the configuration parameter settings individual modules such as Genius I/O blocks.
  • Page 469 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 Fault Address Description Result #ADD_IOC %SA0018 Extra IOC, previously faulted Sets #IO_FLT, #IO_PRES (diagnostic) Controller is no longer faulted. #ADD_IOM %SA0019 Extra IO module, or previously faulted Sets #IO_FLT, #IO_PRES (diagnostic) I/O module is no longer faulted.
  • Page 470 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 9.3.2 Using Fault Contacts Fault (-[F]-) and no-fault (-[NF]-) contacts can be used to detect the presence of I/O faults in the system. These contacts cannot be overridden. The following table shows the state of fault and no-fault contacts.
  • Page 471 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 Fault Reference Name Examples: Figure 265 #RACK_0001 represents rack 1. #SLOT_0105 represents rack 1, slot 5. #BUS_02041 represents rack 2, slot 4, bus 1. #M_2061028 represents rack 2, slot 6, bus 1, Genius module 28. Note: When a slot level failure fault is reported to the fault tables, all bus and module fault locating references associated with that slot are set (the FAULT contact passes power...
  • Page 472: Using Alarm Contacts

    CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 If an analog base module (IC697ALG230) is lost, the fault locating reference for that module is set. The fault locating references for its expander modules (IC697ALG440 and ALG441) are not set as a result of the loss. Therefore, any fault locating references to an expander module should also reference the base module to verify that the module or its base have not been lost.
  • Page 473 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 Controller Fault Descriptions and Corrective Actions Each fault explanation contains a fault description and instructions to correct the fault. Many fault descriptions have multiple causes. In these cases, the error code and additional fault information are used to distinguish among fault conditions sharing the same fault description.
  • Page 474 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 9.4.2 Loss of or Missing Rack (Group 1) The fault group Loss of or Missing Rack occurs when the system cannot communicate with an expansion rack because the BTM (Bus Transmitter Module) in the main rack failed, the BRM (Bus Receiver Module) in the expansion rack failed, power failed in the expansion rack, or the expansion rack was configured in the configuration file but did not respond during power-up.
  • Page 475 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 9.4.3 Loss of Option Module (Group 4) The fault group Loss of Option Module occurs when a LAN interface module, BTM, or BRM fails to respond. The failure may occur at power-up or store of configuration if the module is missing or during operation if the module fails to respond.
  • Page 476 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 9.4.4 Addition of, or Extra Rack (Group 5) This fault group occurs when a configured expansion rack with which the CPU could not communicate comes online or is powered on, or an unconfigured rack is found. Action: Non-configurable.
  • Page 477 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 E Hex/14 Decimal, Option Module Hot inserted The CPU logs this fault when it detects hot insertion of an option module such as the LAN interface module. No correction necessary Note: When configuration is cleared or stored, a reset fault is generated for every intelligent option module physically present in the system.
  • Page 478 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 Installed/Configured Module Types (Bytes 2 and 3 of Fault Extra Data) Number Description Decimal Hexadecimal Genius Network Interface (GENI) Phase B Hand Held Monitor Phase B Series Six GBC with Diagnostics Phase B Series Six GBC without Diagnostics PLCM/Series Six PLCM/Series 90-70...
  • Page 479 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 Number Description Decimal Hexadecimal Phase B 24Vdc 4-input, 2-output Analog Block Phase B 220Vac 4-input, 2-output Analog Block Phase B 115Vac Thermocouple Input Block Phase B 24Vdc Thermocouple Input Block Phase B 115Vac RTD Input Block Phase B 24/48Vdc RTD Input Block Phase B 115Vac Strain Gauge/mV Analog Input Block Phase B 24Vdc Strain Gauge/mV Analog Input Block...
  • Page 480 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 4, I/O Type Mismatch The CPU generates this fault when the physical and configured I/O types of Genius grouped blocks are different. Correction Remove the indicated Genius module and install the module indicated in the configuration file.
  • Page 481 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 Genius Configured Module I/O Types (Byte 3 of Fault Extra Data) Value Description Decimal Hexadecimal Discrete input Discrete output Analog input Analog output Discrete grouped Analog grouped Analog in, discrete in Analog in, discrete out Analog in, discrete grouped Analog out, discrete in...
  • Page 482 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 Fault Extra Data for Genius I/O Block Size Mismatch Byte Value Bus address Module’s broadcast data length Configured module’s broadcast data length A hex/10 decimal, Unsupported Feature Configured feature not supported by this revision of the module. Correction Update the module to a revision that supports the feature.
  • Page 483 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 11 hex/17 decimal, LAN Softswitch/Modem mismatch Configuration of LAN module does not match modem type or configuration programmed by softswitch utility. Correction Correct configuration of modem type. Consult LAN Interface manual for configuration setup. 13 hex/19 decimal, DCD Length Mismatch Directed control data lengths do not match.
  • Page 484 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 27 hex/39 decimal, Unresolved or Disabled Interrupt Reference The CPU generates this error when an interrupt trigger reference is either out of range or disabled in the I/O module’s configuration. Correction Remove or correct the interrupt trigger reference.
  • Page 485 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 Correction Replace the module in the slot with the type indicated in the configuration file. Update the configuration file. 9.4.7 System Bus Error (Group 12) The fault group System Bus Error occurs when the CPU encounters a bus error. Default action: Diagnostic.
  • Page 486: All Others

    CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 All Others Correction Replace the module. Fault Extra Data for CPU Hardware Failure For a RAM failure in the CPU (one of the faults reported as a CPU hardware failure), the address of the failure is stored in the first four bytes of the field. 9.4.9 Module Hardware Failure (Group 14) The fault group Module Hardware Failure occurs when the CPU detects a non-fatal...
  • Page 487 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 9.4.10 Option Module Software Failure (Group 16) The fault group Option Module Software Failure occurs when: A non-recoverable software failure occurs on an intelligent option module. • The module type is not a supported type. •...
  • Page 488 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 >400, LAN System Software Fault The Ethernet interface software has detected an unusual condition and recorded an event in its exception log. The Fault Extra Data contains the corresponding event in the Ethernet exception log, which can be viewed by the Ethernet Interface’s Station Manager function.
  • Page 489 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 9.4.12 Battery Status (Group 18) Faults in this group occur when the CPU detects a failed battery (or Energy Pack). Action: Non-configurable. 0, Failed Battery CPUs with battery-backed RAM, including RX7i CPUs, and RX3i CPU310, CPU315, CPU/CRU320 and NIU001 The battery in the CPU module has failed or is disconnected.
  • Page 490 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 1, Low Battery – CPE302/CPE305/CPE310/CPE330 CPUs with Energy Pack The Status LED and the Controller fault table indicate the Energy Pack status. PLC_BAT LOW_BAT Energy Pack Status (%S0014) (%SA0011) Energy Pack connected and operational (may be charging) Energy Pack not connected or has failed Energy Pack is nearing its end-of-life and should be replaced.
  • Page 491 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 9.4.15 I/O Fault Table Full (Group 21) The fault group I/O Fault Table Full occurs when the I/O Fault Table reaches its maximum configured limit. To avoid loss of additional faults, clear the earliest entry from the table.
  • Page 492 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 1E - 21 hex (30 - 33 decimal), LAN Interface Fault Refer to the PAC Systems TCP/IP Ethernet Communications User Manual, GFK-2224 for a description of these errors. Please see the Diagnostics Chapter, 'Controller Fault Table'.
  • Page 493 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 Correction Increase the DLB Heartbeat setting. For additional information, refer to Executing DLBs. 3B hex /59 decimal, PSB called by a block whose %L or %P memory is not large enough to accommodate this reference.
  • Page 494 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 9.4.18 Power Supply Fault (Group 25) Action: Non-configurable. 1, Power supply failure. Unknown power supply failure. Correction Replace power supply module. 2, Power supply overloaded The load on the power supply has reached its rated maximum Correction Replace power supply with a higher capacity model or reconfigure system to reduce load on power supply.
  • Page 495 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 9.4.20 Corrupted User Program on Power-Up (Group 130) The fault group Corrupted User Program on Power-Up occurs when the CPU detects corrupted user RAM. The CPU will remain in STOP Mode. Action: Non-configurable.
  • Page 496 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 Correction Increase the constant sweep timer value. 1, Logic Window Skipped The logic window was skipped due to lack of time to execute. Correction Increase base cycle time. Reduce Communications Window time. 9.4.22 Password Access Failure (Group 132) The fault group Password Access Failure occurs when the CPU receives a request...
  • Page 497 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 9.4.24 CPU System Software Failure (Group 135) Faults in this group are generated by the operating software of the CPU. They occur at many different points of system operation. When a fatal fault occurs, the CPU immediately transitions to STOP/Halt.
  • Page 498 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 All Others, CPU Internal System Error An internal system error has occurred that should not occur in a production system. Correction Display the Controller Fault Table on the programmer. Contact Technical Support and give them all the information contained in the fault entry.
  • Page 499 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 0, Communications Failure During Store Correction Clear the fault and retry the download of the program or configuration file. 1, Communications Lost During RUN Mode Store Communications or power was lost during a RUN Mode Store. The new program or block was not activated and was deleted.
  • Page 500 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 9.4.26 Non-Critical CPU Software Event (Group 140) This group is used for recording conditions in the system that may provide valuable information to Technical Support. Default action: Non-configurable. Error Code Description Correction 1-30 Events during power-up...
  • Page 501 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 Hexadecimal Value (HV) Memory area %R (Register memory) %AI (Analog input memory) %AQ (Analog output memory) %I (Discrete input memory) %Q (Discrete output memory) %T (Discrete temporary status memory) %M (Discrete momentary internal memory) %SA (Discrete system memory A) %SB (Discrete system memory B) %SC (Discrete system memory C)
  • Page 502 To view the detailed information pertaining to a fault, click the fault entry in the I/O Fault Table. Emerson reserves the right to change the fault data without prior notice. Note: The model number mismatch and I/O type mismatch faults are reported in the controller fault table under the System Configuration Mismatch group.
  • Page 503 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 9.5.3 I/O Fault Categories Category Fault Type Fault Description Fault Extra Data Loss of User Side Power Circuit Configuration (01 hex) Short Circuit in User Wiring Circuit Configuration (02 hex) Sustained Overcurrent Circuit Configuration (04 hex) Low or No Current Flow...
  • Page 504 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 Category Fault Type Fault Description Fault Extra Data Input Channel Under Range Circuit Configuration (04 hex) Input Channel Over Range (08 Circuit Configuration hex) Input Channel Open Wire Circuit Configuration (10 hex) Wiring Error (20 hex) Circuit Configuration Internal Fault (40 hex)
  • Page 505 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 Category Fault Type Fault Description Fault Extra Data Configuration Memory Failure Headend Fault (0) (08 hex) A to D Comm. Calibration Memory Failure Genius Module Fault (1) (20 hex) Fault (8) User Scaling Error Shared RAM Failure (40 hex) Internal Circuit Fault (80 hex)
  • Page 506 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 Category Fault Type Fault Description Fault Extra Data Datagram queue full (1) R/W request queue full (2) Low priority mail rejected (3) Background GBC Software message received Exception (21) before CPU completed initialization (4) Genius software...
  • Page 507 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 9.5.4 Circuit Faults (Category 1) Circuit faults apply to Genius I/O modules and the IC697VRD008 RTD/Strain Bridge modules. Fault extra data is available for all faults in this category. More than one condition may be present in a particular reporting of the fault.
  • Page 508 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 Fault Descriptions for Discrete Faults (Fault Type 1) Fault Type Fault Description Description Correction Only valid for Isolated I/O blocks.) Initiate Pulse Test The GBC generates COMREQ #1. Pulse this error when there test may be enabled is a power loss on the Loss of User Side Power...
  • Page 509 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 Fault Descriptions for Analog Faults (Fault Type 2) Fault Type Fault Description Description Correction The GBC generates this error Correct the condition Input Channel Low when the Genius Analog causing the low alarm. Alarm (01 hex) module reports a low alarm on an input channel.
  • Page 510 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 Low-Level Analog Faults (Fault Type 4) 1, Input Channel Low Alarm The GBC generates this error when the Genius Analog module reports a low alarm on an input channel. Correction Correct the condition causing the low alarm. 2, Input Channel High Alarm The GBC generates this error when the Genius Analog module reports a high alarm on an input channel.
  • Page 511 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 Correction Correct the problem causing the condition. 40 hex/64 decimal, Internal Fault The GBC generates this error when the Genius Analog module reports a cold junction sensor fault on a thermocouple block or an internal error in an RTD block. Correction Correct the problem causing the condition.
  • Page 512 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 9.5.5 Loss of Block (Category 2) The fault category Loss of Block applies to Genius devices. Action: Diagnostic. Loss of Block The GBC generates this error when it is unable to communicate to the Genius device.
  • Page 513 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 9.5.6 Addition of Block (Category 3) The fault category Addition of Block applies only to Genius devices. There are no fault types or fault descriptions associated with this category. The Genius operating software generates this error when it detects that a Genius block that stopped communicating with the controller starts communicating again.
  • Page 514 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 Bus Outputs Disabled The GBC operating software generates this error when it times out waiting for the CPU to perform an output scan. Correction Reduce time between GBC output scans by assigning them to scan set 1. Increase CPU software watchdog timer setting Replace the CPU.
  • Page 515 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 40 hex/64 decimal, Shared RAM Fault The GBC generates this error when it detects an error in a Genius block’s shared RAM. Correction Replace the Genius block’s electronics module. 80 hex/128 decimal, Module Fault An internal failure has been detected in a module.
  • Page 516 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 9.5.9 Addition of IOC (Category 9) The fault category Addition of I/O Controller has no fault types or fault descriptions associated with it. The default fault action for this category is Diagnostic. Addition of IOC The CPU generates this error when an IOC that has been faulted returns to operation or when an IOC is found in the system and the configuration file indicates...
  • Page 517 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 9.5.10 Loss of or Missing IO Controller (Category 10) The fault category Loss of IOC has no fault types or fault descriptions associated with it. Default action: Diagnostic. Configurable. Note: This fault is always displayed as Fatal in the I/O Fault Table, regardless of its configured action.
  • Page 518 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 9.5.11 IOC (I/O Controller) Software Fault (Category 11) The fault category IOC Software Fault applies to any type of I/O Controller. Action: Fatal. Datagram Queue Full, Read/Write Queue Full Too many datagrams or read/write requests have been sent to the GBC. Correction Adjust the system to reduce the request rate to the GBC.
  • Page 519 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 9.5.13 Loss of or Missing I/O Module (Category 14) The fault category Loss of I/O Module applies to discrete and analog I/O modules. There are no fault types or fault descriptions associated with this category. Default action: Diagnostic.
  • Page 520 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 9.5.15 Extra I/O Module (Category 16) The fault category Extra I/O Module applies to discrete and analog I/O modules. There are no fault types or fault descriptions associated with this category. Action: Diagnostic.
  • Page 521 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 9.5.18 GBC Stopped Reporting Faults (Category 19) GBC detected a high error count on the Genius I/O bus and dropped off the bus for at least 1.5 seconds. Correction Check for incorrect wiring, interference from other equipment, a loose connection, or a failed device on the Genius bus.
  • Page 522 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 9.5.20 Block Switch (Category 22) The Block Switch fault category has no fault types or fault descriptions. Action: Diagnostic. The GBC generates this error when a Genius block on redundant Genius buses switches from one bus to another.
  • Page 523 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 Diagnostic Logic Blocks (DLBs) A Diagnostic Logic Block (DLB) is a block of Ladder Diagram logic that can be downloaded to the controller for independent execution. These blocks are useful tools for interacting with an application that is running in the PACSystems controller.
  • Page 524 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 9.6.1 DLB Operation Figure 267 Diagnostic Logic Blocks (DLBs) assigned to Target in MPE DLBs are created as components of a specific Target and are separate from the application logic block components associated with a target. They are written in LD programming language and support many of the same features, such as View Lock, Edit Lock, etc.
  • Page 525 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 Suspend I/O Function and DLBs The Suspend I/O (SUS_IO) function operates the same in a DLB as it does in application logic. Both application logic and DLB logic execute in the CPU Sweep Logic window.
  • Page 526 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 DLB Variables A DLB can have its own variables, which are local to the DLB and not accessible by any other block. All DLB local variables are symbolic, retentive, and published. Local variables should be used within DLBs whenever possible.
  • Page 527: Target Properties

    CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 9.6.2 Executing DLBs DLB Properties The properties for an active DLB include Execution Mode, which has the following possible values: Sweep (Default) - The DLB executes at a fixed point in the normal Controller •...
  • Page 528 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 Figure 269 DLB Heartbeat Setting Right-click Online Operations for an Active DLB Menu Enable Rules Description Download Disabled if block is already running on Downloads block to controller, controller, target not in programmer mode, removing any other DLB that Config+Logic is not equal, or Access Level was already there.
  • Page 529 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 While a DLB is running, the active target is read-only; no changes can DLB or the application logic. If the DLB has been downloaded to the controller but is not executing, changes are allowed but the first change will remove the DLB from the controller.
  • Page 530 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 Basic Steps for Using a DLB in the Controller Create an LD Block under the Active Blocks DLB Node in the Navigator. You can accomplish this in several ways, such as by creating a new block under the Active Blocks node, dragging a block from the Toolchest, or copying and pasting a block from another project.
  • Page 531 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 Logic for the Monitor Scan Block Figure 270 Figure 271 Diagnostics...
  • Page 532 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 Figure 272 Drag and drop the DLB Block from the Toolchest to the Active Blocks node in the Navigator. Figure 273: Drag DLB from Toolchest and Drop in Active Blocks Node In the DLB block properties, set the Execution Mode to Sweep.
  • Page 533 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 Go online to the Controller and select Programmer Mode. Put the Controller in RUN Mode or STOP Enabled Mode. Select the DLB Online Operations > Start menu to download the DLB to the controller and start its execution.
  • Page 534 CPU Programmer’s Reference Manual Section 9 GFK-2950K Feb 2023 DLB Block Icon/Status Bar Once Started. Figure 277 : DLB Icon and Status Bar after Execution has Commenced Open the DLB block and place the DLB variables in the Data Watch window to observe their operation.
  • Page 535: General Contact Information

    Emerson reserves the right to modify or improve the designs or specifications of the products mentioned in this manual at any time without notice. Emerson does not assume responsibility for the selection, use or maintenance of any product.

Table of Contents