Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeContact

The text of a manual · part 5 of 39

Series 90-30/20/Micro PLC CPU Instruction Set Reference Manual, pages 38 to 47

Pages 38 to 47 of 337

The original document is the PDF (4.4 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

For the GE Fanuc IC692CPU211D / IC692MDR541C, Fanuc IC692CPU211D / IC692MDR541C, GE IC692CPU211D / IC692MDR541C and GE Fanuc IC693CPU311X

Page 38

2 In addition to being called from the program, subroutine blocks can also be called by other subroutine blocks (this is called “nesting”). A subroutine block may even call itself. a45663

SUBROUTINE 2 SUBROUTINE 4

PROGRAM

SUBROUTINE 3

The PLC will only allow eight nested calls before an “Application Stack Overflow” fault is logged and the PLC transitions to STOP/Fault mode. The call level nesting counts the main program as level 1.

How Blocks Are Called A subroutine block executes when called from program logic in a ladder program or from another subroutine block.

| |%I0004 %T0001 | - - | | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ( ) - | ______________ |%I0006 | | | - - | | - - - - - | CALL ASTRO | - | | (SUBROUTINE) | | |______________| | |%I0003 %I0010 %Q0010 | - - | | - - - - - | | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ( ) - |

This example shows the subroutine CALL instruction as it will appear on the ladder logic screen.

Execution Sequence in Programs Containing Subroutines If a subroutine is called from a program or other subroutine, the called subroutine will execute to its end, then return control back to the program or subroutine that called it. Control will return to the rung following the rung that contains the subroutine call. In the example below, the heavy dotted line shows program flow (the order in which logic is executed). In this example, a simple two-rung subroutine is called from Rung 4 of the Main Program. After the two subroutine rungs are executed, program flow returns to the Main Program, starting with Rung 5.

GFK-0467M

Chapter 2 System Operation

2-19

Page 39

2 Main Program Rung 1 Rung 2 Rung 3 Rung 4, Call Subroutine 1 Rung 5 Rung 6 Rung 7 … End

Program Flow Subroutine 1 Rung 1 Rung 2 Return

Periodic Subroutines Version 4.20 or later of the 340 and higher CPUs support periodic subroutines. Please note the following restrictions: 1.

Timer (TMR, ONDTR, and OFDTR) function blocks will not execute properly within a periodic subroutine. A DOIO function block within a periodic subroutine whose reference range includes references assigned to a Smart I/O Module (HSC, APM, DSM, Genius, etc.) will cause the CPU to lose communication with the module. The FST_SCN and LST_SCN contacts (%S1 and %S2) will have an indeterminate value during execution of the periodic subroutine. A periodic subroutine cannot call or be called by other subroutines.

2.

The latency for the periodic subroutine (that is, the maximum interval between the time the periodic subroutine should have executed and the time it actually executes) can be around 0.35 milliseconds if there is no PCM, CMM, or ADC module in the main rack. If there is a PCM, CMM or ADC module in the main rack - even if it is not configured or used - the latency can be almost 2.25 milliseconds. For that reason, use of the periodic subroutine with PCM-based products is not recommended.

User References The data used in an application program is stored as either register or discrete references. Table 2-4. Register References

2-20

Type

Description

%R

The prefix %R is used to assign system register references, which will store program data such as the results of calculations.

%AI

The prefix %AI represents an analog input register. This prefix is followed by the register address of the reference (for example, %AI0015). An analog input register holds the value of one analog input or other value.

%AQ

The prefix %AQ represents an analog output register. This prefix is followed by the register address of the reference (for example, %AQ0056). An analog output register holds the value of one analog output or other value.

Series 90™-30/20/Micro PLC CPU Instruction Set Reference Manual – May 2002

GFK-0467M

Page 40

2 Note All register references are retained across a power cycle to the CPU. Table 2-5. Discrete References Type

Description

%I

The %I prefix represents input references. This prefix is followed by the reference’s address in the input table (for example, %I00121). %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 the configuration software or the Hand-Held Programmer. Until a reference address is assigned, no data will be received from the module. %I data can be retentive or non-retentive.

%Q

The %Q prefix represents physical output references. The coil check function of Logicmaster 90-30/20/Micro software checks for multiple uses of %Q references with relay coils or outputs on functions. Beginning with Release 3 of the software, you can select the level of coil checking desired (SINGLE, WARN MULTIPLE, or MULTIPLE). Refer to the Programming Software User’s Manual, GFK-0466, for more information about this feature. The %Q prefix is followed by the reference’s address in the output table (for example, %Q00016). %Q references are located in the output status table, which stores the state of the output references as last set by the application program. This output status table’s values are sent to output modules during the output scan. A reference address is assigned to discrete output modules using the configuration software or the Hand-Held Programmer. Until a reference address is assigned, no data is sent to the module. A particular %Q reference may be either retentive or non-retentive. *

%M

The %M prefix represents internal references. The coil check function checks for multiple uses of %M references with relay coils or outputs on functions. Beginning with Release 3 of the software, you can select the level of coil checking desired (SINGLE, WARN MULTIPLE, or MULTIPLE). Refer to GFK-0466 for more information about this feature. A particular %M reference may be either retentive or non-retentive. *

%T

The %T prefix represents temporary references. Because these references are never checked for multiple coil use, they can be used many times in the same program, even when coil use checking is enabled. %T can be used to prevent coil use conflicts while using the cut/paste and file write/include functions. Because this memory is intended for temporary use, it is not retained through power loss or RUN-TO-STOP-TO-RUN transitions and cannot be used with retentive coils.

%S

The %S prefix represents system status references. These references are used to access special PLC data, such as timers, scan information, and fault information. System references include %S, %SA, %SB, and %SC references. %S, %SA, %SB, and %SC can be used on any contacts. %SA, %SB, and %SC can be used on retentive coils –(M)–. %S can be used as word or bit-string input arguments to functions or function blocks. %SA, %SB, and %SC can be used as word or bit-string input or output arguments to functions and function blocks.

%G

*

GFK-0467M

The %G prefix represents global data references. These references are used to access data shared among several PLCs. %G references can be used on contacts and retentive coils because %G memory is always retentive. %G cannot be used on non-retentive coils.

Retentiveness is based on the type of coil. For more information, refer to “Retentiveness of Data” on the next page.

Chapter 2 System Operation

2-21

Page 41

2 Nicknames A user may, optionally, assign a nickname to a reference address. A nickname is useful because it can convey information to the user about the purpose or function of the address. For example, in a PLC system installed in a factory, output coil %Q0001 is used to energize a motor starter relay that controls a physical pump, commonly called “Pump Number 1” by the factory’s employees. Assigning the nickname PUMP1 to %Q0001 would help an employee who is troubleshooting the system to recognize the purpose of %Q0001. Nicknames must begin with a letter and may be from one to seven characters long. To distinguish between a memory address (reference) and a nickname, a percent sign (%) is used as the first character of a memory address. So, for example, M1 is considered by the PLC to be a nickname, but %M1 is considered to be a memory address. For more information about nicknames, please see manual GFK-0466 (the Logicmaster user’s manual for the Series 90-30 PLC).

Transitions and Overrides The %I, %Q, %M, and %G user references have associated transition and override bits. %T, %S, %SA, %SB, and %SC references have transition bits, but not override bits. The CPU uses transition bits for counters and transitional coils. Note that counters do not use the same kind of transition bits as coils. Transition bits for counters are stored within the locating reference. In the Model 331 and higher CPUs, override bits can be set. When override bits are set, the associated references cannot be changed from the program or the input device; they can only be changed on command from the programmer. CPU Models 323, 321, 313, and 311, and the Micro CPUs do not support overriding discrete references.

Retentiveness of Data Data is said to be retentive if it is saved by the PLC when the PLC is stopped. The Series 90 PLC preserves program logic, fault tables and diagnostics, overrides and output forces, word data (%R, %AI, %AQ), bit data (%I, %SC, %G, fault bits and reserved bits), %Q and %M data (unless used with non-retentive coils), and word data stored in %Q and %M. %T data is not saved. Although, as stated above, %SC bit data is retentive, the defaults for %S, %SA, and %SB are non-retentive. %Q and %M references are non-retentive (that is, cleared at power-up when the PLC switches from STOP to RUN) whenever they are used with non-retentive coils. Non-retentive coils include coils, ( ) - , negated coils, (/) - , SET coils, (S) - , and RESET coils, (R) - . When %Q or %M references are used with retentive coils, or are used as function block outputs, the contents are retained through power loss and RUN-TO-STOP-TO-RUN transitions. Retentive coils include retentive coils, (M) - , negated retentive coils, (/M) - , retentive SET coils, (SM) - , and retentive RESET coils, (RM) - . The last time a %Q or %M reference is programmed on a coil instruction determines whether the %Q or %M reference is retentive or non-retentive based on the coil type. For example, if %Q0001 was last programmed as the reference of a retentive coil, the %Q0001 data will be retentive. However, if %Q0001 was last programmed on a non-retentive coil, the %Q0001 data will be non-retentive.

2-22

Series 90™-30/20/Micro PLC CPU Instruction Set Reference Manual – May 2002

GFK-0467M

Page 42

2

Data Types Table 2-6. Data Types Type INT

DINT

Name Signed Integer

Double Precision Signed Integer

Description Signed integers use 16-bit memory data locations, and are represented in 2’s complement notation. (Bit 16 is the sign bit.) The valid range of an INT data type is –32,768 to +32,767.

Register 1 S| 16 1

Double precision signed integers are stored in 32-bit data memory locations (actually two consecutive 16-bit memory locations) and represented in 2’s complement notation. (Bit 32 is the sign bit.) The valid range of a DINT data type is –2,147,483,648 to +2,147,483,647.

Register 2 S| 32 17

BIT

Bit

A Bit data type is the smallest unit of memory. It has two states, 1 or 0. A BIT string may have length N.

BYTE

Byte

A Byte data type has an 8-bit value. The valid range is 0 to 255 (0 to FF in hexadecimal).

WORD

Word

A Word data type uses 16 consecutive bits of data memory; but, instead of the bits in the data location representing a number, the bits are independent of each other. Each bit represents its own binary state (1 or 0), and the bits are not looked at together to represent an integer number. The valid range of word values is 0 to FFFF.

DWORD Double Word

BCD-4

REAL

Data Format

A Double Word data type has the same characteristics as a single word data type, except that it uses 32 consecutive bits in data memory instead of 16 bits. The valid range of double word values is 0 to FFFFFFFF.

Four-Digit Binary Coded Decimal

Four-digit BCD numbers use 16-bit data memory locations. Each BCD digit uses four bits and can represent numbers between 0 and 9. This BCD coding of the 16 bits has a legal value range of 0 to 9999.

Floating Point

Real numbers use 32 consecutive bits (actually two consecutive 16-bit memory locations). The range of numbers that can be stored in this format is from ± 1.401298E-45 to ± 3.402823E+38.

(16 bit positions)

Register 1 16

1

(Two’s Complement Value)

Register 1 (16 bit positions) 16

1

Register 2 32

Register 1 17

16

1

(32 bit states)

Register 1 4 |3 | 2 | 1 16 13

9

5

(4 BCD digits) 1

Register 2 S| 32 17

Register 1 16

1

(Two’s Complement Value) S = Sign bit (0 = positive, 1 = negative).

GFK-0467M

Chapter 2 System Operation

2-23

Page 43

2

System Status References System status references in the Series 90 PLC are assigned to %S, %SA, %SB, and %SC memory. They each have a nickname. Examples of time tick references include T_10MS, T_100MS, T_SEC, and T_MIN. Examples of convenience references include FST_SCN, ALW_ON, and ALW_OFF.

Note %S bits are read-only bits; do not write to these bits. You may, however, write to %SA, %SB, and %SC bits. Listed below are system status references that can be used in an application program. When entering logic, either the reference or the nickname can be used. Refer to chapter 3, “Fault Explanations and Correction,” for more detailed fault descriptions and information on correcting the fault. You cannot use these special nicknames to name other memory references. Table 2-7. System Status References Reference

Nickname

%S0001

FST_SCN

Set to 1 when the current sweep is the first sweep.

%S0002

LST_SCN

Reset from 1 to 0 when the current sweep is the last sweep.

%S0003

T_10MS

0.01 second timer contact.

%S0004

T_100MS

0.1 second timer contact.

%S0005

T_SEC

1.0 second timer contact.

%S0006

T_MIN

1.0 minute timer contact.

%S0007

ALW_ON

Always ON.

%S0008

ALW_OFF

Always OFF.

%S0009

SY_FULL

Set when the PLC fault table fills up. Cleared when an entry is removed from the PLC fault table and when the PLC fault table is cleared.

%S0010

IO_FULL

Set when the I/O fault table fills up. Cleared when an entry is removed from the I/O fault table and when the I/O fault table is cleared.

%S0011

OVR_PRE

Set when an override exists in %I, %Q, %M, or %G memory.

%S0013

PRG_CHK

Set when background program check is active.

%S0014

PLC_BAT

%S0017 %S0018 %S0019 %S0020

SNPXACT SNPX_RD SNPX_WT

Set to indicate a bad battery in a Release 4 or later CPU. The contact reference is updated once per sweep. SNP-X host is actively attached to the CPU. SNP-X host has read data from the CPU. SNP-X host has written data to the CPU. Set ON when a relational function using REAL data executes successfully. It is cleared when either input is NaN (Not a Number).

%S0032

2-24

Definition

Reserved for use by the programming software.

%SA0001

PB_SUM

Set when a checksum calculated on the application program does not match the reference checksum. If the fault was due to a temporary failure, the discrete bit can be cleared by again storing the program to the CPU. If the fault was due to a hardware RAM failure, the CPU must be replaced.

%SA0002

OV_SWP

Set when the PLC detects that the previous sweep took longer than the time specified by the user. Cleared when the PLC detects that the previous sweep did not take longer than the specified time. It is also cleared during the transition from STOP to RUN mode. Only valid if the PLC is in CONSTANT SWEEP mode.

Series 90™-30/20/Micro PLC CPU Instruction Set Reference Manual – May 2002

GFK-0467M

Page 44

2 Reference

Nickname

Definition

%SA0003

APL_FLT

Set when an application fault occurs. Cleared when the PLC transitions from STOP to RUN mode.

%SA0009

CFG_MM

Set when a configuration mismatch is detected during system power-up or during a store of the configuration. Cleared by powering up the PLC when no mismatches are present or during a store of configuration that matches hardware.

%SA0010

HRD_CPU

Set when the diagnostics detects a problem with the CPU hardware. Cleared by replacing the CPU module.

%SA0011

LOW_BAT

Set when a low battery fault occurs. Cleared by replacing the battery and ensuring that the PLC powers up without the low battery condition.

%SA0014

LOS_IOM

Set when an I/O module stops communicating with the PLC CPU. Cleared by replacing the module and cycling power on the main rack.

%SA0015

LOS_SIO

Set when an option module stops communicating with the PLC CPU. Cleared by replacing the module and cycling power on the main rack.

%SA0019

ADD_IOM

Set when an I/O module is added to a rack. Cleared by cycling power on the main rack and when the configuration matches the hardware after a store.

%SA0020

ADD_SIO

Set when an option module is added to a rack. Cleared by cycling power on the main rack and when the configuration matches the hardware after a store.

%SA0027

HRD_SIO

Set when a hardware failure is detected in an option module. Cleared by replacing the module and cycling power on the main rack.

%SA0031

SFT_SIO

Set when an unrecoverable software fault is detected in an option module. Cleared by cycling power on the main rack and when the configuration matches the hardware.

%SB0010

BAD_RAM

Set when the CPU detects corrupted RAM memory at power-up. cleared when the CPU detects that RAM memory is valid at power-up.

%SB0011

BAD_PWD

Set when a password access violation occurs. Cleared when the PLC fault table is cleared.

%SB0013

SFT_CPU

Set when the CPU detects an unrecoverable error in the software. Cleared by clearing the PLC fault table.

%SB0014

STOR_ER

Set when an error occurs during a programmer store operation. Cleared when a store operation is completed successfully.

%SC0009

ANY_FLT

Set when any fault occurs. Cleared when both fault tables have no entries.

%SC0010

SY_FLT

Set when any fault occurs that causes an entry to be placed in the PLC fault table. Cleared when the PLC fault table has no entries.

%SC0011

IO_FLT

Set when any fault occurs that causes an entry to be placed in the I/O fault table. Cleared when the I/O fault table has no entries.

%SC0012

SY_PRES

Set as long as there is at least one entry in the PLC fault table. Cleared when the PLC fault table has no entries.

%SC0013

IO_PRES

Set as long as there is at least one entry in the I/O fault table. Cleared when the I/O fault table has no entries.

%SC0014

HRD_FLT

Set when a hardware fault occurs. Cleared when both fault tables have no entries.

%SC0015

SFT_FLT

Set when a software fault occurs. Cleared when both fault tables have no entries.

Note: Any %S reference not listed here is reserved and must not be used in program logic.

GFK-0467M

Chapter 2 System Operation

2-25

Page 45

2

Function Block Structure Each rung of logic is composed of one or more programming instructions. These may be simple relays or more complex functions.

Format of Ladder Logic Relays The programming software includes several types of relay functions. These functions provide basic flow and control of logic in the program. Examples include a normally open relay contact and a negated coil. Each of these relay contacts and coils has one input and one output. Together, they provide logic flow through the contact or coil. Each relay contact or coil must be given a reference which is entered when selecting the relay. For a contact, the reference represents a location in memory that determines the flow of power into the contact. In the following example, if reference %I0122 is ON, power will flow through this relay contact. %I0122 –| |–

For a coil, the reference represents a location in memory that is controlled by the flow of power into the coil. In this example, if power flows into the left side of the coil, reference %Q0004 is turned ON. %Q0004 –( )–

The programming software and the Hand-Held Programmer both have a coil check function that checks for multiple uses of %Q or %M references with relay coils or outputs on functions.

Format of Program Function Blocks (Instructions) Some functions are very simple, like the Master Control Relay (MCR) function, which is shown with the abbreviated name of the function within brackets: –[ MCR ]–

Other functions are more complex. They may have several places where you will enter information (parameter data) to be used by the function. The example function block illustrated below is a multiplication (MUL) instruction. Its parts are typical of many function blocks. However, the number and types of parameters used can vary widely among the various type of function blocks. The upper part of the function block shows the name of the function. It may also show a data type, in this case, signed integer.

2-26

Series 90™-30/20/Micro PLC CPU Instruction Set Reference Manual – May 2002

GFK-0467M

Page 46

2 Many program functions (instructions) allow you to select the data type for the function after selecting the function. For example, the data type for the MUL function could be changed to double precision signed integer (D_INT). Additional information on data types is provided earlier in this chapter.

Instruction Type

Data Type MUL INT

GFK-0467M

Chapter 2 System Operation

???????

I1

???????

I2

Q

???????

2-27

Page 47

2

Function Block (Instruction) Parameters Each line entering the left side of a function block represents an input for that function. There are two forms of input used with function blocks, discrete and analog. Discrete inputs are either ON or OFF. In the figure below, the enabling contact %I0001 is an example of a discrete input. Analog inputs can be either constants or references. A constant is an explicit value. A reference is the memory address of a value. Generally, a reference is used if the input data is subject to change. For example, a reference might be the address of an input from an analog measuring device. In the following example, input parameter I1 for an ADD function block is a constant, and input parameter I2 is a reference. %Q0001

%I0001 ADD Int CONST +00010

I1

%AI0001

I2

Q

%R0002

Each line exiting the right side of the function block represents an output. Outputs can be either discrete or analog. If analog, the value is placed into a register (reference). In the example above, the function block’s OK output is discrete and it controls coil %Q0001. Its Q output, however, holds the resulting value from the math operation , so it is placed into a register, %R0002 in this example. Where the question marks appear on the left of a function block, you will enter either the data itself, a reference location where the data is found, or a variable representing the reference location where the data is found. Where question marks appear on the right of a function block, you will usually enter a reference location for data to be output by the function block or a variable that represents the reference location for data to be output by the function block. MUL INT ???????

I1

???????

I2

Q

???????

Most function blocks do not change input data; instead, they utilize input data in an operation and place the result of the operation in an output reference.

2-28

Series 90™-30/20/Micro PLC CPU Instruction Set Reference Manual – May 2002

GFK-0467M