Download  Print this page
   
1
2
3
Table of Contents
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469

Advertisement

GE
Automation & Controls
Programmable Control Products
RX7i, RX3i and RSTi-EP CPU Programmer's Reference
Manual GFK-2950C
PACSystems*
RX7i, RX3i and RSTi-EP
CPU Programmer's
Reference Manual
GFK-2950C
February 2018
For Public Disclosure

Advertisement

Table of Contents

   Also See for GE PACSystems RX7i

   Related Manuals for GE PACSystems RX7i

   Summary of Contents for GE PACSystems RX7i

  • Page 1 Automation & Controls Programmable Control Products RX7i, RX3i and RSTi-EP CPU Programmer's Reference Manual GFK-2950C PACSystems* RX7i, RX3i and RSTi-EP CPU Programmer's Reference Manual GFK-2950C February 2018 For Public Disclosure...
  • Page 2 The information is supplied for informational purposes only, and GE 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 3 Online technical support and GlobalCare www.geautomation.com/support Additional information www.geautomation.com Solution Provider solutionprovider.ip@ge.com Technical Support If you have technical problems that cannot be resolved with the information in this manual, please contact us by telephone or email, or on the web at www.geautomation.com/support...
  • Page 4: Table Of Contents

    Table of Contents RX7i, RX3i and RSTi-EP CPU Programmer's Reference Manual GFK-2950C Table of Contents ............................... i Table of Figures ............................... xii Chapter 1 Introduction ......................... 1 Revisions in this Manual ......................2 PACSystems Programming and Configuration ..............3 Migrating Series 90 Applications to PACSystems ............. 3 PACSystems Documentation ....................
  • Page 5 Contents Reference Memory ........................37 3.2.1 Word (Register) References ..........................37 3.2.2 Bit (Discrete) References ............................39 User Reference Size and Default ..................40 3.3.1 %G User References and CPU Memory Locations ..................40 Genius Global Data ........................41 Transitions and Overrides ..................... 42 Retentiveness of Logic and Data ..................
  • Page 6 Contents 4.2.5 Bit Test ..................................74 4.2.6 Logical AND, Logical OR, and Logical XOR....................... 75 4.2.7 Logical NOT ................................. 77 4.2.8 Masked Compare ..............................78 4.2.9 Rotate Bits ................................... 81 4.2.10 Shift Bits ..................................82 Coils ............................. 84 4.3.1 Coil Checking ................................84 4.3.2 Graphical Representation of Coils ........................
  • Page 7 Contents Counters ..........................133 4.7.1 Data Required for Counter Function Blocks ....................133 4.7.2 Down Counter ................................. 135 4.7.3 Up Counter ................................136 Data Move Functions ......................138 4.8.1 Array Size .................................. 140 4.8.2 Array Size Dimension Function Blocks ......................141 4.8.3 Block Clear ................................
  • Page 8 Contents 4.11 Program Flow Functions ..................... 201 4.11.1 Argument Present ..............................202 4.11.2 Call ....................................203 4.11.3 Comment .................................. 206 4.11.4 JumpN ..................................207 4.11.5 Master Control Relay/End Master Control Relay ..................208 4.11.6 Wires ................................... 210 4.12 Relational Functions ......................211 4.12.1 Compare ..................................
  • Page 9 Contents 5.9.5 Multiply ..................................262 5.9.6 Negate ..................................263 5.9.7 Subtract ..................................264 5.10 Program Flow Functions ...................... 265 5.11 Timers ............................266 5.11.1 Built-in Timer Function Blocks .......................... 266 5.11.2 Standard Timer Function Blocks ........................267 5.12 Type Conversion Functions ....................268 5.12.1 Convert WORD to INT ............................
  • Page 10 Contents SVC_REQ 7: Read or Change the Time-of-Day Clock ............ 286 6.8.1 Parameter Block Formats........................... 286 SVC_REQ 8: Reset Watchdog Timer ................. 294 6.10 SVC_REQ 9: Read Sweep Time from Beginning of Sweep ........... 295 6.11 SVC_REQ 10: Read Target Name..................296 6.12 SVC_REQ 11: Read Controller ID ..................
  • Page 11 Contents 6.32 SVC_REQ 56: Logic Driven Read of Nonvolatile Storage ..........331 6.32.1 Discrete Memory ..............................331 6.32.2 Storage Disabled Conditions ..........................331 6.32.3 Maximum of One Active Instruction ......................331 6.32.4 ENO and Power Flow To The Right ......................... 331 6.32.5 Parameter Block ..............................
  • Page 12 Contents Determining the Process Characteristics ............... 359 Setting Tuning Loop Gains ....................360 7.6.1 Basic Iterative Tuning Approach ........................360 7.6.2 Setting Loop Gains Using the Ziegler and Nichols Tuning Approach ..........361 7.6.3 Ideal Tuning Method ............................. 362 PID Example ........................... 363 7.7.1 Reference Array Initialization using %M00006 ..................
  • Page 13 Contents Controller Fault Descriptions and Corrective Actions ..........397 9.4.1 Controller Fault Groups ............................397 9.4.2 Loss of or Missing Rack (Group 1) ........................398 9.4.3 Loss of or Missing Option Module (Group 4)....................399 9.4.4 Addition of, or Extra Rack (Group 5) ....................... 399 9.4.5 Reset of, Addition of, or Extra Option Module (Group 8) ...............
  • Page 14 Contents 9.5.19 GBC Software Exception (Category 21) ......................441 9.5.20 Block Switch (Category 22) ..........................442 9.5.21 Reset of IOC (Category 27) ..........................442 Diagnostic Logic Blocks (DLBs) ..................443 9.6.1 DLB Operation ................................. 444 9.6.2 Executing DLBs ............................... 446 9.6.3 Diagnostic Logic Block (DLB) Example ......................
  • Page 15: Table Of Figures

    Contents Table of Figures Figure 1: Conditional Block Call _________________________________________________________________________________8 Figure 2: Block Call with Parameters ___________________________________________________________________________9 Figure 3: Defining Member Variables for a User-Defined Function Block _______________________________________ 11 Figure 4: Creating a User-Defined Function Block _____________________________________________________________ 12 Figure 5: Use of User-Defined Function Block in Ladder Logic _________________________________________________ 12 Figure 6: Display of Instance Data Structures _________________________________________________________________ 12 Figure 7: Calling an External Block in Ladder Logic ____________________________________________________________ 15 Figure 8: Relationship of %L &...
  • Page 16: Chapter 1 Introduction

    For a general introduction to the PACSystems family of products, including new features, product overviews, and specifications, see PACSystems RX7i, RX3i and RSTi-EP CPU Reference Manual, GFK-2222. Programming Features are described in Chapter 2 through Chapter 8.
  • Page 17: Revisions In This Manual

    PACSystems RX7i and RX3i CPU Reference Manual GFK-2222U Chapters 5-11 & Chapter 2015 14 form the content of this new manual, the PACSystems RX7i and RX3i CPU Programmer’s Reference Manual, GFK-2950. GFK-2222V and later versions defer to GFK-2950 for CPU programming content.
  • Page 18: Pacsystems Programming And Configuration

    The RX7i supports most existing Series 90-70 modules, expansion racks and Genius networks. For a list of supported I/O, Communications, and Intelligent modules, see the PACSystems RX7i Installation Manual, GFK-2223. • Conversion of Series 90-70 and Series 90-30 programs preserves existing development effort.
  • Page 19: Pacsystems Documentation

    PACSystems RX7i, RX3i and RSTi-EP CPU Reference Manual GFK-2222 PACSystems RX7i, RX3i and RSTi-EP CPU Programmer’s Reference Manual GFK-2950 PACSystems RX7i, RX3i and RSTi-EP TCP/IP Ethernet Communications User Manual GFK-2224 PACSystems TCP/IP Ethernet Communications Station Manager User Manual GFK-2225 C Programmer’s Toolkit for PACSystems GFK-2259 PACSystems Memory Xchange Modules User’s Manual...
  • Page 20: Chapter 2 Program Organization

    Chapter 2 Program Organization This chapter provides information about the operation of application programs in a PACSystems CPU. Structure of the Application Program ▪ Controlling Program Execution ▪ Interrupt-Driven Blocks ▪ GFK-2950C February 2018...
  • Page 21: Structure Of A Pacsystems Application Program

    Chapter 2. Program Organization 2.1 Structure of a PACSystems Application Program A PACSystems application consists of one block-structured application program. The application program contains all the logic needed to control the operations of the CPU and the modules in the system.
  • Page 22: How Blocks Are Called

    Chapter 2. Program Organization 2.1.3 How Blocks Are Called A block executes when called from the program logic in the _MAIN block or another block. In this example, LD_BLK1 is always called. Conditional logic can be used to control calling a block. For LD_BLK2 to be called, input %I00500 and output %Q00100 must be ON.
  • Page 23: Types Of Blocks

    Chapter 2. Program Organization 2.1.5 Types of Blocks PACSystems supports four types of blocks. Programming Block Type Local Data Size Limit Parameters Languages Has its own local 0 inputs Block 128 KB data 1 output Parameterized Inherits local data 63 inputs 128 KB Block from caller...
  • Page 24: Figure 2: Block Call With Parameters

    Chapter 2. Program Organization Using Parameters with a Program Block Every block is automatically defined to have one formal ‘power flow’ (or OK) output parameter, named Y0. Y0 is a BOOL parameter of LENGTH 1, passed by initial-value result. It indicates successful execution of the block.
  • Page 25 Chapter 2. Program Organization Type Length Default Parameter Passing Mechanism INPUTS: by reference BOOL 1 to 256 OUTPUTS: by value result; except Y0, which is by initial-value result INPUTS: by reference BYTE 1 to 1024 OUTPUTS: by reference INPUTS: by reference INT, UINT, and WORD 1 to 512 OUTPUTS: by reference...
  • Page 26: Figure 3: Defining Member Variables For A User-defined Function Block

    Chapter 2. Program Organization User-Defined Function Blocks (UDFBs) Users can define their own blocks, which have parameters and instance data, instead of being limited to the standard and built-in function blocks provided in the PACSystems instruction set. In many cases, the use of this feature results in a reduction in total program size. Once defined, multiple instances of a UDFB can be created by calling it within the program logic.
  • Page 27: Figure 4: Creating A User-defined Function Block

    Chapter 2. Program Organization Creating UDFB Instances You create an instance of a UDFB by calling it in your logic and assigning an instance name in the function properties. Figure 4: Creating a User-Defined Function Block In the following LD example, the first rung creates two instances of the UDFB, Motors. The instance variables associated with the instances are motors.motor1 and motors.motor2.
  • Page 28 Chapter 2. Program Organization Using Parameters with UDFBs UDFBs support up to 63 inputs and up to 64 outputs. Each UDFB has a predefined Boolean output parameter, Y0, which the CPU sets to true upon each invocation of the block. Y0 can be controlled by logic within the block and provides the output status of the block.
  • Page 29 Chapter 2. Program Organization If an input parameter is passed by reference or by value result, it requires an argument. All other parameters of a UDFB are optional. That is, they do not have to be given arguments on each instance of the UDFB.
  • Page 30: Figure 7: Calling An External Block In Ladder Logic

    Chapter 2. Program Organization UDFB Logic An instance of a BOOL parameter or internal variable can be forced ON or OFF, or used with transition-detecting instructions. The exception to this is that BOOL input parameters passed by reference cannot be forced or used with the Series 90-70 legacy transition-detecting instructions (POSCOIL, NEGCOIL, POSCON and NEGCON) because their values are not stored in instance data.
  • Page 31 Chapter 2. Program Organization 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. They also inherit the FST_EXE system reference and the time-stamp data that is used to update timer function blocks from their calling blocks.
  • Page 32 Chapter 2. Program Organization Using Parameters with an External Block An external block may be defined to have between zero and 63 formal input parameters and between one and 64 formal output parameters. A ‘power-flow out’ (or OK) parameter, named Y0, is automatically defined for every external block.
  • Page 33: Local Data

    Chapter 2. Program Organization 2.1.6 Local Data Each block or UDFB in a block-structured program has an associated local data block. _MAIN’s data block memory is referenced by %P; all other data block memories are referenced by %L. The size of the data block is dependent on the highest reference in its block for %L and in all blocks for %P.
  • Page 34: Parameter Passing Mechanisms

    Chapter 2. Program Organization 2.1.7 Parameter Passing Mechanisms All blocks (except _MAIN) have at least one parameter and thus are affected by parameter passing mechanisms. A parameter passing mechanism describes the way that data is passed from an argument in a calling block to a parameter in the called block, and from the parameter in the called block back to the argument in the calling block.
  • Page 35 Chapter 2. Program Organization ▪ When a parameter is passed by value result (UDFB inputs only), the value of its argument is copied into a local stack memory associated with the called block, and the address of its argument is saved. All logic within the called block that reads or writes to the parameter is reading or writing to this stack memory.
  • Page 36: Languages

    Chapter 2. Program Organization 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 37: Figure 12: Illustration Of Function Block Diagram

    Chapter 2. Program Organization 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 38 Chapter 2. Program Organization Structured Text The Structured Text (ST) programming language is an IEC 1131-3 textual programming language. A structured text program consists of a series of statements, which are constructed from expressions and language keywords. A statement directs the PLC to perform a specified action. Statements provide variable assignments, conditional evaluations, iteration, and the ability to call other blocks.
  • Page 39: Controlling Program Execution

    Chapter 2. Program Organization 2.2 Controlling Program Execution There are many ways in which program execution can be controlled to meet the system’s timing requirements. The PACSystems CPU instruction set contains several powerful control functions that can be included in an application program to limit or change the way the CPU executes the program and scans I/O.
  • Page 40: Interrupt-driven Blocks

    Chapter 2. Program Organization 2.3 Interrupt-Driven Blocks Three types of interrupts can be used to start a block’s execution: ▪ Timed Interrupts are generated by the CPU based on a user-specified time interval with an initial delay (if specified) applied on STOP Mode to RUN Mode transition of the CPU. I/O Interrupts are generated by I/O modules to indicate discrete input state changes ▪...
  • Page 41: Interrupt Handling

    Chapter 2. Program Organization 2.3.1 Interrupt Handling An I/O, Module, or Timed interrupt can be associated with any block except _MAIN, as long as the block has no parameters other than an OK output. After an interrupt has been associated with a block, that block executes each time the interrupt trigger occurs.
  • Page 42: Timed Interrupts

    Chapter 2. Program Organization 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 The smallest unit of time that you can specify for Interval and Delay.
  • Page 43: Interrupt Block Scheduling

    Chapter 2. Program Organization 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 Module Interrupts and 16 Timed Interrupts. With normal block scheduling, all interrupt-triggered blocks have equal priority.
  • Page 44: Chapter 3 Program Data

    Chapter 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 ▪ Reference Memory ▪ User Reference Size and Default ▪...
  • Page 45: Variables

    Chapter 3. Program Data 3.1 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 46: Symbolic Variables

    Chapter 3. Program Data 3.1.2 Symbolic Variables Symbolic variables are variables for which you do not specify a reference address (similar to a variable in a typical high-level language). Except as noted in this section, you can use these in the same ways that you use mapped variables.
  • Page 47: I/o Variables

    Chapter 3. Program Data 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 48 Chapter 3. Program Data I/O Variable Format To map an I/O variable, use the format %vdr.s.[z.]g.t: v = I (input) or Q (output) d = data type: X (discrete) or W (analog). r = rack number s = slot number [z] = sub-slot number.
  • Page 49: Arrays

    Chapter 3. Program Data 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. In Machine Edition, you can create single-dimensional arrays and two-dimensional arrays.
  • Page 50 Chapter 3. Program Data Dimensional support: ▪ One-dimensional (1D) formal parameter arrays in the logic of a UDFB or parameterized block ▪ 2D support for the top level of an array of structures and 1D support for a structure element that is an array.
  • Page 51 Chapter 3. Program Data 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 52: Reference Memory

    Chapter 3. Program Data 3.2 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 53 Chapter 3. Program Data Bit in Word references can be used in the following situations: In retentive 16-bit memory (AI, AQ, R, W, P, and L) and symbolics. ■ On all contacts and coils except legacy transition contacts (POSCON/NEGCON) and transition ■...
  • Page 54: Bit (discrete) References

    Chapter 3. Program Data 3.2.2 Bit (Discrete) References Type Description Represents input references. %I references 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 55: User Reference Size And Default

    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. For PACSystems, these ranges are converted to %G.
  • Page 56: Genius Global Data

    Chapter 3. Program Data 3.4 Genius Global Data PACSystems supports the sharing of data among multiple control systems that share a common Genius I/O bus. This mechanism provides a means for the automatic and repeated transfer of %G, %I, %Q, %AI, %AQ, and %R data. No special application programming is required to use global data since it is integrated into the I/O scan.
  • Page 57: Transitions And Overrides

    Chapter 3. Program Data 3.5 Transitions and Overrides The %I, %Q, %M, and %G user references, and symbolic variables of type BOOL, have associated transition and override bits. %T, %S, %SA, %SB, and %SC references have transition bits but not override bits.
  • Page 58: Retentiveness Of Logic And Data

    Chapter 3. Program Data 3.6 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 59: Data Scope

    Chapter 3. Program Data 3.7 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 60: System Status References

    Chapter 3. Program Data 3.8 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 61: S References

    Chapter 3. Program Data 3.8.1 %S References Reference System Variable Definition %S0001 #FST_SCN Current sweep is the first sweep in which the LD executed. Set the first time the user program is executed after a STOP Mode to RUN Mode transition and cleared upon completion of its execution.
  • Page 62: Sa, %sb, And %sc References

    Chapter 3. Program Data 3.8.2 %SA, %SB, and %SC References Note: %SA, %SB, and %SC contacts are not set or reset until the input scan phase of the sweep following the occurrence of the fault or a clearing of the fault table(s). %SA, %SB, and %SC contacts can also be set or reset by user logic and CPU monitoring devices.
  • Page 63 Chapter 3. Program Data Reference System Definition Variable %SA0029 #SFT_IOC Set when there is a software failure in the I/O Controller. To clear this bit, clear the I/O Fault Table or power cycle the CPU. %SA0030 #PNIO_ALARM A PROFINET alarm has been received and an I/O fault has been logged in group 28. To clear this bit, clear the I/O Fault Table or power cycle the CPU.
  • Page 64: Fault References

    Chapter 3. Program Data 3.8.3 Fault References The fault references are discussed in Chapter 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 of the fault tables...
  • Page 65 Chapter 3. Program Data Non-Configurable Faults Non-Configurable Faults Description (Action) #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 66: How Program Functions Handle Numerical Data

    Chapter 3. Program Data 3.9 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. 3.9.1 Data Types Type...
  • Page 67 Chapter 3. Program Data Type Name Description Data Format BCD-8 Eight-Digit Uses two consecutive 16-bit data memory locations Register 2 Register 1 (32 consecutive bits). Each BCD digit uses 4 bits per digit to represent numbers from 0 to 9. The complete 21 17 valid range of the 8-digit BCD data type is 0 to (8 BCD digits)
  • Page 68: Floating Point Numbers

    Chapter 3. Program Data 3.9.2 Floating Point Numbers Floating point numbers are stored in one of two IEEE 754 standard formats that uses adjacent 16-bit words: 32-bit single precision or 64-bit double precision. The REAL data type represents single precision floating point numbers. The LREAL data type represents double precision floating point numbers.
  • Page 69 Chapter 3. Program Data 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 70: User Defined Types (udts)

    Chapter 3. Program Data 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 UDT A UDT named UDT_ABC has a top-level element whose is nested at any level.
  • Page 71: Udt Limits

    Chapter 3. Program Data 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 72: Udt Operational Notes

    Chapter 3. Program Data 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. ▪ Properties of elements of UDT variables: The Input Transfer List and Output Transfer List properties are read-only and set to False.
  • Page 73: Operands For Instructions

    Chapter 3. Program Data 3.11 Operands for Instructions The operands for PACSystems instructions can be in the following forms: ▪ Constants ▪ Variables that are located in any of the PACSystems memory areas (%I, %Q, %M, %T, %G, %S, %SA, %SB, %SC, %R, %W, %L, %P, %AI, %AQ) ▪...
  • Page 74 Chapter 3. Program Data BOOL arrays can be used as parameters to an instruction instead of variables of other data types. The array must be of sufficient length to replace the given data type. For example, instead of using a 16-bit INT variable, you could use a BOOL array of length 16 or more.
  • Page 75: Word-for-word Changes

    Chapter 3. Program Data 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: ▪...
  • Page 76: Chapter 4 Ladder Diagram (ld) Programming

    Chapter 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 Chapter 3.
  • Page 77: Advanced Math Functions

    Chapter 4. Ladder Diagram (LD) Programming 4.1 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 ). Calculates the inverse natural EXP_LREAL logarithm of the IN operand.
  • Page 78: Exponential/logarithmic Functions

    Chapter 4. Ladder Diagram (LD) Programming 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 79: Square Root

    Chapter 4. Ladder Diagram (LD) Programming 4.1.2 Square Root Mnemonics: SQRT_DINT SQRT_INT SQRT_REAL SQRT_LREAL When the Square Root function receives power flow, it finds the square root of IN and stores the result in Q. The output Q must be the same data type as IN. The power flow output is energized when the function is performed without Overflow, unless one of these invalid REAL operations occurs: If IN <...
  • Page 80: Trig Functions

    Chapter 4. Ladder Diagram (LD) Programming 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 81: Inverse Trig - Asin, Acos, And Atan

    Chapter 4. Ladder Diagram (LD) Programming 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 82: Bit Operation Functions

    Chapter 4. Ladder Diagram (LD) Programming 4.2 Bit Operation Functions The Bit Operation functions perform comparison, logical, and move operations on bit strings. Function Mnemonics Description Bit Position BIT_POS_DWORD Bit Position. Locates a bit set to 1 in a bit string. BIT_POS_WORD Bit Sequencer BIT_SEQ Bit Sequencer.
  • Page 83: Data Lengths For The Bit Operation Functions

    Chapter 4. Ladder Diagram (LD) Programming 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 84: Bit Position

    Chapter 4. Ladder Diagram (LD) Programming 4.2.2 Bit Position The Bit Position function locates a bit set to 1 in a bit string. Each scan that power is received, the function scans the bit string starting at IN. When the function stops scanning, either a bit equal to 1 has been found or the entire length of the string has been scanned.
  • Page 85: Bit Sequencer

    Chapter 4. Ladder Diagram (LD) Programming 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): R Current EN Previous...
  • Page 86 Chapter 4. Ladder Diagram (LD) Programming Memory Required for Bit Sequencer Each bit sequencer uses a three-word array of control block information. The control block can be a symbolic variable or it can be located in %R, %W, %L, or %P memory: Word 1 current step number Word 2...
  • Page 87 Chapter 4. Ladder Diagram (LD) Programming Parameter Description Allowed Operands Optional The value that the step number is set to when R is energized. All except variables Default value is 1. 1  N  Length. If N < 1, the step number will be located in %S - %SC reset to 1 when R is energized.
  • Page 88: Bit Set, Bit Clear

    Chapter 4. Ladder Diagram (LD) Programming 4.2.4 Bit Set, Bit Clear Mnemonics BIT_SET_DWORD BIT_SET_WORD BIT_CLR_DWORD BIT_CLR_WORD The Bit Set (BIT_SET_DWORD and BIT_SET_WORD) function sets a bit in a bit string to 1. The Bit Clear (BIT_CLR_DWORD and BIT_CLR_WORD) function clears a bit in a string by setting the bit to 0. Each scan that power is received;...
  • Page 89: Bit Test

    Chapter 4. Ladder Diagram (LD) Programming 4.2.5 Bit Test 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 90: Logical And, Logical Or, And Logical Xor

    Chapter 4. Ladder Diagram (LD) Programming 4.2.6 Logical AND, Logical OR, and Logical XOR Each scan that power is received, the Logical function examines each bit in bit string IN1 and the corresponding bit in bit string IN2, beginning with the least significant bit in each. You can specify a string length of 1 to 256 WORDs or DWORDs.
  • Page 91 Chapter 4. Ladder Diagram (LD) Programming Operands for Logical AND, OR, and XOR Parameter Description Allowed Operands Optional Length (??) The number of words in the bit string Constant on which to perform the logical operation. 1  Length  256. The first WORD or DWORD of the first string operate on.
  • Page 92: Logical Not

    Chapter 4. Ladder Diagram (LD) Programming 4.2.7 Logical NOT 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. All bits are altered on each scan that power is received, making output string Q the logical complement of input string IN1.
  • Page 93: Masked Compare

    Chapter 4. Ladder Diagram (LD) Programming 4.2.8 Masked Compare 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 Tip: Input string 1 might contain the states of outputs such as solenoids or motor starters.
  • Page 94 Chapter 4. Ladder Diagram (LD) Programming Operands for Masked Compare Function Parameter Description Allowed Operands Optional Length (??) The number of DWORDs or WORDs in the two Constant compared strings. DWORD: 1  Length  2,048 WORD: 1  Length  4,096 The first bit string to be compared All.
  • Page 95 Chapter 4. Ladder Diagram (LD) Programming Masked Compare Example 2 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 96: Rotate Bits

    Chapter 4. Ladder Diagram (LD) Programming 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 97: Shift Bits

    Chapter 4. Ladder Diagram (LD) Programming 4.2.10 Shift Bits Mnemonics: SHIFTL_DWORD SHIFTL_WORD SHIFTR_DWORD SHIFTR_WORD Shift Left When the Shift Left (SHIFTL_WORD) function receives power flow, it shifts all the bits in a word or group of words to the left by a specified number of places, N. When the shift occurs, the specified number of bits is shifted out of the output string to the left.
  • Page 98 Chapter 4. Ladder Diagram (LD) Programming 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 string. Constants. 1  Length  256. The string of WORDs or DWORDs to shift All.
  • Page 99: Coils

    Chapter 4. Ladder Diagram (LD) Programming 4.3 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.
  • Page 100: Graphical Representation Of Coils

    Chapter 4. Ladder Diagram (LD) Programming 4.3.2 Graphical Representation of Coils The programming software displays the COIL, NCCOIL, SETCOIL, and RESETCOIL instructions differently depending on the retentive state of the BOOL variables assigned to them. Examples are provided in the discussion of each type of coil. For a discussion of retentiveness, refer to Retentiveness of Logic and Data in Chapter 3.
  • Page 101: Set Coil, Reset Coil

    Chapter 4. Ladder Diagram (LD) Programming 4.3.3 Set Coil, Reset Coil Set Coil and Reset Coil with a retentive variable Set Coil and Reset Coil with a non-retentive assigned variable assigned 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.
  • Page 102: Transition Coils

    Chapter 4. Ladder Diagram (LD) Programming 4.3.4 Transition Coils PACSystems controllers provide four transition coils: PTCOIL, NTCOIL, POSCOIL, and NEGCOIL. POSCOIL and NEGCOIL are updated every time they are called. PTCOIL and NTCOIL are updated once per CPU scan. For examples showing the differences in the operation of the two types of transition coils, see Examples Comparing PTCOIL and POSCOIL POSCOIL and NEGCOIL Warning...
  • Page 103 Chapter 4. Ladder Diagram (LD) Programming Operands for POSCOIL and NEGCOIL Parameter Description Allowed Operands Optional BOOL_V The variable associated with BOOL variable: I, Q, M, T, G, SA, SB, SC, symbolic POSCOIL or NEGCOIL discrete variables, and I/O variable. Bit reference in BOOL variable: I, Q, M, T, G, SA, SB, Example for POSCOIL and NEGCOIL When reference E1 goes from OFF to ON, coils E2 and E3 receive power flow, turning E2 ON.
  • Page 104 Chapter 4. Ladder Diagram (LD) Programming Negative Transition Coil (NTCOIL) Positive Transition Coil (PTCOIL) 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 105 Chapter 4. Ladder Diagram (LD) Programming Examples Comparing PTCOIL and POSCOIL PTCOIL In the example below, the power flow into the PTCOIL alternates between OFF and ON. On the first sweep the power flow in is OFF, on the second sweep it is ON, and so forth. Each time the power flow into the PTCOIL changes from OFF to ON, the value of Xsition is turned ON.
  • Page 106: Contacts

    Chapter 4. Ladder Diagram (LD) Programming 4.4 Contacts A contact is used to monitor the state of a reference address. Whether the contact passes power flow depends on positive power flow into the contact, the state or status of the reference address being monitored, and the contact type.
  • Page 107: Continuation Contact

    Chapter 4. Ladder Diagram (LD) Programming 4.4.1 Continuation Contact A continuation contact continues the LD logic from the last previously-executed rung in the block that contained a continuation coil. The flow state of the continuation contact is the same as the preceding executed continuation coil. A continuation contact has no associated variable.
  • Page 108: Fault Contact

    Chapter 4. Ladder Diagram (LD) Programming 4.4.2 Fault Contact 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, %Q, %AI, %AQ) with the ■...
  • Page 109: High And Low Alarm Contacts

    Chapter 4. Ladder Diagram (LD) Programming 4.4.3 High and Low Alarm Contacts 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. A high alarm contact passes power flow if the high alarm bit associated with the analog reference is The low alarm contact (LOALR) detects a low alarm associated with an analog reference.
  • Page 110: No Fault Contact

    Chapter 4. Ladder Diagram (LD) Programming 4.4.4 No Fault Contact 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 111: Normally Closed And Normally Open Contacts

    Chapter 4. Ladder Diagram (LD) Programming 4.4.5 Normally Closed and Normally Open Contacts 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 112: Transition Contacts

    Chapter 4. Ladder Diagram (LD) Programming 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 113 Chapter 4. Ladder Diagram (LD) Programming Positive Transition Contact POSCON Negative Transition Contact NEGCON POSCON starts passing power flow and NEGCON starts passing power flow and continues continues passing power flow to the right only passing power flow to the right only when all of when all of the following conditions are met: the following conditions are met: the input power flow to POSCON is ON,...
  • Page 114 Chapter 4. Ladder Diagram (LD) Programming POSCON and NEGCON Example 1 Coil E2 is turned ON when the value of the variable E1 transitions from OFF to ON. It stays ON until E1 is written to again, causing the POSCON to stop passing power flow. Coil E4 is turned ON when the value of the variable E3 transitions from ON to OFF.
  • Page 115 Chapter 4. Ladder Diagram (LD) Programming 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. The transition bit of a given PTCON or NTCON is updated only once per CPU scan.
  • Page 116 Chapter 4. Ladder Diagram (LD) Programming Examples Comparing PTCON and POSCON PTCON The logic in the following example starts execution with all variables set to 0. Before the second sweep begins, the Xsition variable used on the PTCON instruction is set to 1. It retains that value for sweeps 2, 3, and 4.
  • Page 117: Control Functions

    Chapter 4. Ladder Diagram (LD) Programming 4.5 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 118: Do I/o

    Chapter 4. Ladder Diagram (LD) Programming 4.5.1 Do I/O 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 119 Chapter 4. Ladder Diagram (LD) Programming Do I/O for Inputs When DO_IO receives power flow and input references are specified, the PLC scans input points from the starting reference (ST) to the ending reference (END). If a reference is specified for ALT, a copy of the new input values is placed in memory beginning at that reference, and the real input values are not updated.
  • Page 120 Chapter 4. Ladder Diagram (LD) Programming Example - Do I/O for Inputs 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. Because a reference is specified for ALT, the real inputs are not updated.
  • Page 121: Edge Detectors

    Chapter 4. Ladder Diagram (LD) Programming 4.5.2 Edge Detectors Falling Edge Trigger Rising Edge Trigger 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 Transition Contacts, are used inside a function block, there is a problem when the same function block is called more than once per scan.
  • Page 122 Chapter 4. Ladder Diagram (LD) Programming F_TRIG Operation When the CLK input goes from true to false, the output Q is true for one function block instance execution. The output Q then remains false until a new falling edge is detected. When the Controller transitions from STOP Mode to RUN Mode and the CLK input is false and the instance memory is non-retentive, the output Q is true after the function block’s...
  • Page 123: Drum

    Chapter 4. Ladder Diagram (LD) Programming 4.5.3 Drum 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 124 Chapter 4. Ladder Diagram (LD) Programming Programming Drum in Parameterized Blocks Different guidelines and rules apply depending on whether you want to use the parameterized block in more than one place in your program logic. Parameterized block called from one block If your parameterized block that contains a Drum function will be called from only one logic block, follow these rules: 1.
  • Page 125 Chapter 4. Ladder Diagram (LD) Programming Example A UDFB is defined that uses a member variable for a Drum function block. Two instances of the function block are created: Drum_A and Drum_B. During each logic scan, both Drum_A and Drum_B are executed.
  • Page 126 Chapter 4. Ladder Diagram (LD) Programming Parameter Description Allowed Operands Optional (Fault Timeout) If you use the FTT operand, you must also use All except S, SA, SB, the TFT operand, and vice-versa. The FTT operand is the SC and constant starting address of Length words of memory, where Length is the number of steps.
  • Page 127: For Loop

    Chapter 4. Ladder Diagram (LD) Programming 4.5.4 For Loop 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 128 Chapter 4. Ladder Diagram (LD) Programming Operands Only the FOR_LOOP function requires operands. Parameter Description Allowed Operands Optional INDEX The index variable. When the loop has completed, this All except constants, flow, value is undefined. and variables in %S - %SC Note: Changing the value of the index variable within the scope of the FOR loop is not recommended.
  • Page 129: Mask I/o Interrupt

    Chapter 4. Ladder Diagram (LD) Programming 4.5.5 Mask I/O Interrupt Mask or unmask an interrupt from an I/O board when using I/O variables. If not using I/O variables, use SVC_REQ 17. When the interrupt is masked, the CPU processes the interrupt but does not schedule the associated logic for execution.
  • Page 130: Read Switch Position

    Chapter 4. Ladder Diagram (LD) Programming 4.5.6 Read Switch Position Read Switch Position (SWITCH_POS) allows the logic to read the current position of the RUN/STOP switch, as well as the mode for which the switch is configured. Operands Parameter Description Allowed Operands Optional Memory location at which to write current switch position value.
  • Page 131: Scan Set Io

    Chapter 4. Ladder Diagram (LD) Programming 4.5.7 Scan Set IO The Scan_Set_IO function scans the I/O of a specified scan set number. (Modules can be assigned to scan sets in hardware configuration.) You can specify whether the Inputs and/or Outputs of the associated scan set will be scanned.
  • Page 132: Suspend I/o

    Chapter 4. Ladder Diagram (LD) Programming 4.5.8 Suspend I/O 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. However, during the input scan portion of the sweep, the CPU verifies that Genius bus controllers have completed their previous output updates.
  • Page 133: Suspend Or Resume I/o Interrupt

    Chapter 4. Ladder Diagram (LD) Programming 4.5.9 Suspend or Resume I/O Interrupt 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 supported.
  • Page 134: Conversion Functions

    Chapter 4. Ladder Diagram (LD) Programming 4.6 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 135: Convert Angles

    Chapter 4. Ladder Diagram (LD) Programming 4.6.1 Convert Angles Mnemonics: DEG_TO_RAD_REAL DEG_TO_RAD_LREAL RAD_TO_DEG_REAL RAD_TO_DEG_LREAL When the Degrees to Radians (DEG_TO_RAD) or the Radians to Degrees (RAD_TO_DEG) function receives power flow, it performs the appropriate angle conversion on the REAL or LREAL value in input IN and places the result in output Q.
  • Page 136: Convert Uint Or Int To Bcd4

    Chapter 4. Ladder Diagram (LD) Programming 4.6.2 Convert UINT or INT to BCD4 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. This function does not change the original input data.
  • Page 137: Convert Dint To Bcd8

    Chapter 4. Ladder Diagram (LD) Programming 4.6.3 Convert DINT to BCD8 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. Note: The output data can be used directly as input for another program function.
  • Page 138: Convert Bcd4, Uint, Dint, Or Real To Int

    Chapter 4. Ladder Diagram (LD) Programming 4.6.4 Convert BCD4, UINT, DINT, or REAL to INT 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 139 Chapter 4. Ladder Diagram (LD) Programming Example: BCD4 to INT Whenever input %I0002 is set, the BCD-4 value in PARTS is converted to a signed integer (INT) and passed to the ADD_INT function, where it is added to the INT value represented by the reference RUNNING.
  • Page 140: Convert Bcd4, Int, Dint, Or Real To Uint

    Chapter 4. Ladder Diagram (LD) Programming 4.6.5 Convert BCD4, INT, DINT, or REAL to UINT When this function receives power flow, it converts 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 141 Chapter 4. Ladder Diagram (LD) Programming Example: BCD4 to UINT Tip: 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 142: Convert Bcd8, Uint, Int, Real Or Lreal To Dint

    Chapter 4. Ladder Diagram (LD) Programming 4.6.6 Convert BCD8, UINT, INT, REAL or LREAL to DINT BCD8, UINT, and INT When this function receives power flow, it converts the data into the equivalent signed double- precision integer (DINT) value, which it outputs to Q. The conversion to DINT does not change the original data.
  • Page 143 Chapter 4. Ladder Diagram (LD) Programming Example: UINT to DINT Whenever input %M01478 is set, the unsigned single- precision integer (UINT) value at input location %R00654 is converted to a double-precision signed integer (DINT) and the result is placed in location %L00049. The output %M00065 is set whenever the function executes successfully.
  • Page 144: Convert Bcd4, Bcd8, Uint, Int, Dint, And Lreal To Real

    Chapter 4. Ladder Diagram (LD) Programming 4.6.7 Convert BCD4, BCD8, UINT, INT, DINT, and LREAL to REAL When this function receives power flow, it converts the input data into the equivalent 32-bit floating- point (REAL) value, which it outputs to Q. The conversion to REAL does not change the original input data.
  • Page 145 Chapter 4. Ladder Diagram (LD) Programming Example: UINT to REAL The unsigned integer value in %L00001 is 825. The value placed in %L00016 is 825.000. Example: INT to REAL The integer value of input IN is -678. The value placed in %R00010 is -678.000.
  • Page 146: Convert Real To Lreal

    Chapter 4. Ladder Diagram (LD) Programming 4.6.8 Convert REAL to LREAL When REAL_TO_LREAL receives power flow, it converts the 32-bit single precision floating point REAL data to the equivalent 64-bit double-precision floating point data. REAL_TO_LREAL does not change the original REAL data. Operands Parameter Description Allowed Operands...
  • Page 147: Truncate

    Chapter 4. Ladder Diagram (LD) Programming 4.6.10 Truncate When power is received, the Truncate functions TRUNC_DINT and TRUNC_INT round a floating-point (REAL) value down respectively to the nearest signed double-precision signed integer (DINT) or signed single- precision integer (INT) value. TRUNC_DINT and TRUNC_INT output the converted value to Q.
  • Page 148: Counters

    Chapter 4. Ladder Diagram (LD) Programming 4.7 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 up to a designated value. The output is ON whenever the Current Value is ...
  • Page 149 Chapter 4. Ladder Diagram (LD) Programming Each counter uses a one-dimensional, three-word array of %R, %W, %P, %L, or symbolic memory to store the following information: Current value Word 1 (CV) Warning The first word (CV) can be read but should not be written to, or the function may not work properly.
  • Page 150: Down Counter

    Chapter 4. Ladder Diagram (LD) Programming 4.7.2 Down Counter The Down Counter (DNCTR) function counts down from a preset value. The minimum Preset Value (PV) is zero; the maximum PV is +32,767 counts. When the Current Value (CV) reaches the minimum value, -32,768, it stays there until reset. When DNCTR is reset, CV is set to PV.
  • Page 151: Up Counter

    Chapter 4. Ladder Diagram (LD) Programming 4.7.3 Up Counter The Up Counter (UPCTR) function counts up 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. When the UPCTR reset is ON, CV resets to 0.
  • Page 152 Chapter 4. Ladder Diagram (LD) Programming Example – Up Counter and Down Counter This example uses an up/down counter pair with a shared register for the accumulated or current value. When the parts enter the storage area, the up counter increments by 1, increasing the current value of the parts in storage by a value of 1.
  • Page 153: Data Move Functions

    Chapter 4. Ladder Diagram (LD) Programming 4.8 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- or Dimension 1 two-dimensional array.
  • Page 154 Chapter 4. Ladder Diagram (LD) Programming Function Mnemonics Description Move MOVE_BOOL Copies data as individual bits, so the new location does not have to MOVE_DATA be the same data type. Data can be moved into a different data type MOVE_DINT without prior conversion.
  • Page 155: Array Size

    Chapter 4. Ladder Diagram (LD) Programming 4.8.1 Array Size Counts the number of elements in the array assigned to input IN and writes the number to output Q. In an array of structure variables, the number of structure variables is written to Q;...
  • Page 156: Array Size Dimension Function Blocks

    Chapter 4. Ladder Diagram (LD) Programming 4.8.2 Array Size Dimension Function Blocks Array Size Dimension 1 Returns the value of the Array Dimension 1 property of an array and writes the value to output Q. If a non-array variable is assigned to IN, the value of Q is 0.
  • Page 157 Chapter 4. Ladder Diagram (LD) Programming Example - FOR_LOOP that Iterates Through Dimension 1 of an Array To use a FOR_LOOP to access array elements by means of a variable index, you must ensure that the FOR_LOOP does not iterate beyond the last element of the array. In the following logic, MOVE_DINT initializes the variable D1_temp to 0.
  • Page 158: Block Clear

    Chapter 4. Ladder Diagram (LD) Programming 4.8.3 Block Clear When the Block Clear (BLKCLR_WORD) function receives power flow, it fills the specified block of data with zeroes, beginning at the reference specified by IN. When the data to be cleared is from BOOL (discrete) memory (%I, %Q, %M, %G, or %T), the transition information associated with the references is updated.
  • Page 159: Block Move

    Chapter 4. Ladder Diagram (LD) Programming 4.8.4 Block Move When the Block Move (BLKMOV) function receives power flow, Mnemonics: it copies a block of seven constants into consecutive locations BLKMOV_DINT beginning at the destination specified in output Q. BLKMOV BLKMOV_DWORD passes power to the right whenever it receives power.
  • Page 160: Bus_ Functions

    Note: Additional information related to addressing modules is required to use the BUS_ functions. For open VME modules in an RX7i system, refer to the PACSystems RX7i User’s Guide to Integration of VME Modules, GFK-2235. For other modules, refer to the product documentation provided by the manufacturer.
  • Page 161 Chapter 4. Ladder Diagram (LD) Programming Operands for BUS READ Parameter Description Allowed Operands Optional Length (??) The number of BYTEs, DWORDs, or WORDs. Constant 1 to 32,767. Rack number. UINT constant or variable. All except %S—%SC Slot number. UINT constant or variable. All except %S—%SC Subslot number (defaults to 0).
  • Page 162 Chapter 4. Ladder Diagram (LD) Programming BUS Read Modify Write The BUS_RMW function updates one byte, word, or double word of Other mnemonic: data on the bus. This function locks the bus while performing the BUS_RMW_WORD read-modify-write operation. When the BUS_RMW function receives power flow through its enable input, the function reads a dword, word or byte of data from the module at the specified rack (R), slot (S), subslot (SS) and optional address region (RGN) and offset (OFF).
  • Page 163 Chapter 4. Ladder Diagram (LD) Programming 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 164 Chapter 4. Ladder Diagram (LD) Programming BUS Test and Set The BUS_TS function uses semaphores to control access to specific Other memory in a module located on the bus. mnemonic: The BUS_TS function exchanges a Boolean TRUE (1) for the value BUS_TS_WORD currently at the semaphore location.
  • Page 165 Chapter 4. Ladder Diagram (LD) Programming BUS Write When the BUS_WRT function receives power flow through its enable Mnemonics: input, it writes the data located at reference (IN) to the module at the BUS_WRT_DINT specified rack (R), slot (S), subslot (SS) and optional address region BUS_WRT_DWORD (RGN) and offset (OFF).
  • Page 166: Communication Request (commreq)

    If you are using the COMMREQ to conduct serial communications, refer to the Serial I/O, SNP and ▪ RTU Protocols section in PACSystems RX7i, RX3i and RSTi-EP CPU Reference Manual, GFK-2222. If you are using the COMMREQ to interface with an intelligent module (such as Genius ▪...
  • Page 167 Chapter 4. Ladder Diagram (LD) Programming Command Block Structure Address Data Block Length The number of data words starting with the data at address+6 to the (in words) end of the command block, inclusive. The data block length ranges from 1 to 128 words. Each COMMREQ command has its own data block length.
  • Page 168 Chapter 4. Ladder Diagram (LD) Programming Operands for COMMREQ Parameter Description Allowed Operands Optional The reference of the first WORD of the command block. Variables in %R, %P, %L, %AI, %AQ, %W, and symbolic non-discrete variables SYSID The rack number (most significant byte) and slot number All except flow and (least significant byte) of the target device (intelligent variables in %S - %SC...
  • Page 169 Chapter 4. Ladder Diagram (LD) Programming COMMREQ Example 2 The MOVE function can be used to enter the command block contents for the COMMREQ described in example 1. Input IN of the COMMREQ specifies %R00016 as the beginning reference for the command block. Successive references contain the following: %R00016 Data Block Length...
  • Page 170 Chapter 4. Ladder Diagram (LD) Programming The programming logic displayed in example 2 can be simplified by replacing the six MOVE functions with one DATA_INIT_COMM function. GFK-2950C February 2018...
  • Page 171: Data Initialization

    Chapter 4. Ladder Diagram (LD) Programming 4.8.7 Data Initialization The Data Initialization (DATA_INIT) function copies a block of Mnemonics: constant data to a reference range. DATA_INIT_DWORD When the DATA_INIT instruction is first programmed, the constants DATA_INIT_DWORD are initialized to zeroes. To specify the constant data to copy, double- DATA_INIT_INT click the DATA_INIT instruction in the LD editor.
  • Page 172: Data Initialize Ascii

    Chapter 4. Ladder Diagram (LD) Programming 4.8.8 Data Initialize ASCII 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 173: Data Initialize Communications Request

    Chapter 4. Ladder Diagram (LD) Programming 4.8.9 Data Initialize Communications Request 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 174: Data Initialize Dlan

    Chapter 4. Ladder Diagram (LD) Programming 4.8.10 Data Initialize DLAN The Data Initialize DLAN (DATA_INIT_DLAN) function is used with a DLAN Interface module, which is a limited availability, specialty system. If you have a DLAN system, refer to the DLAN/DLAN+ Interface Module User’s Manual, GFK-0729, for details.
  • Page 175: Move

    Chapter 4. Ladder Diagram (LD) Programming 4.8.11 Move When the MOVE function receives power flow, it copies data as individual Mnemonics: bits from one location in PLC memory to another. Because the data is MOVE_BOOL copied in bit format, the new location does not need to be the same data MOVE_DINT type as the original.
  • Page 176 Chapter 4. Ladder Diagram (LD) Programming MOVE Operands Parameter Description Allowed Operands Optional Length (??) The length of IN; the number of bits, words, or double Constant words to copy. If IN is a constant and Q is BOOL, then 1  Length  16; otherwise, 1 ...
  • Page 177: Move Data

    Chapter 4. Ladder Diagram (LD) Programming 4.8.12 Move Data The MOVE_DATA function copies the variable assigned to the input, IN to Mnemonic: the variable assigned to the output, Q. If the constant 0 is assigned to IN, MOVE_DATA the variable assigned to Q is initialized to its default value. MOVE_DATA Operands Parameter Description Allowed Operands...
  • Page 178: Move Data Explicit

    Chapter 4. Ladder Diagram (LD) Programming 4.8.13 Move Data Explicit 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).
  • Page 179: Move From Flat

    Chapter 4. Ladder Diagram (LD) Programming 4.8.14 Move From Flat MOVE_FROM_FLAT copies reference memory data to a User-defined Data Type (UDT) variable or UDT array. MOVE_FROM_FLAT provides optional data coherency by locking the data being written to during the copy operation. This allows data to be copied coherently when accessed by multiple logic threads (i.e.
  • Page 180 Chapter 4. Ladder Diagram (LD) Programming MOVE_FROM_FLAT Operands Parameter Description Allowed Operands Optional Length (??) Determines the number of UDT array elements to be filled Constant by copying data from reference memory to output Q. 1  Length  32,767 Data coherency.
  • Page 181: Move To Flat

    Chapter 4. Ladder Diagram (LD) Programming 4.8.15 Move to Flat MOVE_TO_FLAT instruction copies data from symbolic or I/O variable memory to reference memory. MOVE_TO_FLAT copies across mismatched data types for an operation such as a Modbus transfer. MOVE_TO_FLAT provides optional data coherency by locking the reference memory being written to during the copy operation.
  • Page 182 Chapter 4. Ladder Diagram (LD) Programming MOVE_TO_FLAT Operands Parameter Description Allowed Operands Optional Length (??) The length of IN; the number of elements to copy. Constant 1  Length  32,767 Data coherency. Data flow. If True, the memory being written to is locked. This enables a coherent copy of a UDT to reference memory.
  • Page 183: Shift Register

    Chapter 4. Ladder Diagram (LD) Programming 4.8.16 Shift Register When the Shift Register (SHFR_BIT, SHFR_DWORD, or SHFR_WORD) Mnemonics: function receives power and the R operand does not, SHFR shifts one or SHFR_BIT more data BITs, data DWORDs, or data WORDs from a reference location SHFR_DWORD into a specified area of memory.
  • Page 184 Chapter 4. Ladder Diagram (LD) Programming Operands for Shift Register Parameter Description Allowed Operands Optional Length (??) The number of data items in the shift register, ST. 1  Length  256 Reset. When R is ON, the shift register located at ST is filled with Power flow zeroes.
  • Page 185: Size Of

    Chapter 4. Ladder Diagram (LD) Programming 4.8.17 Size Of Counts the number of bits used by the variable assigned to input Mnemonics: IN and writes the number of bits to output Q. SIZE_OF Operands Parameter Description Allowed Operands Optional The variable whose size in bits is Variable of any data type except BYTE calculated.
  • Page 186: Swap

    Chapter 4. Ladder Diagram (LD) Programming 4.8.18 Swap The SWAP function is used to swap two bytes within a word (SWAP Other WORD) or two words within a double word (SWAP DWORD). The SWAP mnemonic: can be performed over a wide range of memory by specifying a length SWAP_WORD greater than 1.
  • Page 187: Data Table Functions

    Chapter 4. Ladder Diagram (LD) Programming 4.9 Data Table Functions Function Mnemonic Description Array Move ARRAY_MOVE_BOOL Copies a specified number of data elements from a source memory ARRAY_MOVE_BYTE block to a destination memory block. ARRAY_MOVE_DINT Note: The memory blocks do not need to be defined as arrays. You ARRAY_MOVE_INT must supply a starting address and the number of contiguous ARRAY_MOVE_WORD...
  • Page 188 Chapter 4. Ladder Diagram (LD) Programming 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 specified value SEARCH_LE_DINT SEARCH_LE_DWORD SEARCH_LE_INT SEARCH_LE_UINT...
  • Page 189: Array Move

    Chapter 4. Ladder Diagram (LD) Programming 4.9.1 Array Move When the Array Move function receives power flow, it Mnemonics: copies a specified number of elements from a source ARRAY_MOVE_BOOL memory block to a destination memory block. Starting ARRAY_MOVE_BYTE at the indexed location (SR+SNX-1) of the input ARRAY_MOVE_DINT memory block, it copies N elements to the output ARRAY_MOVE_DWORD...
  • Page 190 Chapter 4. Ladder Diagram (LD) Programming Array Move Example 1 To define the input memory block %R0001 - %R0016 and the output memory block %R0100 - %R0115, SR is set as %R0001, DS is set as %R0100, and Length is set to 16. To copy the five registers %R0003 - %R0007 to the registers %R0104 - %R0108, N is set to 5, SNX=%R0100 is set to 3 (to designate the third register, %R0003, of the block starting at...
  • Page 191: Array Range

    Chapter 4. Ladder Diagram (LD) Programming 4.9.2 Array Range The ARRAY_RANGE function compares a single input value Mnemonics: against two arrays of delimiters that specify an upper and ARRAY_RANGE_DINT lower bound to determine if the input value falls within the ARRAY_RANGE_DWORD range specified by the delimiters.
  • Page 192 Chapter 4. Ladder Diagram (LD) Programming Array Range Example 1 The lower limit (LL) values of %R00001 through %R00008 are 1, 20, 30, 100, 25, 50, 10, and 200. The upper limit (UL) values of %R00100 through %R00108 are 40, 50, 150, 2, 45, 90, 250, and 47.
  • Page 193: Fifo Read

    Chapter 4. Ladder Diagram (LD) Programming 4.9.3 FIFO Read The First-In-First-Out (FIFO) Read (FIFO_RD) function moves data out of Mnemonics: tables. Values are always moved out of the bottom of the table. If the FIFO_RD_DINT pointer reaches the last location and the table becomes full, FIFO_RD FIFO_RD_DWORD must be used to remove the entry at the pointer location and FIFO_RD_INT...
  • Page 194 Chapter 4. Ladder Diagram (LD) Programming Example for FIFO Read PRODUCT is a FIFO table with 100 word-sized elements. When the enabling input PACK_IT is ON, the PRODUCT data item in the table location pointed to by STK_PTR is copied to the reference location specified in CART.
  • Page 195: Fifo Write

    Chapter 4. Ladder Diagram (LD) Programming 4.9.4 FIFO Write The First-In-First-Out (FIFO) Write (FIFO_WRT) function moves data Mnemonics: into tables. The function increments the table pointer by one and FIFO_WRT_DINT adds an entry at the new pointer location in a FIFO table. Values are FIFO_WRT_DWORD always moved in at the bottom of the table.
  • Page 196 Chapter 4. Ladder Diagram (LD) Programming Example for FIFO Write 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. Output node FL passes power when PTR = LEN, firing the FULL coil.
  • Page 197: Lifo Read

    Chapter 4. Ladder Diagram (LD) Programming 4.9.5 LIFO Read The Last-In-First-Out (LIFO) Read (LIFO_RD) function moves data out Mnemonics: of tables. Values are always moved out of the top of the table. If the LIFO_RD_DINT pointer reaches the last location and the table becomes full, LIFO_RD LIFO_RD_DWORD must be used to remove the entry at the pointer location and LIFO_RD_INT...
  • Page 198: Lifo Write

    Chapter 4. Ladder Diagram (LD) Programming 4.9.6 LIFO Write The Last-In-First-Out (LIFO) Write (LIFO_WRT) function increments Mnemonics: the table pointer by one and then adds an entry at the new pointer LIFO_WRT_DINT location in a table. Values are always moved in at the top of the LIFO_WRT_DWORD table.
  • Page 199: Search

    Chapter 4. Ladder Diagram (LD) Programming 4.9.7 Search When the Search function receives power, it searches the specified memory block for a value that satisfies the search criteria. For example, SEARCH_GE_DWORD searches for a DWORD that is greater than or equal to the specified value (the IN operand).
  • Page 200 Chapter 4. Ladder Diagram (LD) Programming Operands for the Search Function Note: For each mnemonic, use the corresponding data type for the AR and IN operands. For example, SEARCH_EQ_BYTE requires AR and IN to be BYTE variables. Parameter Description Allowed Operands Optional Length (??) The number of registers starting at AR that make up the Constants...
  • Page 201: Sort

    Chapter 4. Ladder Diagram (LD) Programming 4.9.8 Sort When it receives power flow, the SORT function sorts the elements of the Mnemonics: memory block 'IN' in ascending order. The output memory block Q SORT_INT contains integers that give the index that the sorted elements had in the SORT_UINT original memory block or list.
  • Page 202 Chapter 4. Ladder Diagram (LD) Programming 4.9.9 Table Read The Table Read (TBL_RD) function sequentially reads values in a table. Mnemonics: When the pointer reaches the end of the table, it wraps around to the TBL_RD_DINT beginning of the table. (TBL_RD is like FIFO_RD with a wrap-around.) TBL_RD_DWORD TBL_RD_INT TBL_RD_UINT...
  • Page 203 Chapter 4. Ladder Diagram (LD) Programming 4.9.10 Table Write The Table Write (TBL_WRT) function sequentially updates values in a Mnemonics: table that never becomes full. When the pointer (PTR) reaches the end TBL_WRT_DINT of the table, it automatically returns to the beginning of the table. TBL_WRT_DWORD TBL_WRT_INT TBL_WRT_UINT...
  • Page 204: Math Functions

    Chapter 4. Ladder Diagram (LD) Programming 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.
  • Page 205: Overflow

    Chapter 4. Ladder Diagram (LD) Programming 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 206: Absolute Value

    Chapter 4. Ladder Diagram (LD) Programming 4.10.2 Absolute Value When the function receives power flow, it places the absolute value of Mnemonics: input IN into output Q. ABS_DINT ABS_INT ABS_REAL ABS_LREAL The function outputs power flow, unless one of the following conditions occurs: For INT type, IN is –32,768.
  • Page 207: Add

    Chapter 4. Ladder Diagram (LD) Programming 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 in ADD_DINT the output variable assigned to Q, also of the same data type. ADD_INT ADD_REAL ADD_LREAL...
  • Page 208 Chapter 4. Ladder Diagram (LD) Programming Example1 for ADD 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. The intent of this design is that when %I0001 closes, the ADD instruction should add one to the value in %R00002 and place the new value right back into %R0002.
  • Page 209: Divide

    Chapter 4. Ladder Diagram (LD) Programming 4.10.4 Divide When the DIV function receives power flow, it divides the operand IN1 by the Mnemonics: operand IN2 of the same data type as IN1 and stores the quotient in the DIV_DINT output variable assigned to Q, also of the same data type as IN1 and IN2. DIV_INT The power flow output is energized when DIV is performed, unless an invalid DIV_MIXED...
  • Page 210 Chapter 4. Ladder Diagram (LD) Programming DIV_MIXED Operands Parameter Description Allowed Operands Optional Dividend: the value to be divided; shown to the left of DIV in All except S, SA, SB, SC the equation IN1 DIV IN2=Q. Divisor: the value to divide into IN1; shown to the right of All except S, SA, SB, SC DIV in the equation IN1 DIV IN2=Q.
  • Page 211: Modulus

    Chapter 4. Ladder Diagram (LD) Programming 4.10.5 Modulus When the Modulo Division (MOD) function receives power flow, it divides Mnemonics: input IN1 by input IN2 and outputs the remainder of the division to Q. MOD_DINT MOD_INT MOD_UINT All three operands must be of the same data type. The sign of the result is always the same as the sign of input parameter IN1.
  • Page 212: Multiply

    Chapter 4. Ladder Diagram (LD) Programming 4.10.6 Multiply When the MUL function receives power flow, it multiplies the two operands Mnemonics: IN1 and IN2 of the same data type and stores the result in the output variable MUL_DINT assigned to Q, also of the same data type. MUL_INT The power flow output is energized when the function is performed, unless an MUL_MIXED...
  • Page 213 Chapter 4. Ladder Diagram (LD) Programming Example – Scaling Analog Input Values A common application is to scale analog input values with a MUL operation followed by a DIV and possibly an ADD operation. A 0 to ±10 volt analog input will place values of 0 to ±32,000 in its corresponding %AI input register.
  • Page 214: Scale

    Chapter 4. Ladder Diagram (LD) Programming 4.10.7 Scale When the SCALE function receives power flow, it scales the Mnemonics: input operand IN and places the result in the output variable SCALE_DINT assigned to output operand OUT. The power flow output is SCALE_INT energized when SCALE is performed without Overflow.
  • Page 215: Subtract

    Chapter 4. Ladder Diagram (LD) Programming 4.10.8 Subtract When the SUB function receives power flow, it subtracts the operand Mnemonics: IN2 from the operand IN1 of the same data type as IN2 and stores the SUB_DINT result in the output variable assigned to Q, also of the same data type. SUB_INT SUB_REAL SUB_LREAL...
  • Page 216: Program Flow Functions

    Chapter 4. Ladder Diagram (LD) Programming 4.11 Program Flow Functions The program flow functions limit program execution or change the way the CPU executes the application program. Function Mnemonic Description Argument ARG_PRES Determines whether an input or output parameter value was present when the Present function block instance of the parameter was invoked.
  • Page 217: Argument Present

    Chapter 4. Ladder Diagram (LD) Programming 4.11.1 Argument Present 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 218: Call

    Chapter 4. Ladder Diagram (LD) Programming 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 219 Chapter 4. Ladder Diagram (LD) Programming 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 220 Chapter 4. Ladder Diagram (LD) Programming Example 2 for Call Parameterized blocks are useful for building libraries of user-defined functions. For example, if you have an equation such as: 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 221: Comment

    Chapter 4. Ladder Diagram (LD) Programming 4.11.3 Comment 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 222: Jumpn

    Chapter 4. Ladder Diagram (LD) Programming 4.11.4 JumpN Description Always associated with... Mnemonic Nested form of Jump instruction. a LABELN instruction JUMPN A JUMPN instruction causes a portion of the program logic to be bypassed. Program execution continues at the LABELN specified in the same block. Power flow jumps directly from the JUMPN to the rung with the named LABELN.
  • Page 223: Master Control Relay/end Master Control Relay

    Chapter 4. Ladder Diagram (LD) Programming 4.11.5 Master Control Relay/End Master Control Relay Description Always associated with... Mnemonics Nested form of the Master Control Relay an ENDMCRN instruction MCRN Nested End Master Control Relay an MCRN instruction ENDMCRN MCRN An MCRN instruction marks the beginning of a section of logic that will be executed with no power flow.
  • Page 224 Chapter 4. Ladder Diagram (LD) Programming EndMCRN The End Master Control Relay instruction marks the end of a section of logic begun with a Master Control Relay instruction. When the MCRN associated with the ENDMCRN is active, the ENDMCRN causes program execution to resume with normal power flow. When the MCRN associated with the ENDMCRN is not active, the ENDMCRN has no effect.
  • Page 225: Wires

    Chapter 4. Ladder Diagram (LD) Programming 4.11.6 Wires Horizontal and vertical wires (H_WIRE and V_WIRE) are used to connect elements of a line of LD logic between functions. Their purpose is to complete the flow of logic (power) from left to right in a line of logic.
  • Page 226: Relational Functions

    Chapter 4. Ladder Diagram (LD) Programming 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 by the CMP_INT mnemonic.
  • Page 227: Compare

    Chapter 4. Ladder Diagram (LD) Programming 4.12.1 Compare When the Compare (CMP) function receives power flow, it compares Mnemonics: the value IN1 to the value IN2. CMP_DINT If IN1 < IN2, CMP energizes the LT (Less Than) output. CMP_INT ■ If IN1 = IN2, CMP energizes the EQ (Equal) output.
  • Page 228: Equal, Not Equal, Greater Or Equal, Greater Than, Less Or Equal, Less Than

    Chapter 4. Ladder Diagram (LD) Programming 4.12.2 Equal, Not Equal, Greater or Equal, Greater Than, Less or Equal, Less Than Other data types: _INT _REAL _LREAL _UINT When the relational function receives power flow, it compares input IN1 to input IN2. These operands must be the same data type.
  • Page 229: Eq_data

    Chapter 4. Ladder Diagram (LD) Programming 4.12.3 EQ_DATA The EQ_DATA function compares two input variables, IN1 and IN2 of the Mnemonic: same data type. If IN1 and IN2 are equal, output Q is energized. If they are EQ_DATA not equal, Q is cleared. Operands Parameter Description Allowed Operands...
  • Page 230: Range

    Chapter 4. Ladder Diagram (LD) Programming 4.12.4 Range When the Range function is enabled, it compares the value of input IN Mnemonics: against the range delimited by operands L1 and L2. Either L1 or L2 can be RANGE_DINT the high or low limit. When L1  IN  L2 or L2  IN  L1, output parameter RANGE_DWORD Q is set ON (1).
  • Page 231: Timers

    Chapter 4. Ladder Diagram (LD) Programming 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 232: Timer Function Blocks

    Chapter 4. Ladder Diagram (LD) Programming 4.13.2 Timer Function Blocks Function Function Block Mnemonic Description Type Off Delay Timer Built-in OFDT_HUNDS The Current Value (CV) of the timer resets to zero OFDT_SEC when power flow input is on. CV increments while (instance data is OFDT_TENTHS power flow is off.
  • Page 233 Chapter 4. Ladder Diagram (LD) Programming Warning Do not use two consecutive words (registers) as the starting addresses of two timers. Logic Developer - PLC does not check or warn you if register blocks overlap. Timers will not work if you place the current value of a second timer on top of the preset value for the previous timer.
  • Page 234 Chapter 4. Ladder Diagram (LD) Programming Using OFDT, ONDTR and TMR in Program Blocks not Called Every Sweep Care should be taken when timers (ONDTR, TMR, and OFDTR) are used in program blocks that are not called every sweep. The timers accumulate time across calls to the sub-block unless they are reset.
  • Page 235 Chapter 4. Ladder Diagram (LD) Programming 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: 1.
  • Page 236 Chapter 4. Ladder Diagram (LD) Programming Off Delay Timer The Off-Delay Timer (OFDT) increments while power flow is off, and Mnemonics: the timer's Current Value (CV) resets to zero when power flow is on. OFDT_SEC OFDT passes power until the specified interval PV (Preset Value) has OFDT_TENTHS elapsed.
  • Page 237 Chapter 4. Ladder Diagram (LD) Programming Timing diagram ENABLE A. ENABLE and Q both go high; timer is reset (CV = 0). B. ENABLE goes low; timer starts accumulating time. C. CV reaches PV; Q goes low and timer stops accumulating time. D.
  • Page 238 Chapter 4. Ladder Diagram (LD) Programming On Delay Stopwatch Timer The retentive On-Delay Stopwatch Timer (ONDTR) increments while Mnemonics: it receives power flow and holds its value when power flow stops. ONDTR_SEC Time may be counted in the following increments: ONDTR_TENTHS ONDTR_HUNDS Seconds...
  • Page 239 Chapter 4. Ladder Diagram (LD) Programming ▪ When ONDTR is used in a program block that is not called every scan, it accumulates time between calls to the program block unless it is reset. This means that ONDTR functions like a timer operating in a program with a much slower scan than the timer in the main program block.
  • Page 240 Chapter 4. Ladder Diagram (LD) Programming Example for On Delay Stopwatch Timer 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. GFK-2950C February 2018...
  • Page 241 Chapter 4. Ladder Diagram (LD) Programming On Delay Timer The On-Delay Timer (TMR) increments while it receives power flow and Mnemonics: resets to zero when power flow stops. The timer passes power after the TMR_SEC specified interval PV (Preset Value) has elapsed, as long as power is TMR_TENTHS received.
  • Page 242 Chapter 4. Ladder Diagram (LD) Programming ENABLE goes low; Q goes low; timer stops accumulating time and CV is cleared. ENABLE goes high; timer starts accumulating time. ENABLE goes low before current value reaches PV; Q remains low; timer stops accumulating time and is cleared to zero (CV=0).
  • Page 243: Standard Timer Function Blocks

    Chapter 4. Ladder Diagram (LD) Programming 4.13.3 Standard Timer Function Blocks The standard timers are a pulse timer (TP), an on-delay timer (TON), and an off-delay timer (TOF). The pulse timer block can be used to generate output pulses of a given duration. The on-delay timer can be used to delay setting an output ON for a fixed period after an input is set ON.
  • Page 244 Chapter 4. Ladder Diagram (LD) Programming Operands 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. Note: Writing or forcing values to the instance data elements IN, PT, Q, ET, ENO or TI may cause erratic operation of the timer function block.
  • Page 245 Chapter 4. Ladder Diagram (LD) Programming Timer Off Delay 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 t0 When input IN is set to ON, the output Q follows and remains ON.
  • Page 246 Chapter 4. Ladder Diagram (LD) Programming Timer On Delay When the input IN transitions from OFF to ON, the timer starts timing until a specified period of time (PT) has elapsed, then sets the output Q to ON. Timing Diagram t0 When input IN is set to ON, the timer starts to measure time and the elapsed time output ET starts to increment.
  • Page 247 Chapter 4. Ladder Diagram (LD) Programming Timer Pulse When the input IN transitions from OFF to ON, the timer sets the output Q to ON for the specified time interval, PT Timing Diagram t0 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.
  • Page 248: Chapter 5 Function Block Diagram (fbd)

    Chapter 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. The block types Block, Parameterized Block, and Function Block can be programmed in FBD. The _MAIN program block can also be programmed in FBD.
  • Page 249: Note On Reentrancy

    Chapter 5. Function Block Diagram (FBD) 5.1 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 250: Advanced Math Functions

    Chapter 5. Function Block Diagram (FBD) 5.2 Advanced Math Functions The Advanced Math functions perform logarithmic, exponential, square root, trigonometric, and inverse trigonometric operations. Function Description Absolute value. Finds the absolute value of a double- precision integer (DINT), signed single- precision integer (INT), REAL or LREAL (floating-point) value.
  • Page 251 Chapter 5. Function Block Diagram (FBD) Function Description Calculates the sine of the operand IN, where IN is expressed in radians. For details, refer to Trig Functions in Chapter 4. Calculates the tangent of the operand IN, where IN is expressed in radians. For details, refer to Trig Functions in Chapter 4.
  • Page 252: Expt Function

    Chapter 5. Function Block Diagram (FBD) 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. The instruction is not carried out if one of the following invalid conditions occurs: IN1 <...
  • Page 253: Bit Operation Functions

    Chapter 5. Function Block Diagram (FBD) 5.3 Bit Operation Functions The Bit Operation functions perform comparison, logical, and move operations on bit strings. Bit Operation functions treat each WORD or DWORD data as a continuous string of bits, with bit 1 of the WORD or DWORD being the Least Significant Bit (LSB).
  • Page 254 Chapter 5. Function Block Diagram (FBD) Function Description Rotate Bits Right. Rotates all the bits in a string a specified number of places to the right. For details, refer to Bit Operation Functions in Chapter 4. Shift Bits Left. Shifts all the bits in a word or string of words to the left by a specified number of places.
  • Page 255: Logical And, Logical Or, And Logical Xor

    Chapter 5. Function Block Diagram (FBD) 5.3.1 Logical AND, Logical OR, and Logical XOR The Logical functions examine each bit in bit string IN1 and the corresponding bit in bit string IN2, beginning with the least significant bit in each string, and places the result in Q. If additional inputs (IN3 up to IN8) are used, the function compares each bit in the input with the corresponding bit in Q and places the result in Q.
  • Page 256 Chapter 5. Function Block Diagram (FBD) Logical XOR If the bits in the strings examined by XOR are different, a 1 is placed in the corresponding position in the output bit string. For each pair of bits examined, if only one bit is 1, XOR places a 1 in the corresponding location in string Q.
  • Page 257: Logical Not

    Chapter 5. Function Block Diagram (FBD) 5.3.2 Logical NOT The Logical Not or Logical Invert (NOT) function 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 258: Comments

    Chapter 5. Function Block Diagram (FBD) 5.4 Comments 5.4.1 Text Block The Text block is used to place an explanation in the program. When you type in a comment, the first few words are displayed. To increase the size of the text box and display more text, select the box and drag one of the handles.
  • Page 259: Comparison Functions

    Chapter 5. Function Block Diagram (FBD) 5.5 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 Chapter 4.
  • Page 260 Chapter 5. Function Block Diagram (FBD) Function Description Range. Tests whether one number is within the range defined by two other supplied numbers. For details, refer to Relational Functions in Chapter 4. GFK-2950C February 2018...
  • Page 261: Equal, Not Equal, Greater Or Equal, Greater Than, Less Or Equal, Less Than

    Chapter 5. Function Block Diagram (FBD) 5.5.1 Equal, Not Equal, Greater or Equal, Greater Than, Less or Equal, Less Than The relational functions compare input IN1 to input IN2. These operands must be the same data type. If inputs IN1 and IN2 are equal, the function outputs the result to Q, unless IN1 and/or IN2 is NaN (Not a Number).
  • Page 262: Control Functions

    Chapter 5. Function Block Diagram (FBD) 5.6 Control Functions The control functions limit program execution and change the way the CPU executes the application program. Function Description Do I/O Interrupt. For one scan, immediately services a specified range of inputs or outputs.
  • Page 263 Chapter 5. Function Block Diagram (FBD) Function Description Scan Set I/O. Scans the IO of a specified scan set. For details, refer to Control Functions in Chapter 4. Suspend I/O. Suspends for one sweep all normal I/O updates, except those specified by DO I/O instructions.
  • Page 264: Counters

    Chapter 5. Function Block Diagram (FBD) 5.7 Counters Function Description Down Counter. Counts down from a preset value. The output is ON whenever the Current Value is  0. 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 counter uses to store its current value, preset value and control word.
  • Page 265: Data Move Functions

    Chapter 5. Function Block Diagram (FBD) 5.8 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 Chapter 4. Array Size Dim1.
  • Page 266 Chapter 5. Function Block Diagram (FBD) 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 Chapter 4. Bus Test and Set.
  • Page 267 Chapter 5. Function Block Diagram (FBD) 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 Chapter 4. Fan Out. Copies the input value to multiple outputs of the same data type as the input.
  • Page 268 Chapter 5. Function Block Diagram (FBD) 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 Chapter 4.
  • Page 269: Fan Out

    Chapter 5. Function Block Diagram (FBD) 5.8.1 Fan Out Copies the input IN to multiple outputs. Operands Parameter Description Allowed Types Allowed Operands Optional Solve Order Calculated by the FBD editor. The input to copy to the BOOL, DINT, DWORD, INT, All except SA, SB, SC.
  • Page 270: Move Data

    Chapter 5. Function Block Diagram (FBD) 5.8.2 Move Data When the input operand, EN, is set to ON, the MOVE instruction copies data as bits from one location in PACSystems controller memory to another. Because the data is copied as bits, the new location does not need to use the same type of memory area as the source.
  • Page 271 Chapter 5. Function Block Diagram (FBD) MOV Operands Parameter Description Allowed Types Allowed Operands Optional 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 in R, P, L, AI, AQ, W, a non-BOOL...
  • Page 272: Math Functions

    Chapter 5. Function Block Diagram (FBD) 5.9 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.
  • Page 273: Overflow

    Chapter 5. Function Block Diagram (FBD) Function Description Scales an input parameter and places the result in an output location. For details, refer to Math Functions in Chapter 4. Subtraction. Subtracts one or up to seven numbers from the input IN1 and places the result in an output location.
  • Page 274: Add

    Chapter 5. Function Block Diagram (FBD) 5.9.2 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 275: Divide

    Chapter 5. Function Block Diagram (FBD) 5.9.3 Divide Divides the operand IN1 by the operand IN2 of the same data type as IN1 and stores the quotient in the output variable assigned to Q, also of the same data type as IN1 and IN2.
  • Page 276: Modulus

    Chapter 5. Function Block Diagram (FBD) 5.9.4 Modulus Divides input IN1 by input IN2 and outputs the remainder of the division to Q. All three operands must be of the same data type. The sign of the result is always the same as the sign of input parameter IN1.
  • Page 277: Multiply

    Chapter 5. Function Block Diagram (FBD) 5.9.5 Multiply Multiplies two through eight operands (IN1 … IN8) of the same data type and stores the result in the output variable assigned to Q, also of the same data type. The output is calculated when the function is performed without Overflow, unless an invalid operation occurs.
  • Page 278: Negate

    Chapter 5. Function Block Diagram (FBD) 5.9.6 Negate Multiplies a number by –1 and places the result in the output location, Q. Operands Parameter Description Allowed Types Allowed Operands Optional Solve Order Calculated by the FBD editor. The value to be negated. INT, DINT, REAL All except S, SA, SB, SC No The result, -1(IN)
  • Page 279: Subtract

    Chapter 5. Function Block Diagram (FBD) 5.9.7 Subtract Subtracts the operands IN2 …IN8 from the operand IN1 and stores the result in the output variable assigned to The calculation is carried out when SUB is performed without Overflow, unless an invalid operation occurs. If a SUB operation results in Overflow, the result wraps around.
  • Page 280: Program Flow Functions

    Chapter 5. Function Block Diagram (FBD) 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 281: Timers

    Chapter 5. Function Block Diagram (FBD) 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 282: Standard Timer Function Blocks

    Chapter 5. Function Block Diagram (FBD) 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. Instance variables are automatically located in symbolic memory.
  • Page 283: Type Conversion Functions

    Chapter 5. Function Block Diagram (FBD) 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 284 Chapter 5. Function Block Diagram (FBD) Function Description INT_TO_DINT: Converts INT to DINT. REAL_TO_DINT: Converts REAL (32-bit signed real or floating-point values) to DINT. For details, refer to Conversion Functions in Chapter 4. DWORD_TO_DINT: Converts a 32-bit bit string (DWORD) value to DINT. Convert DWORD to DINT For details, refer to below.
  • Page 285: Convert Word To Int

    Chapter 5. Function Block Diagram (FBD) 5.12.1 Convert WORD to INT 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. The output data can be used directly as input for another program function, as in the examples.
  • Page 286: Convert Word To Uint

    Chapter 5. Function Block Diagram (FBD) 5.12.2 Convert WORD to UINT 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 287: Convert Dword To Dint

    Chapter 5. Function Block Diagram (FBD) 5.12.3 Convert DWORD to DINT Converts DWORD data into the equivalent signed double-precision integer (DINT) value and stores the result in Q. The conversion to DINT does not change the original data. The output data can be used directly as input for another program function.
  • Page 288: Convert Int Or Uint To Word

    Chapter 5. Function Block Diagram (FBD) 5.12.4 Convert INT or UINT to WORD Converts an unsigned single-precision integer (UINT) operand IN to a 16- bit bit string (WORD) value and stores the result in the variable assigned to Q. Converts a 16-bit signed integer (INT) operand IN to a 16-bit bit string (WORD) value and stores the result in the variable assigned to Q.
  • Page 289: Convert Dint To Dword

    Chapter 5. Function Block Diagram (FBD) 5.12.5 Convert DINT to DWORD 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.
  • Page 290: Chapter 6 Service Request Function

    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. SVC_REQ 26 Role switch (redundancy)
  • Page 291: Operation Of Svc_req Function

    Chapter 6. Service Request Function 6.1 Operation of SVC_REQ Function PACSystems supports the Service Request function in LD and FBD. 6.1.1 Ladder Diagram When SVC_REQ receives power flow, it requests the CPU to perform the special service identified by the FNC operand. Parameters for SVC_REQ are located in the parameter block, which begins at the reference identified by the PRM operand.
  • Page 292: Function Block Diagram

    Chapter 6. Service Request Function 6.1.2 Function Block Diagram The SVC_REQ function requests the CPU to perform the special service identified by the FNC operand. Parameters for SVC_REQ are located in the parameter block, which begins at the reference identified by the PRM operand. The number of 16-bit references required depends on the type of special controller service being requested.
  • Page 293: Svc_req 1: Change/read Constant Sweep Timer

    Chapter 6. Service Request Function 6.2 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 294: To Read The Current Timer State And Value Without Changing Either

    Chapter 6. Service Request Function 6.2.5 To read the current timer state and value without changing either: Enter SVC_REQ 1 with this parameter block: Address Address + 1 ignored Output SVC_REQ 1 returns the timer state and value in the same parameter block references: Address 0 = Normal Sweep 1 = Constant Sweep...
  • Page 295: Svc_req 2: Read Window Modes And Time Values

    Chapter 6. Service Request Function 6.3 SVC_REQ 2: Read Window Modes and Time Values Use SVC_REQ 2 to obtain the current window mode and time values for the controller communications window and the backplane communications and the background task window. The parameter block has a length of three words.
  • Page 296: Svc_req 3: Change Controller Communications Window Mode

    Chapter 6. Service Request Function 6.4 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. The parameter block has a length of one word.
  • Page 297: Svc_req 4: Change Backplane Communications Window Mode And Timer Value

    Chapter 6. Service Request Function 6.5 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. SVC_REQ 4 executes unless a mode other than 0 (Limited) or 2 (Run to Completion) is selected.
  • Page 298: Svc_req 5: Change Background Task Window Mode And Timer Value

    Chapter 6. Service Request Function 6.6 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 299: Svc_req 6: Change/read Number Of Words To Checksum

    Chapter 6. Service Request Function 6.7 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 300 Chapter 6. Service Request Function SVC_REQ 6 Example 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.
  • Page 301: Svc_req 7: Read Or Change The Time-of-day Clock

    Chapter 6. Service Request Function 6.8 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 302 Chapter 6. Service Request Function In any format: ▪ Hours are stored in 24-hour format. ▪ Day of the week is a numeric value ranging from 1 (Sunday) to 7 (Saturday). Value Day of the Week Sunday Monday Tuesday Wednesday Thursday Friday Saturday...
  • Page 303 Chapter 6. Service Request Function 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. This format can also be useful if your application communicates to other devices using the POSIX time format.
  • Page 304 Chapter 6. Service Request Function 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. Values are hexadecimal.
  • Page 305 Chapter 6. Service Request Function 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: Parameter Block Format Address...
  • Page 306 Chapter 6. Service Request Function 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. ASCII format for a 2-digit year requires 12 words in the parameter block.
  • Page 307 Chapter 6. Service Request Function Packed ASCII, 4-Digit Year ASCII format for a 4-digit year requires 13 words in the parameter block. Values are hexadecimal. Parameter Block Format Address Example (Mon., Oct. 5, 2005, at 11:13:25 p.m. = 23:13:25 in 24-hour format) 1 = change or 0 = read Address 0h (read)
  • Page 308 Chapter 6. Service Request Function SVC_REQ 7 Example In this example, the time of day is set to 12:00 pm without changing the current year, BCD format requires six contiguous memory locations for the parameter block. Rung 1 sets up the new time of day in two-digit year BCD format. It writes the value 4608 (equivalent to 12 00 BCD) to NOON and the value 0 to MIN_SEC.
  • Page 309: Svc_req 8: Reset Watchdog Timer

    Chapter 6. Service Request Function 6.9 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 goes to STOP-Halt mode without warning. SVC_REQ 8 allows the timer to keep going during a time-consuming task (for example, while waiting for a response from a communications line).
  • Page 310: Svc_req 9: Read Sweep Time From Beginning Of Sweep

    Chapter 6. Service Request Function 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; it has a length of one word. Address time since start of scan SVC_REQ 9 Example The elapsed time from the start of the scan is...
  • Page 311: Svc_req 10: Read Target Name

    Chapter 6. Service Request Function 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 312: Svc_req 11: Read Controller Id

    Chapter 6. Service Request Function 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 313: Svc_req 12: Read Controller Run State

    Chapter 6. Service Request Function 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 When contact V_I00102 is ON, the CPU run state is read into location %R4002.
  • Page 314: Svc_req 13: Shut Down (stop) Cpu

    -1: The CPU uses the Number of Last Scans value configured in the Hardware Configuration Scan tab to determine when to transition to STOP Mode. For details on Hardware PACSystems RX7i, RX3i and RSTi-EP CPU Reference Configuration parameters, refer to Manual , GFK-2222.
  • Page 315: Svc_req 14: Clear Controller Or I/o Fault Table

    Chapter 6. Service Request Function 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. The parameter block has a length of 1 word.
  • Page 316: Svc_req 15: Read Last-logged Fault Table Entry

    Chapter 6. Service Request Function 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 317 Chapter 6. Service Request Function 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 fault tables 00 = 8 bytes (short) 01 = 24 bytes (long) I/O extended and non-extended fault tables 02 = 5 bytes (short) 03 = 21 bytes (long)
  • Page 318 Chapter 6. Service Request Function SVC_REQ 15 Example 2 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 319: Svc_req 16: Read Elapsed Time Clock

    Chapter 6. Service Request Function 6.17 SVC_REQ 16: Read Elapsed Time Clock Use SVC_REQ 16 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 three words used for output only.
  • Page 320 Chapter 6. Service Request Function Note: Higher resolution (in nanoseconds) can be obtained by using SVC_REQ 50: Read Elapsed Time Clock. GFK-2950C February 2018...
  • Page 321: Svc_req 17: Mask/unmask I/o Interrupt

    When the CPU transitions from STOP Mode to RUN Mode, the interrupt is unmasked. For additional information on configuring and using VME module interrupts in a PACSystems RX7i control system, refer to PACSystems RX7i User's Guide to Integration of VME Modules, GFK-2235.
  • Page 322 Chapter 6. Service Request Function SVC_REQ 17 Example 1 In this example, interrupts from input %I00033 are masked. The following values are moved into the parameter block, which starts at %P00347, on the first scan: Address %P00347 Interrupts from input are masked.
  • Page 323: Svc_req 18: Read I/o Forced Status

    Chapter 6. Service Request Function 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. Note: SVC_REQ 18 does not detect overrides in %G or %M memory types. Use %S0011 (#OVR_PRE) to detect overrides in %I, %Q, %G, %M, and symbolic memory types.
  • Page 324: Svc_req 19: Set Run Enable/disable

    Chapter 6. Service Request Function 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 325: Svc_req 20: Read Fault Tables

    Chapter 6. Service Request Function 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 326: Non-extended Formats

    Chapter 6. Service Request Function 6.21.1 Non-Extended Formats Input Parameter Block Format Amount of Retuned Data Address + 0 00h = Read Controller Fault Table 693 registers required for resulting output 01h = Read I/O Fault Table 693 registers required for resulting output 41h = Read I/O Fault Table with Remote Fault Record 757 registers required for resulting output Address + 1 Always 0...
  • Page 327 Chapter 6. Service Request Function For the non-extended formats, the returned data for each fault consists of 21 words (42 bytes) for 00h and 01h and 23 words (46 bytes) for 41h. This request returns 16 Controller Fault Table entries or 32 I/O Fault Table entries, or the actual number of faults, if fewer.
  • Page 328 Chapter 6. Service Request Function Format for Parameter Setting 41h I/O Fault Table with Remote Fault Record (0x41) Output Format Address 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 Remote Device ID Address+26...
  • Page 329: Extended Formats

    Chapter 6. Service Request Function 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 330 Chapter 6. Service Request Function Extended Format Output Parameter Block Format Controller Fault Table Output Format I/O Fault Table Output Format Address High Byte Low Byte High Byte Low Byte 80h = Extended Controller 81h = Extended Unused Address Unused Fault Table I/O Fault Table Starting index of faults to be read...
  • Page 331 Chapter 6. Service Request Function Format of Returned Data for Fault Table Entries Format for Parameter Setting 0x80h & 0x81h Controller Fault Table (0x80) Output Format I/O Fault Table (0x81) Output Format Address High Byte Low Byte High Byte Low Byte Reference address Unused Long/Short...
  • Page 332 Chapter 6. Service Request Function Format for Parameter Setting 0xC1h I/O Fault Table with Remote Fault Record (0xC1) Output Format Address High Byte Low Byte Reference address Address+37 Long/Short Value memory type Address+38 Reference address offset Address+39 Slot Rack Address+40 Remote Slot Remote Rack Address+41...
  • Page 333 Chapter 6. Service Request Function 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 334: Svc_req 21: User-defined Fault Logging

    Chapter 6. Service Request Function 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. The error code information for the fault must be within the range 0 to 2047 for an Application Msg: to be displayed.
  • Page 335 Chapter 6. Service Request Function 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. This message will then be displayed in the fault description area of the fault table.
  • Page 336: Svc_req 22: Mask/unmask Timed Interrupts

    Chapter 6. Service Request Function 6.23 SVC_REQ 22: Mask/Unmask Timed Interrupts Use SVC_REQ 22 to mask or unmask timed interrupts and to read the current mask. When the interrupts are masked, the CPU does not execute any timed interrupt block timed program that is associated with a timed interrupt.
  • Page 337: Svc_req 23: Read Master Checksum

    Chapter 6. Service Request Function 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. There is no input parameter block for this service request.
  • Page 338: Svc_req 24: Reset Module

    Chapter 6. Service Request Function 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: An invalid number for rack and/or slot is entered.
  • Page 339: Svc_req 25: Disable/enable Exe Block And Standalone C Program Checksums

    Chapter 6. Service Request Function 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. Address 0 = Disable C applications inclusion in checksum calculation 1 = Enable C application inclusion in checksum calculation The parameter block is unchanged after execution of the service request.
  • Page 340: Svc_req 29: Read Elapsed Power Down Time

    Chapter 6. Service Request Function 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 0.
  • Page 341: Svc_req 32: Suspend/resume I/o Interrupt

    Chapter 6. Service Request Function 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 342: Svc_req 45: Skip Next I/o Scan

    Chapter 6. Service Request Function 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 343: Svc_req 50: Read Elapsed Time Clock

    Chapter 6. Service Request Function 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 344 Chapter 6. Service Request Function SVC_REQ 50 Example The following logic is used in a block that is called once in a while. 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 345: Svc_req 51: Read Sweep Time From Beginning Of Sweep

    Chapter 6. Service Request Function 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; it has a length of two words. Address time (nanoseconds) since start of scan –...
  • Page 346: Svc_req 56: Logic Driven Read Of Nonvolatile Storage

    Chapter 6. Service Request Function 6.32 SVC_REQ 56: Logic Driven Read of Nonvolatile Storage PACSystems controllers support a 64KB nonvolatile flash memory area, which can be accessed by the logic-driven read/write service requests. Values are stored in the nonvolatile storage area using SVC_REQ 57: Logic Driven Write to Nonvolatile Storage.
  • Page 347: Parameter Block

    Chapter 6. Service Request Function 6.32.5 Parameter Block Address+0 Memory type. Refer to Memory Type Codes below. Address+1 The zero-based offset N to read from nonvolatile storage. Contains the complete offset for any memory area except %W, which also requires the use of address + 2 for offsets greater Address+2 than 65,535.
  • Page 348 Chapter 6. Service Request Function 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 Minor...
  • Page 349 Chapter 6. Service Request Function 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 350: Svc_req 57: Logic Driven Write To Nonvolatile Storage

    Chapter 6. Service Request Function 6.33 SVC_REQ 57: Logic Driven Write to Nonvolatile Storage PACSystems controllers support a 65,500 byte 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 351: Erase Cycles

    Chapter 6. Service Request Function 6.33.3 Erase Cycles The flash component on the PACSystems CPU is rated for 100K erase cycles. Erase cycles occur under the following conditions: ▪ Write to flash is commanded from the programmer. ▪ Clear flash operation. ▪...
  • Page 352: Fragmentation

    Chapter 6. Service Request Function 6.33.9 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 353: Equality

    Chapter 6. Service Request Function 6.33.11 Equality Because data in nonvolatile storage is not considered part of the project, writing to nonvolatile storage does not impact equality between the CPU and Logic Developer. 6.33.12 Redundancy Redundancy systems can benefit from the use of logic driven user nonvolatile storage as long as all of the references saved to nonvolatile storage are included in the transfer lists.
  • Page 354: Parameter Block For Svc_req 57

    Chapter 6. Service Request Function 6.33.14 Parameter Block for SVC_REQ 57 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 offsets greater Address+2 than 65,535.
  • Page 355 Chapter 6. Service Request Function 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. Counting from the offset, not enough reference addresses are left in the specified memory area.
  • Page 356 Chapter 6. Service Request Function 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. Parameter Block for SVC_REQ 57 Example Address + Offset Address...
  • Page 358: Chapter 7 Pid Built-in Function Block

    Chapter 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 359: Operands Of The Pid Function

    Chapter 7. PID Built-In Function Block 7.1 Operands of the PID Function 7.1.1 Operands for LD Version of PID Function Block Parameter Description Allowed Types Allowed Operands Optional Instance Variable name of the PID WORD R, L, P, W Parameter Block array, which contains user- (????) and symbolic configurable and internal parameters,...
  • Page 360: Operands For Fbd Version Of Pid Function Block

    Chapter 7. PID Built-In Function Block 7.1.2 Operands for FBD Version of PID Function Block Parameter Description Allowed Types Allowed Operands Optional Control Instance Variable name of the PID WORD R, L, P, W Structure Parameter Block array, which contains and symbolic Variable user-configurable and internal...
  • Page 361: Reference Array For The Pid Function

    Chapter 7. PID Built-In Function Block 7.2 Reference Array for the PID Function This parameter block for the PID function occupies 40 words of memory, located at the starting Instance Variable specified in the PID function block operands. Some of the words are configurable. Other words are used by the CPU for internal PID storage and are normally not changed.
  • Page 362: Reference Array Parameters

    Chapter 7. PID Built-In Function Block 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 363 Chapter 7. PID Built-In Function Block Low Bit Words Parameter/Description Range Units PID_IND: Derivative Gain (Kd) 0.01 sec 0 to 327.67 sec PID_ISA: Derivative Time (Td = Kd) (Address+6) PID_IND: Change in the control variable in CV Counts if the Error or PV changes 1 PV Count every 10ms.
  • Page 364 Chapter 7. PID Built-In Function Block Low Bit Words Parameter/Description Range Units Minimum Slew Time Seconds / 0 (none) to Full 32,000 sec (Address+11) Minimum number of seconds for the CV output to move from 0 to full Travel to move full CV travel of 100% or 32,000 CV Counts.
  • Page 365 Chapter 7. PID Built-In Function Block Low Bit Words Parameter/Description Range Units Config Word Low 6 Boolean bits used (Address+12) The low 6 bits of this word are used to modify default PID settings. The other bits should be set to 0. Bit 0: Error Term Mode.
  • Page 366 Chapter 7. PID Built-In Function Block Low Bit Words Parameter/Description Range Units Manual Command Tracks CV in Counts Auto or sets (Address+13) Set to the current CV output while the PID block is in Automatic CV in Manual mode. When the block is switched to Manual mode, this value is used to set the CV output and the internal value of the integral term within the Upper and Lower Clamp and Slew Time limits.
  • Page 367 Chapter 7. PID Built-In Function Block Low Bit Words Parameter/Description Range Units Internal PV Set and Non- maintained configurable, (Address+17) Tracks PV input. Must be set externally if Override bit is set to 1. by the CPU, unless bit 0 unless bit 0 (Override) of (Override) of...
  • Page 368: Operation Of The Pid Function

    Chapter 7. PID Built-In Function Block 7.3 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 369: Time Interval For The Pid Function

    Chapter 7. PID Built-In Function Block 7.3.3 Time Interval for the PID Function The start time of each CPU sweep is used as the current time when calculating the time interval between solutions of the PID function. The times and time intervals have a resolution of 100 µs. When an application uses multiple PID functions, all of them use the same time value.
  • Page 370: Pid Algorithm Selection (pidisa Or Pidind) And Gain Calculations

    Chapter 7. PID Built-In Function Block 7.4 PID Algorithm Selection (PIDISA or PIDIND) and Gain Calculations The PID function supports both the Independent Term (PID_IND) and ISA standard (PID_ISA) forms of the PID algorithm. The Independent Term form takes its name from the fact that the coefficients for the proportional, integral and derivative terms act independently.
  • Page 371: Derivative Term

    Chapter 7. PID Built-In Function Block 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 * Δ error / dt = Kd * (Error – previous Error) / dt where dt = Current controller time –...
  • Page 372: Cv Bias Term

    Chapter 7. PID Built-In Function Block 7.4.5 CV Bias Term The CV Bias term (word 9 in the reference array) is an additive term separate from the PID inputs. It may be useful if you are using only Proportional gain (Kp) and you want the CV to be a non-zero value when the PV equals the SP and the Error is 0.
  • Page 373: Sample Period And Pid Function Block Scheduling

    Chapter 7. PID Built-In Function Block 7.4.7 Sample Period and PID Function Block Scheduling The PID function block is a digital implementation of an analog control function, so the dt sample time in the PID Output equation is not the infinitesimally small sample time available with analog controls.
  • Page 374: Determining The Process Characteristics

    Chapter 7. PID Built-In Function Block 7.5 Determining the Process Characteristics The PID loop gains, Kp, Ki and Kd, are determined by the characteristics of the process being controlled. Two key questions when setting up a PID loop are: 1. How big is the change in PV when CV is changed by a fixed amount, or what is the open loop gain of the process? 2.
  • Page 375: Setting Tuning Loop Gains

    Chapter 7. PID Built-In Function Block 7.6 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 376: Setting Loop Gains Using The Ziegler And Nichols Tuning Approach

    Chapter 7. PID Built-In Function Block 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 377: Ideal Tuning Method

    Chapter 7. PID Built-In Function Block 7.6.3 Ideal Tuning Method The Ideal Tuning procedure provides the best response to SP changes that are delayed only by the T process delay or dead time. 1. Determine the three process model parameters, K, Tp and Tc for use in estimating initial PID loop gains.
  • Page 378: Pid Example

    Chapter 7. PID Built-In Function Block 7.7 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 379: Figure 17: Pid Example Logic

    Chapter 7. PID Built-In Function Block Figure 17: PID Example Logic PACSystems* RX7i, RX3i and RSTi-EP CPU Programmer's Reference Manual GFK-2950C...
  • Page 380: Chapter 8 Structured Text (st) Programming

    Chapter 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. The block types Block, Parameterized Block, and Function Block (UDFB) can be programmed in ST.
  • Page 381: Operators

    Chapter 8. Structured Text (ST) Programming 8.1.3 Operators The table below lists the operators that you can use within an expression. They are listed according to their evaluation precedence, which determines the sequence in which they are executed within the expression. The operator with the highest precedence is applied first, followed by the operator with the next highest precedence.
  • Page 382: Structured Text Syntax

    Chapter 8. Structured Text (ST) Programming 8.1.4 Structured Text Syntax The syntax of the ST implementation for PACSystems follows the IEC 61131-3 standard. Structured Text statements must end in a semi-colon (;). ▪ Structured Text variables must be declared in the variable list for the target. ▪...
  • Page 383: Statement Types

    Chapter 8. Structured Text (ST) Programming 8.2 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 Type Description Example Assignment Sets an object to a specified value. A := 1;...
  • Page 384: Assignment Statement

    Chapter 8. Structured Text (ST) Programming 8.2.1 Assignment Statement The assignment statement replaces the value of a variable with the result of evaluating an expression (of the same data type). Notes: Assignment statements can affect transition bits. ▪ Assignment statements take override bits into account. ▪...
  • Page 385: Function Call

    Chapter 8. Structured Text (ST) Programming 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.
  • Page 386 Chapter 8. Structured Text (ST) Programming Calls to Standard Function Blocks Standard function blocks are instructions that have instance data in the form of a structure variable. (For more information on function blocks and their instance data, refer to Functions and Function Blocks in Chapter 2.) Standard function blocks are called in the same way that a UDFB is called.
  • Page 387 Chapter 8. Structured Text (ST) Programming Formal Calls vs. Informal Calls PACSystems supports formal and informal calls in ST. Formal Calls Informal Calls Input parameter assignments use the ‘:=’ Input and output parameters are listed in parentheses. notation while output assignments use the ‘=>’ notation.
  • Page 388: Return Statement

    Chapter 8. Structured Text (ST) Programming 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. a := 4;...
  • Page 389: If Statement

    Chapter 8. Structured Text (ST) Programming 8.2.4 IF Statement The IF construct offers conditional execution of a statement list. The condition is determined by result of a Boolean expression. The IF construct includes two optional parts, ELSE and ELSIF, that provide conditional execution of alternate statement list(s).
  • Page 390: Case Statement

    Chapter 8. Structured Text (ST) Programming 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 391 Chapter 8. Structured Text (ST) Programming Examples The following code fragment assigns a value to the variable ColorVariable. CASE ColorSelection OF ColorVariable:= Red; ColorVariable:= Yellow; 2,3,4: ColorVariable:= Green; 5..9: ColorVariable:= Blue; ELSE ColorVariable:= Violet; END_CASE; The following code fragment uses a nested CASE…OF…END_CASE construct. CASE ColorSelection OF ColorVariable:= Red;...
  • Page 392: For

    Chapter 8. Structured Text (ST) Programming 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.
  • Page 393 Chapter 8. Structured Text (ST) Programming Examples The following code fragment initializes an array of 100 elements starting at %R1000 (given that R1000 is at %R1000) by assigning a value of 10 to all array elements. FOR R1000 := 1 TO 100 DO @R1000 := 10;...
  • Page 394: While Statement

    Chapter 8. Structured Text (ST) Programming 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 395: Repeat Statement

    Chapter 8. Structured Text (ST) Programming 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 396: Arg_pres Statement

    Chapter 8. Structured Text (ST) Programming 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 397: Exit Statement

    Chapter 8. Structured Text (ST) Programming 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. Format EXIT;...
  • Page 398: Chapter 9 Diagnostics

    Chapter 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. Some conditions, such as the loss of an I/O module or rack, may impair the ability of the PACSystems controller to control a machine or process.
  • Page 399: Fault Handling Overview

    Chapter 9. Diagnostics 9.1 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 Operational Failures...
  • Page 400: Fault Actions And Fault Action Configuration

    Chapter 9. Diagnostics 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. Diagnostic faults are recorded in the appropriate table, and any diagnostic variables are set.
  • Page 401: Using The Fault Tables

    Chapter 9. Diagnostics 9.2 Using the Fault Tables To display the fault tables in Logic Developer software, 1. Go online with the PACSystems. 2. Select the Project tab in the Navigator, right click the Target node and choose Diagnostics. The Fault Table Viewer appears.
  • Page 402: Figure 19: Detail Information For Controller Fault Entry

    Chapter 9. Diagnostics 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 403: I/o Fault Table

    Chapter 9. Diagnostics 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 404: Figure 21: I/o Fault Table Fault Entry Detail Display

    Chapter 9. Diagnostics 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 21: 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 405: System Handling Of Faults

    Chapter 9. Diagnostics 9.3 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 Chapter 3.) System Fault Address Description Reference...
  • Page 406: System Fault References

    Chapter 9. Diagnostics 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 Fault References for Non- Configurable Faults in the section which follows. Fault References for Configurable Faults Fault (Default...
  • Page 407 Chapter 9. Diagnostics Fault References for Non-Configurable Faults Fault Address Description Result #PS_FLT %SA0005 Power supply fault Sets #SY_FLT, #SY_PRES #HRD_CPU %SA0010 CPU hardware fault (such as failed Sets #SY_FLT, #SY_PRES, #HRD_FLT (fatal) memory device or failed serial port). #HRD_SIO %SA0027 Non-fatal hardware fault on any module in Sets #SY_FLT, #SY_PRES, #HRD_FLT...
  • Page 408 Chapter 9. Diagnostics Fault Address Description Result #WIND_ER %SB0001 Window completion error. Servicing of Sets #SY_FLT and #SY_PRES. (information) Controller Communications or Logic Window was skipped. Occurs in Constant Sweep mode. #BAD_PWD %SB0011 Change of privilege level request to a Sets #SY_FLT and #SY_PRES.
  • Page 409: Using Fault Contacts

    Chapter 9. Diagnostics 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 410 Chapter 9. Diagnostics Fault Reference Name Examples: #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 flow, and the NOFLT contact does not pass power flow), regardless of what type of module it is.
  • Page 411: Using Point Faults

    Chapter 9. Diagnostics 9.3.3 Using Point Faults Point faults pertain to external I/O faults, although they are also set due to the failure of associated higher-level internal hardware (for example, IOC failure or loss of a rack). To use point faults, they must be enabled in Hardware Configuration on the Memory parameters tab of the CPU.
  • Page 412: Controller Fault Descriptions And Corrective Actions

    If a system configuration mismatch occurs when the CPU is in RUN Mode, the fault action will be Diagnostic regardless of the fault configuration. For additional information, refer to Fault Parameters in PACSystems RX7i, RX3i and RSTi-EP CPU Reference Manual, GFK-2222.
  • Page 413: Loss Of Or Missing Rack (group 1)

    Chapter 9. Diagnostics 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 414: Loss Of Or Missing Option Module (group 4)

    Chapter 9. Diagnostics 9.4.3 Loss of or Missing Option Module (Group 4) The fault group Loss of or Missing 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 415: Reset Of, Addition Of, Or Extra Option Module (group 8)

    Chapter 9. Diagnostics 9.4.5 Reset of, Addition of, or Extra Option Module (Group 8) The fault group Reset of, Addition of, or Extra Option Module occurs when an option module (LAN interface module, BTM, etc.) comes online, is reset, is hot inserted or a module is found in the rack but is not configured.
  • Page 416: System Configuration Mismatch (group 11)

    Chapter 9. Diagnostics 9.4.6 System Configuration Mismatch (Group 11) The fault group Configuration Mismatch occurs when the module occupying a slot is different from that specified in the configuration file. When the GBC generates the mismatch because of a Genius block, the second byte in the Fault Extra Data field contains the bus address of the mismatched block.
  • Page 417 Chapter 9. Diagnostics Number Description Decimal Hexadecimal Phase B 24-48Vdc 16-point Proximity Sink Block Phase B 24Vdc 16-point Proximity Sink Block Phase B 24-48Vdc 16-point Source Block Phase B 24Vdc 16-point Proximity Source Block Phase B 12-24Vdc 32-point Sink Block Phase B 12-24Vdc 32-point Source Block Phase B 12-24Vdc 32-point 5V Logic Block Phase B 115Vac 16-point Quad State Input Block...
  • Page 418 Chapter 9. Diagnostics 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 1) Remove the indicated Genius module and install the module indicated in the configuration file. 2) Update the Genius module descriptions in the configuration file to agree with what is physically installed.
  • Page 419 Chapter 9. Diagnostics Correction 1) Replace the Analog Expander module with one corresponding to configured module. 2) Update the configuration file. 9, Genius I/O Block Size Mismatch The CPU generates this error when block configuration size does not match the configured size. Correction Reconfigure the block.
  • Page 420 Chapter 9. Diagnostics 11 hex/17 decimal, LAN Softswitch/Modem mismatch Configuration of LAN module does not match modem type or configuration programmed by softswitch utility. Correction 1) Correct configuration of modem type. 2) Consult LAN Interface manual for configuration setup. 13 hex/19 decimal, DCD Length Mismatch Directed control data lengths do not match.
  • Page 421 Chapter 9. Diagnostics Correction Set the ECC jumper to the enabled position. (See the instructions provided with the Redundancy CPU firmware upgrade kit). 4C hex/76 decimal, ECC jumper is enabled, but should be disabled If the CPU firmware does not support redundancy, the ECC jumper must be in the disabled position. Correction Set the ECC jumper to the disabled position (jumper on one pin or removed entirely).
  • Page 422: System Bus Error (group 12)

    Chapter 9. Diagnostics 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. Configurable. 4, Unrecognized VME Interrupt Source The CPU generates this error when a module generates an interrupt not expected by the CPU (unconfigured or unrecognized).
  • Page 423: Cpu Hardware Failure (group 13)

    Chapter 9. Diagnostics 9.4.8 CPU Hardware Failure (Group 13) The fault group CPU Hardware occurs when the CPU detects a hardware failure, such as a RAM failure or a communications port failure. When a CPU Hardware failure occurs, the OK LED will flash on and off to indicate that the failure was not serious enough to prevent Controller Communications to retrieve the fault information.
  • Page 424: Module Hardware Failure (group 14)

    Chapter 9. Diagnostics 9.4.9 Module Hardware Failure (Group 14) The fault group Module Hardware Failure occurs when the CPU detects a non-fatal hardware failure on any module in the system, for example, a serial port failure on a LAN interface module. The fault action for this group is Diagnostic.
  • Page 425: Option Module Software Failure (group 16)

    Chapter 9. Diagnostics 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. ▪ The Ethernet Interface logs an event in its Ethernet exception log. ▪...
  • Page 426: Program Or Block Checksum Failure (group 17)

    Chapter 9. Diagnostics 9.4.11 Program or Block Checksum Failure (Group 17) The fault group Program or Block Checksum Failure occurs when the CPU detects error conditions in program or blocks. It also occurs during RUN Mode background checking. In all cases, the Fault Extra Data field of the Controller Fault Table record contains the name of the program or block in which the error occurred.
  • Page 427: Battery Status (group 18)

    The Controller fault table indicates the battery status. For details of LED operation of specific CPUs, refer to PACSystems RX7i, RX3i and RSTi-EP CPU Reference Manual, GFK-2222. When a Failed Battery fault is logged, this fault is also logged.
  • Page 428: Constant Sweep Time Exceeded (group 19)

    Chapter 9. Diagnostics 9.4.13 Constant Sweep Time Exceeded (Group 19) The fault group Constant Sweep Exceeded occurs when the CPU operates in Constant Sweep mode and detects that the sweep has exceeded the constant sweep timer. In the fault extra data, the DWORD at byte offset 8 contains the amount of time that the sweep went beyond the constant sweep time (in microsecond units).
  • Page 429: User Application Fault (group 22)

    Chapter 9. Diagnostics 9.4.16 User Application Fault (Group 22) The fault group Application Fault occurs when the CPU detects a fault in the user program. Action: Non-configurable. 2, Software Watchdog Timer Expired The CPU generates this error when the watchdog timer expires. The CPU stops executing the user program and enters STOP/Halt Mode.
  • Page 430 Chapter 9. Diagnostics 36 hex/54 decimal, Operand is not byte aligned. A variable in user logic is not properly byte-aligned for the requested operation. Correction Correct logic or adjust memory size in hardware configuration. 39 hex/57 decimal, DLB heartbeat not received, All DLBs stopped and deleted The controller has not received a heartbeat signal from the programmer within the time specified by the DLB Heartbeat setting in the Target properties.
  • Page 431: Cpu Over-temperature (group 24)

    Chapter 9. Diagnostics 9.4.17 CPU Over-Temperature (Group 24) Default action: Diagnostic. Configurable. 1, Over-Temperature failure. CPU’s normal operating temperature exceeded. Correction Turn off CPU to allow heat to disperse and install a fan kit to regulate temperature. 9.4.18 Power Supply Fault (Group 25) Action: Non-configurable.
  • Page 432: Corrupted User Program On Power-up (group 130)

    Chapter 9. Diagnostics 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. 1, Corrupted user RAM on power-up The CPU generates this error when it detects corrupted user RAM on power-up.
  • Page 433: Password Access Failure (group 132)

    Chapter 9. Diagnostics 9.4.22 Password Access Failure (Group 132) The fault group Password Access Failure occurs when the CPU receives a request to change to a new privilege level and the password included with the request is not valid for that level. Action: Non-configurable.
  • Page 434: Cpu System Software Failure (group 135)

    Chapter 9. Diagnostics 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 435 Chapter 9. Diagnostics 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. Error Fault Extra Description...
  • Page 436: Communications Failure During Store (group 137)

    Chapter 9. Diagnostics 9.4.25 Communications Failure During Store (Group 137) This fault group occurs during the store of programs or blocks and other data to the CPU. The stream of commands and data for storing programs or blocks and data starts with a special start-of- sequence command and terminates with an end-of-sequence command.
  • Page 437: Non-critical Cpu Software Event (group 140)

    Chapter 9. Diagnostics 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 No corrective action is required unless this fault 1-30 Events during power-up occurs with other specific faults.
  • Page 438 Chapter 9. Diagnostics Interpreting the Fault Extra Data Bytes 1 - 8: Ignored when decoding a security-related fault. Byte 9: The operation during which the fault occurred. ▪ 01 (as in the example): Read ▪ 02: Write Byte 10: The hexadecimal value (HV) that specifies a CPU memory area. Hexadecimal Memory area Value (HV)
  • Page 439: I/o Fault Descriptions And Corrective Actions

    Chapter 9. Diagnostics 9.5 I/O Fault Descriptions and Corrective Actions The I/O fault table reports the following data about faults: ▪ Fault Group ▪ Fault Action ▪ Fault category ▪ Fault type ▪ Fault description All faults have a fault category, but a fault type and fault group may not be listed for every fault. To view the detailed information pertaining to a fault, click the fault entry in the I/O Fault Table.
  • Page 440: I/o Fault Categories

    Chapter 9. Diagnostics 9.5.3 I/O Fault Categories Category Fault Type Fault Description Fault Extra Data Circuit Fault (1) Discrete Fault (1) 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 441 Chapter 9. Diagnostics Category Fault Type Fault Description Fault Extra Data Low-Level Analog Fault (4) Input Channel Low Alarm Circuit Configuration (01 hex) Input Channel High Alarm Circuit Configuration (02 hex) Input Channel Under Range Circuit Configuration (04 hex) Input Channel Over Range Circuit Configuration (08 hex) Input Channel Open Wire...
  • Page 442 Chapter 9. Diagnostics Category Fault Type Fault Description Fault Extra Data IOC Software Fault (11) NA Forced Circuit (12) Block Configuration Discrete/Analog Indication* Unforced Circuit (13) Block Configuration Discrete/Analog Indication* Loss of I/O Module (14) NA Addition of I/O Module VME Module Reset (15) Requested (30 hex)
  • Page 443: Circuit Faults (category 1)

    Chapter 9. Diagnostics 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 444 Chapter 9. Diagnostics Fault Descriptions for Discrete Faults 1, Loss of User Side Power The GBC generates this error when there is a power loss on the field wiring side of a Genius I/O block. Correction 1) (Only valid for Isolated I/O blocks.) Initiate Pulse Test COMREQ #1. Pulse test may be enabled or disabled at I/O block.
  • Page 445 Chapter 9. Diagnostics 84 hex, Output Fuse Blown The CPU generates this error when it detects a blown fuse on a Genius I/O output block. Correction 1) Determine and repair the cause of the fuse blowing; replace the fuse. 2) Replace the block. Fault Descriptions for Analog Faults 1, Input Channel Low Alarm The GBC generates this error when the Genius Analog module reports a low alarm on an input...
  • Page 446 Chapter 9. Diagnostics Correction Correct the problem causing the condition. 40 hex/64 decimal, Output Channel Over Range The GBC generates this error when the Genius Analog module reports an over-range condition on an output channel. Correction Correct the problem causing the condition. 80 hex/128 decimal, Expansion Channel Not Responding The CPU generates this error when data from an expansion channel on a multiplexed analog input board is not responding.
  • Page 447 Chapter 9. Diagnostics 10 hex, Input Channel Open Wire The GBC generates this error when the Genius Analog module detects an open wire condition on an input channel. Correction Correct the problem causing the condition. 20 hex/32 decimal, Wiring Error The GBC generates this error when the Genius Analog module detects an improper RTD connection or thermocouple reverse junction fault.
  • Page 448: Loss Of Block (category 2)

    Chapter 9. Diagnostics 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. Correction 1) Verify power and wiring to the block.
  • Page 449: Addition Of Block (category 3)

    Chapter 9. Diagnostics 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 450: I/o Bus Fault (category 6)

    Chapter 9. Diagnostics 9.5.7 I/O Bus Fault (Category 6) The fault category I/O Bus Faults has three fault types associated with it. Default action: Diagnostic. Configurable. Bus Fault The GBC operating software generates this error when it detects a failure with a Genius I/O bus. (Generated when Error Rate in the GBC configuration is exceeded—the default Error Rate is 10 errors in a 10 second period).
  • Page 451: Module Fault (category 8)

    Chapter 9. Diagnostics 9.5.8 Module Fault (Category 8) The fault category Module Fault has one fault type, headend fault, and eight fault descriptions. This fault category does not provide fault extra data. The default fault action for this category is Diagnostic.
  • Page 452: Addition Of Ioc (category 9)

    Chapter 9. Diagnostics 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 that no IOC is to be in that slot or when an IOC is hot inserted.
  • Page 453: Ioc (i/o Controller) Software Fault (category 11)

    Chapter 9. Diagnostics 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 454: Loss Of Or Missing I/o Module (category 14)

    Chapter 9. Diagnostics 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. Configurable. The CPU generates this error when it detects that an I/O module is no longer responding to commands from the CPU, or when the configuration file indicates an I/O module is to occupy a slot and no module exists in the slot.
  • Page 455: Extra Block (category 17)

    Chapter 9. Diagnostics 9.5.16 Extra Block (Category 17) The fault category Extra Block applies only to Genius I/O devices. There are no fault types or fault descriptions associated with this category. Action: Diagnostic. The GBC generates this error when it detects a Genius device on the bus at a serial bus address where the configuration file does not have a block.
  • Page 456: Gbc Software Exception (category 21)

    Chapter 9. Diagnostics 9.5.19 GBC Software Exception (Category 21) 1, Incoming datagram 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. 2, Read/write request queue full The queue for Read/Write requests in the GBC is full.
  • Page 457: Block Switch (category 22)

    Chapter 9. Diagnostics 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. Correction 1) No action is required to keep the block operating.
  • Page 458: Diagnostic Logic Blocks (dlbs)

    Chapter 9. Diagnostics 9.6 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. DLBs may be used to: Collect information from a running application to analyze and diagnose problems ▪...
  • Page 459: Dlb Operation

    Chapter 9. Diagnostics 9.6.1 DLB Operation 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. as other block types.
  • Page 460 Chapter 9. Diagnostics Restrictions on DLB Operation Because DLBs are intended only for temporary use, there are more restrictions on their operation compared to application logic blocks. All built-in functions and function blocks other than those listed below can be used in DLB logic. ▪...
  • Page 461: Executing Dlbs

    Chapter 9. Diagnostics 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 sweep, until ▪ explicitly stopped.
  • Page 462 Chapter 9. Diagnostics Right-click Online Operations for an Active DLB Menu Enable Rules Description Download Disabled if block is already running on controller, Downloads block to controller, target not in programmer mode, Config+Logic is not removing any other DLB that was equal, or Access Level prevents write.
  • Page 463 Chapter 9. Diagnostics Removing a DLB from the Controller The following actions will cause the DLB to be removed from the controller. If the DLB is executing, it will be stopped before being removed. ▪ Removing the DLB from the controller through the Online Operations menu. ▪...
  • Page 464 Chapter 9. Diagnostics Monitoring DLB Execution There are several tools to monitor the execution of the DLB in the controller: ▪ DLB Local Symbolic variables monitored in Data Watch, LD Editor, or Data Monitor. ▪ DLB Icon shows the DLB state in the Navigator: Downloaded to controller or Executing ▪...
  • Page 465: Diagnostic Logic Block (dlb) Example

    Chapter 9. Diagnostics 9.6.3 Diagnostic Logic Block (DLB) Example In this example, a block of LD logic is downloaded to the controller and executed. The basic steps for using a sample DLB in the controller are as follows: 1) Create an LD block named MonitorScan and place it in the Toolchest. For information on working with the Toolchest, refer to the online help.
  • Page 466 Chapter 9. Diagnostics GFK-2950C February 2018...
  • Page 467: Figure 25: Drag Dlb From Toolchest And Drop In Active Blocks Node

    Chapter 9. Diagnostics 2) Drag and drop the DLB Block from the Toolchest to the Active Blocks node in the Navigator. Figure 25: Drag DLB from Toolchest and Drop in Active Blocks Node 3) In the DLB block properties, set the Execution Mode to Sweep. Figure 26: Set DLB Execution Mode to Sweep (Properties Tab) 4) Go online to the Controller, and select Programmer Mode.
  • Page 468: Figure 28: Initialize Local Symbolic Variables

    Chapter 9. Diagnostics 6) In the Initialize Symbolic Variables dialog box, select how new local symbolic variables will be initialized and click OK. Figure 28: Initialize Local Symbolic Variables 7) Notice the change in the DLB Icon and the DLB status in the Status bar. DLB Block Icon/Status Bar Once Started.
  • Page 469 GE Automation & Controls Additional Resources Information Centers For more information, please Headquarters: visit the GE’s Automation & 1-800-433-2682 or 1-434-978-5100 Controls web site: Global regional phone numbers www.geautomation.com are available on our web site www.geautomation-ip.com Copyright ©2014-2018 General Electric Company. All Rights Reserved.

This manual is also suitable for:

Pacsystems rx3iPacsystems rsti-ep

Comments to this Manuals

Symbols: 0
Latest comments: