CS 1000/CS 3000 Reference

310
Toc H-1 IM 33S01B30-01E CONTENTS CS 1000/CS 3000 Reference SEBOL 16th Edition : Dec.10,2007-00 IM 33S01B30-01E 16th Edition PART-H SEBOL H1. SEBOL Details ...................................................................................... H1-1 H1.1 Basics of SEBOL ........................................................................................... H1-2 H1.1.1 Program Units of SEBOL ................................................................ H1-3 H1.1.2 Identifiers of SEBOL ....................................................................... H1-4 H1.1.3 Rules for SEBOL Programming ...................................................... H1-5 H1.1.4 Data Types Available in SEBOL ...................................................... H1-6 H1.1.5 Constants Available in SEBOL ........................................................ H1-8 H1.1.6 Variables Available in SEBOL ....................................................... H1-10 H1.1.7 Implicit Declarations of Variables .................................................. H1-12 H1.1.8 Substitution of Character String .................................................... H1-14 H1.1.9 Include File ................................................................................... H1-16 H1.1.10 Syntax of Expressions .................................................................. H1-25 H1.2 Operators and Expressions ....................................................................... H1-29 H1.2.1 Arithmetic Operators ..................................................................... H1-31 H1.2.2 Comparison Operators ................................................................. H1-33 H1.2.3 Logical Operators ......................................................................... H1-34 H1.2.4 Bitwise Operators ......................................................................... H1-36 H1.2.5 Character-String Operands ........................................................... H1-38 H1.2.6 Operation Priority .......................................................................... H1-39 H1.2.7 Conversion of Operands ............................................................... H1-41 H1.2.8 Assignment Statement .................................................................. H1-43 H1.3 Local Variables ............................................................................................ H1-45 H1.3.1 Declaring and Referencing Simple Variables ................................ H1-46 H1.3.2 Declaring and Referencing Array .................................................. H1-48 H1.4 Functions .................................................................................................... H1-51 H1.4.1 User-Defined Functions ................................................................ H1-52 H1.4.2 Calling a Function ......................................................................... H1-54 H1.4.3 Function Arguments ...................................................................... H1-55 H1.4.4 Arguments for Function Block Data ............................................... H1-60 H1.4.5 Variables Declared Within Functions ............................................. H1-65 H1.4.6 Built-In Functions .......................................................................... H1-67 H1.4.7 Range for Variables and Expressions ........................................... H1-79

description

CS 1000/CS 3000 Reference

Transcript of CS 1000/CS 3000 Reference

Toc H-1

IM 33S01B30-01E

CONTENTS

CS 1000/CS 3000ReferenceSEBOL

16th Edition : Dec.10,2007-00

IM 33S01B30-01E 16th Edition

PART-H SEBOLH1. SEBOL Details ...................................................................................... H1-1

H1.1 Basics of SEBOL........................................................................................... H1-2

H1.1.1 Program Units of SEBOL ................................................................ H1-3

H1.1.2 Identifiers of SEBOL ....................................................................... H1-4

H1.1.3 Rules for SEBOL Programming ...................................................... H1-5

H1.1.4 Data Types Available in SEBOL ...................................................... H1-6

H1.1.5 Constants Available in SEBOL ........................................................ H1-8

H1.1.6 Variables Available in SEBOL ....................................................... H1-10

H1.1.7 Implicit Declarations of Variables .................................................. H1-12

H1.1.8 Substitution of Character String .................................................... H1-14

H1.1.9 Include File ................................................................................... H1-16

H1.1.10 Syntax of Expressions .................................................................. H1-25

H1.2 Operators and Expressions ....................................................................... H1-29

H1.2.1 Arithmetic Operators ..................................................................... H1-31

H1.2.2 Comparison Operators ................................................................. H1-33

H1.2.3 Logical Operators ......................................................................... H1-34

H1.2.4 Bitwise Operators ......................................................................... H1-36

H1.2.5 Character-String Operands ........................................................... H1-38

H1.2.6 Operation Priority .......................................................................... H1-39

H1.2.7 Conversion of Operands ............................................................... H1-41

H1.2.8 Assignment Statement .................................................................. H1-43

H1.3 Local Variables ............................................................................................ H1-45

H1.3.1 Declaring and Referencing Simple Variables ................................ H1-46

H1.3.2 Declaring and Referencing Array .................................................. H1-48

H1.4 Functions .................................................................................................... H1-51

H1.4.1 User-Defined Functions ................................................................ H1-52

H1.4.2 Calling a Function ......................................................................... H1-54

H1.4.3 Function Arguments ...................................................................... H1-55

H1.4.4 Arguments for Function Block Data ............................................... H1-60

H1.4.5 Variables Declared Within Functions ............................................. H1-65

H1.4.6 Built-In Functions .......................................................................... H1-67

H1.4.7 Range for Variables and Expressions ........................................... H1-79

IM 33S01B30-01E

Toc H-2

10th Edition : Dec.18,2003-00

H1.5 Function Block Data ................................................................................... H1-81

H1.5.1 Usage of Function Block Data ....................................................... H1-82

H1.5.2 Group Assignment Statement ....................................................... H1-93

H1.5.3 compare Statement .................................................................... H1-101

H1.5.4 drive Statement .......................................................................... H1-106

H1.5.5 Referencing Block Mode ............................................................. H1-111

H1.5.6 Modifying Block Mode ................................................................. H1-113

H1.5.7 Referencing Block Status............................................................ H1-114

H1.5.8 Checking Data Status ................................................................. H1-117

H1.5.9 Modifying Data Status ................................................................. H1-120

H1.5.10 Referencing Alarm Status ........................................................... H1-121

H1.5.11 Status Control for Process Alarm ................................................ H1-122

H1.5.12 Referencing Alarm Status Individually ......................................... H1-126

H1.5.13 Operation of Process I/O and Software I/O ................................. H1-129

H1.5.14 One-Shot Execution of a Function Block ..................................... H1-135

H1.5.15 Sequence Table (ST16) Block Operation .................................... H1-138

H1.5.16 Logic Chart Block (LC64) Operation ........................................... H1-145

H1.5.17 Timer Block (TM) Operation ........................................................ H1-151

H1.6 Process Management ............................................................................... H1-152

H1.6.1 Accessing Common Block Data .................................................. H1-153

H1.6.2 Manipulating Unit Recipes .......................................................... H1-157

H1.6.3 Reserving Recipes ..................................................................... H1-163

H1.6.4 Built-In Functions with Batch ID .................................................. H1-167

H1.7 Subsystem Communication ..................................................................... H1-175

H1.7.1 Reading Subsystem Data ........................................................... H1-177

H1.7.2 Writing Subsystem Data ............................................................. H1-179

H1.7.3 Writing to a Subsystem Data Bit Field ......................................... H1-181

H1.7.4 Communication Examples with a Subsystem.............................. H1-183

H1.8 Program Control Statements ................................................................... H1-185

H1.8.1 if ................................................................................................. H1-186

H1.8.2 for ............................................................................................... H1-188

H1.8.3 while ........................................................................................... H1-191

H1.8.4 repeat ......................................................................................... H1-193

H1.8.5 wait until ..................................................................................... H1-195

H1.8.6 switch ......................................................................................... H1-197

H1.8.7 goto ............................................................................................ H1-200

H1.8.8 delay ........................................................................................... H1-202

H1.8.9 delaycycle................................................................................... H1-203

H1.9 SEBOL Message Statements ................................................................... H1-204

H1.9.1 opeguide .................................................................................... H1-207

H1.9.2 dialogue Statement ..................................................................... H1-209

H1.9.3 message..................................................................................... H1-216

Toc H-3

IM 33S01B30-01E 10th Edition : Dec.18,2003-00

H1.9.4 history ......................................................................................... H1-218

H1.9.5 request ....................................................................................... H1-220

H1.9.6 sysalarm ..................................................................................... H1-221

H1.9.7 prcsalarm ................................................................................... H1-223

H1.9.8 unit prcsalarm ............................................................................. H1-228

H1.9.9 Character String Format ............................................................. H1-229

H1.9.10 Limitations on Message Output ................................................... H1-233

H1.10 Allocating CPU Time Using nopreempt Statements ............................... H1-236

H1.11 Managing Shared Resources Using semlock and semunlockStatement .................................................................................................. H1-243

H1.12 Signal Processing ..................................................................................... H1-248

H1.12.1 Signal Transmission Processing ................................................. H1-250

H1.12.2 Processing of Queue Signal ........................................................ H1-254

H1.12.3 Masking the Interrupt Signal ....................................................... H1-259

H1.13 Error Handling ........................................................................................... H1-260

H1.13.1 Error Handling for Statements with I/O or Communication .......... H1-261

H1.13.2 Comparison of Actions by Error Class Code when an ErrorOccurs ........................................................................................ H1-268

H1.13.3 Error Class Codes ...................................................................... H1-269

H1.13.4 Detail Error Codes ...................................................................... H1-282

H1.13.5 Values Used when an Error Occurred ......................................... H1-297

H1.14 Reserved Words in SEBOL ...................................................................... H1-300

H1.15 Application Size ........................................................................................ H1-304

Blank Page

H1-1

IM 33S01B30-01E

<H1. SEBOL Details>

H1. SEBOL DetailsSEBOL is a programming language designed for process control. Generating orediting a SEBOL program can be carried out in the SEBOL Edit window on theFunction Block Detail Builder, or SFC Builder or SEBOL User Function Builder.

This chapter explains the syntax, functions and error codes of SEBOL for writing aprogram in SEBOL.

10th Edition : Dec.18,2003-00

H1-2<H1.1 Basics of SEBOL>

IM 33S01B30-01E

H1.1 Basics of SEBOL▼ Basics of SEBOL

SEBOL is a programming language that is suitable for process control.

In this section, basic items regarding the SEBOL are explained.

■ What is SEBOL (SEquence and Batch Oriented Language)SEBOL is a programming language designed for process control. It has special features forprocess control, in addition to the functions of a generic programming language.

Programs written in SEBOL are executed as an action equivalent to one SFC step on theFCS.

■ Basics of SEBOLListed below are the basic items with regard to SEBOL:

• Program units of SEBOL

• Identifiers of SEBOL

• Description rules for SEBOL programming

• Data types available in SEBOL

• Constants available in SEBOL

• Variables available in SEBOL

• Implicit declaration of variables

• Substituting with a character string

• Include file

• syntax of expressions

10th Edition : Dec.18,2003-00

H1-3

IM 33S01B30-01E

<H1.1 Basics of SEBOL>

H1.1.1 Program Units of SEBOLSEBOL consists of two types of program units: “SEBOL programs” and “SEBOLfunctions.”

■ SEBOL ProgramsA SEBOL program is a program scripted in SEBOL. It is defined as an action equivalent toone SFC step, and is executed when an SFC block or an operation is executed.

SEE ALSO

• For the details of SFC block, see the following:

D5, “Sequential Function Chart”

• For the details of Operation, see the following:

D6.8, “Operations”

● SEBOL Functions

A SEBOL function is a subprogram that is written in SEBOL. It is also simply called a“function.” The functions can be called from a SEBOL program, and the process results canbe returned to the SEBOL program. SEBOL provides a number of built-in functions. Theuser can also define new functions as desired.

10th Edition : Dec.18,2003-00

H1-4<H1.1 Basics of SEBOL>

IM 33S01B30-01E

H1.1.2 Identifiers of SEBOLA SEBOL identifier is a character string that represents a variable or a label used inSEBOL program.

■ Description of IdentifiersThe variables or labels used in SEBOL programs need to be put identifiers. Data withoutidentifiers are not subject to processing by the system. The identifiers must follow the rulesbelow:

• Characters that can be used are: alphabetical characters (A to Z and a to z), numericalcharacters (0 to 9), underscore (_), dollar sign ($) and percent sign (%).

• The identifier must begin with a letter or a percent sign (%).

• The length of the identifier has no limitation. However, only the first eight charactersare used for identification. Therefore, two identifiers having the same first eight char-acters are treated as the same identifier.As for tag name identifiers, the first 16 characters are used for identification.

• Upper-case and lower-case letters are not distinguished.

• The SEBOL reserved identifiers cannot be used for purposes other than as reserved.

SEE ALSO

For the SEBOL reserved words, see the following:

H1.14, “Reserved Words in SEBOL”

10th Edition : Dec.18,2003-00

H1-5

IM 33S01B30-01E

<H1.1 Basics of SEBOL>

H1.1.3 Rules for SEBOL ProgrammingThis section explains the rules for statements, comments and labels in SEBOLprograms.

■ StatementA SEBOL program is composed of several statements. Usually, a statement is written inone line. If a statement cannot be completed in one line, divide the script by entering “\” or“//” to indicate that the statement is continued on the next line. However, the statement willcause a compile error if the line exceeds 511 bytes, including the “\” or “//”.

The following are the examples in multiple lines:

......

if ((A >= ichr("A") and A <= ichr("Z")) or \

(A >= ichr("a") and A <= ichr("Z"))) then

* (A$ are alphabetic letters.)

else

* (A$ are not alphabetic letters.)

else if

......

If two or more spaces are entered in an area other than the character-string constants,these spaces are counted as one byte. The “\” or “//” used for continuation of the descriptionare excluded from the 511 bytes.

■ CommentBy placing an asterisk “*”at the beginning of a line of script, the whole line will be treated asa comment text.

Inserting an exclamation mark “!” in the line, the text between “!” and the return code will betreated as a comment text. The following is an example of a comment and a line withcomment.

* Initialization of variables

n=3 ! Assign the initial value

■ LabelA label can be attached to a statement for branching purposes as shown in the examplebelow. The <statement> on the right side can be omitted. When omitted, the system under-stands that the label is attached to the subsequent statement.

<identifier> : <statement>

H010101E.EPS

10th Edition : Dec.18,2003-00

H1-6<H1.1 Basics of SEBOL>

IM 33S01B30-01E

H1.1.4 Data Types Available in SEBOLData types available in SEBOL are explained in this section.

■ Data Types and Their Value Ranges

Table Data Types Available in SEBOL and Their Value Ranges

Data type Typespecifier No. of bits Minimum value Maximum value

Character string char*n 8*n N/A N/A

Integer integer 16 -32768 32767

Double-lengthinteger long 32 -2147483648 2147483647

Single-precisionfloating point float 32 -3.402823*10^38 3.402823*10^38

Double-precisionfloating point double 64 -1.79769313486231*10^308 1.79769313486231*10^308

H010102E.EPS

In SEBOL, “integer” and “long” types are referred to as integer type, “float” and “double”types as real number type. “integer,” “long,” “float,” and “double” types are referred to asnumeric type. The “char*n” type is referred to as character-string type.

The number of valid digits for “float” type is seven, and 15 for “double” type. Maximumbytes for character-string type is 255 (“n” in “char*n” is 255 or less).

10th Edition : Dec.18,2003-00

H1-7

IM 33S01B30-01E

<H1.1 Basics of SEBOL>

The format of each data type is shown below. The mantissa parts of integer type and real-number type are two’s complements.

first byte . . . . . . nth byte

"char*n" type

"integer" type

15-bit integer

Sign bit: (1 bit) 0: positive, 1: negative

31-bit integer

"long" type

Sign bit: (1 bit) 0: positive, 1: negative

"float" type

exponent part (E)8-bit

mantissa part (M)23-bit

"double" type

exponent part (E)11-bit

mantissa part (M)52-bit

mantissa part (M) (cont.)

Sign bit (S): 1 bit,

Value computed using the formula below:

(-1) • 2 • 1.Ms E-1023

Sign bit (S): 1 bit,

Value computed using the formula below:

(-1) • 2 • 1.Ms E-127

H010103E.EPS

Figure Data Formats

10th Edition : Dec.18,2003-00

H1-8<H1.1 Basics of SEBOL>

IM 33S01B30-01E

H1.1.5 Constants Available in SEBOLInteger constants, floating-point constants, and character-string constants areavailable in SEBOL.

■ Integer ConstantsDecimal integer constants contain long-type data, and can be expressed in decimal andhexadecimal notations. A decimal integer constant is expressed in an array of numericcharacters (0 through 9). If a dollar sign ($) is placed at the beginning of the constant, itbecomes a hexadecimal integer constant. A hexadecimal integer can contain alphabeticalcharacters (A to F and a to f) in addition to numeric characters.

The following shows examples of integer constants:

Decimal integer constants: 10, 100, 123

Hexadecimal integer constants: $10, $FFFF, $ABCD

■ Floating-Point ConstantsA floating-point constant has double-type data and expressed only in decimal notation.Floating-point constant can be expressed either using a decimal point as in “10.0” or usingan exponent part, as written below:

H010104E.EPS

<mantissa part>E<exponent part> or <mantissa part>e<exponent part> <mantissa part>: Decimal number with or without decimal point. <exponent part>: Decimal number with or without a sign.

When the <mantissa part> is “x” and the <exponent part> is “y”, the value is x*10y.The following are examples of floating-point constants:

Exponent part not used: 1.0, 15.8, 0.05

Exponent part used: 1.0E5, 1.0e-5, 123E3

10th Edition : Dec.18,2003-00

H1-9

IM 33S01B30-01E

<H1.1 Basics of SEBOL>

■ Character-String ConstantsA character-string constant is a string enclosed by double quotations.

A character-string constant can include non-printing characters (carriage return and tabcharacters), backslashes and double quotations as special characters in addition to normalcharacters.

The following items show the expressions of these special characters among the charac-ter-string constants:

• Return code: \n

• Tab: \t

• Backslash: \

• Double quotation: \"

A return code in a character-string constant following a backslash is ignored. For example,character strings output by the following two “message” statements will give the sameoutput.

message "How to write\a long character-string\n"

message "How to write a long character-string\n"

H010105E.EPS

SEE ALSO

For the details of “message” statement, see the following:

H1.9.3, “message”

10th Edition : Dec.18,2003-00

H1-10<H1.1 Basics of SEBOL>

IM 33S01B30-01E

H1.1.6 Variables Available in SEBOLVariables available in SEBOL are classified by data type, usage and array element.

■ Variable Types

● By Data Type

The following shows variables classified by data type:

Variables

Character-stringvariables (char*n)

Numericvariables

Integervariables

Real-numbervariables

Integer variables (integer type)

Long integer variables (long type)

Double-precision floating-point variables (double type)

Single-precision floating-point variables (float type)

H010106E.EPS

Figure Classification of Variables by Data Type

● By Usage

The following two variable types are available depending on the usage and applicationranges:

Variables

Local variables

Function block dataH010107E.EPS

Figure Classification of Variables by Usage and Application Range

● By Array Element

Variables are further classified according to the array elements contained as shown below.However, two-dimensional arrays are not applicable if the variable type is function blockdata.

Variables

Simple variables

Arrays

One-dimensional arrays

Two-dimensional arraysH010108E.EPS

Figure Classification of Variables by Array Element

10th Edition : Dec.18,2003-00

H1-11

IM 33S01B30-01E

<H1.1 Basics of SEBOL>

■ Variable Relationship Table

Table Relationships of Data Types, Usage and Array Element of Variables

Data type Usage Array Element

Characterstring Character-string type (char*n)

Localvariable

Simple variable

ArrayOne-dimensional

Two-dimensional

Functionblock data

Simple variable

One-dimensional array

Numericvalue

Integer type

Integer (integer)

Localvariable

Simple variable

ArrayOne-dimensional

Two-dimensional

Functionblock data

Simple variable

One-dimensional array

Long integer (long)

Localvariable

Simple variable

ArrayOne-dimensional

Two-dimensional

Functionblock data

Simple variable

One-dimensional array

Real-numbertype

Single-precisionfloating point (float)

Localvariable

Simple variable

ArrayOne-dimensional

Two-dimensional

Functionblock data

Simple variable

One-dimensional array

Double-precisionfloating point(double)

Localvariable

Simple variable

ArrayOne-dimensional

Two-dimensional

Functionblock data

Simple variable

One-dimensional arrayH010109E.EPS

10th Edition : Dec.18,2003-00

H1-12<H1.1 Basics of SEBOL>

IM 33S01B30-01E

H1.1.7 Implicit Declarations of VariablesVariables must be declared before they are used. However, when the #IMPLICITinstruction is used, some variables are treated as having been automatically de-clared.

■ #IMPLICIT InstructionIn the SEBOL, all variables must be declared before they are used. A compile error willoccur if an undeclared variable is used.

However, an undeclared variable can be declared implicitly using the #IMPLICIT instruc-tion, even when variable is not declared. Using the #IMPLICIT instruction, variables notexplicitly declared can be treated as automatically declared local variables or tag names,according to the description method of the variable name.

IMPORTANT

• Implicit declaration is useful in small programs of approximately 50 lines or less, but isnot suitable for large programs.For example, erroneous entries of similar characters such as I (capital i), l (lower caseL) and 1 (one) are treated as new variables by implicit variable declaration. In suchcases, input errors cannot be detected as compile errors, thus making it difficult to finderrors in large-sized programs.

• Therefore, it is recommended not to use the #IMPLICIT declaration in large-sizedprograms.

Expression of #IMPLICIT instruction is shown below:

#IMPLICIT

H010110E.EPS

#IMPLICIT instruction can be used only in the SEBOL program described as an action inthe initial step of SFC.

10th Edition : Dec.18,2003-00

H1-13

IM 33S01B30-01E

<H1.1 Basics of SEBOL>

■ Automatic Type Determination of Variables by the First CharacterWhen a #IMPLICIT instruction is used, undeclared variables are determined as simplevariables with the data types shown below, depending on the first character of the variablename.

• I: integer

• L: long

• F: float

• C: char*16

• Other: double

However, in program syntax other than simple variables, such as specifications of arrayelements or an entire array, a compile error will be caused if the variables are not declared.

■ Automatic Tag-Name DeterminationAn undeclared variable is implicitly declared as a tag name if the variable name is followedby a period. In this case, the character string following the period is regarded as the dataitem name of the tag.

If a tag name is defined via the Function Block Detail Builder, and that tag name belongs tothe same FCS as the SFC block in which the program is written in SEBOL, the compilerchecks the following items for the declared “tag name. data item name.” When any error isfound, it gives a compile error.

• Whether the data item corresponding to the tag name exists or not.

• When the declared “tag name.data item name” is put in an assignment statement or atthe left part of the group assignment statement, whether the data item is write-enableor not.

• Whether the data item is numeric type or character-string type or not.

• Whether correct data type is assigned to the data item or not.

IMPORTANT

• When the tag names have not been defined with the Function Block Detail Builder, orwhen tag names exist in an FCS or an operation other than the one to which the SFCblock with a SEBOL program belongs, data item checking is not performed whilecompiling.

• If the tag name begins with a numeral or contains a hyphen, implicit declarationcannot be used. In this case, use “block” declaration with alias, or use a local genericname with an “assign” statement.

SEE ALSO

• For the block definition with alias, see the following:

“■ Declaration of Tag Name” in H1.5.1, “Usage of Function Block Data”

• For the local generic name and an “assign” statement, see the following:

“■ Declaring Local Generic Name and Allocating Tag Name” in H1.5.1, “Usage of Function Block Data”

10th Edition : Dec.18,2003-00

H1-14<H1.1 Basics of SEBOL>

IM 33S01B30-01E

H1.1.8 Substitution of Character StringAn identifier can be substituted with a specific character string using the #definecompiler control instruction.

■ #define StatementExpression of the #define compiler control instruction is shown below:

#define <identifier> <character string>

H010111E.EPS

If the <identifier> declared in a #define statement appears in the lines after the #definestatement, the <identifier> will be substituted with the corresponding character string.However, the <identifier> that appears in the <character string> is not subject to substitu-tion.

With the #define statement, the character string before the carriage return character isused as the <character string>. However, the spaces and comments before the carriagereturn character are excluded. A line can be continued to the next line by entering abackslash(\) or double slashes (//) at the end of the first line.

● Example of Substituting Constants

......

#define OPEN 2

block SIO-22 VALVE1,VALVE2

......

drive [VALVE1 = OPEN]

drive [VALVE2 = OPEN]

......

In the above example, the constant “2” is substituted with the character string “OPEN.” Thismakes the program easier to read.

SEE ALSO

For the details of “drive” statement, see the following:

H1.5.4, “drive Statement”

10th Edition : Dec.18,2003-00

H1-15

IM 33S01B30-01E

<H1.1 Basics of SEBOL>

● Example of Substituting Character Strings that Include a NumericExpression

......

#define MAXLEN 256

#define GOOD(MAXLEN-1) ! This is correct.

#define BAD MAXLEN-1 ! This is wrong.

integer i1,i2

......

i1 = GOOD * 5 ! Calculated as (MAXLEN-1) x 5.

i2 = BAD * 5 ! MAXLEN-1 x 5 is calculated as MAXLEN-(1 x 5).

......

When substituting a character string that contains a numeric expression, enclose thenumeric expression by parentheses. If the numeric expression is not enclosed by paren-theses as shown in the above example, the expression may not be properly calculated.

10th Edition : Dec.18,2003-00

H1-16<H1.1 Basics of SEBOL>

IM 33S01B30-01E

H1.1.9 Include FileThe line with a “#include” compiler control instruction is replaced with the entirecontents of the file declared by the #include (include file).

The following include files are provided:

• std.h

• smode.h

• sbsts.h

• salarm.h

■ #include ¡ £The expression of #include statement is shown below:

#include "<include file name>"

H010112E.EPS

The inclusion of files using #include is useful when using the same constant in multipleprograms.

For example, create a file that defines identifiers for constants using the #define state-ments, and include it in multiple SEBOL programs using the #include statement. If theconstant changes, the included file must be modified and the SEBOL programs that haveincluded the file must be recompiled.

File inclusion cannot be nested; a compile error will occur if an included file contains a#include statement. When a compile error occurs in an included file, the line number in theerror message indicates the line on which the #include statement exists in the file that hasincluded the include file.

To include the user-defined (user-created) files, the files to be included need to be put intothe following folders.

<Project Root>\<ProjectName>\SEBOL\INCLUDE

<Project Root>: c:\CS1000\ENG\BKPROJECT (*1)

<Project Root>: c:\CS3000\ENG\BKPROJECT (*2)

*1: ¡ Project root path for CS 1000 project*2: £ Project root path for CS 3000 project

If a user-defined (user-created) file has an identical file name with a system file, the systemfile will be included.

The following lists the system-fixed include files provided:

• std.h: Standard label definition

• smode.h: Reference to individual block mode

• sbsts.h: Reference to individual block status

• salarm.h: Individual alarm status reference and manipulation

10th Edition : Dec.18,2003-00

H1-17

IM 33S01B30-01E

<H1.1 Basics of SEBOL>

● std.h

std.h is a system-fixed include file that defines the default labels. It defines default values tothe labels such as OPEN, CLOSE, RUN, STOP and so on.

***** for loop *****

#define TRUE 1

#define FALSE 0

***** for valve *****

#define OPEN 2

#define CLOSE 0

***** for pump (start/stop pump) *****

#define RUN 2

#define STOP 0

***** for sequence element *****

#define ON 1

#define OFF 0

***** for judgment *****

#define OK 1

#define NG 0

***** for timer (TM operation) *****

#define TMSTOP 1

#define TMSTAT 2

#define TMCONT 3

#define TMPAUS 4

10th Edition : Dec.18,2003-00

H1-18<H1.1 Basics of SEBOL>

IM 33S01B30-01E

● smode.h

smode.h is a system-fixed include file that references block modes individually.

The smode.h defines mask patterns, in which the bits corresponding to modes of the basicblock mode are set to “1.”

***** block mode *****

#define MD_OS $80000000 ! bit1 O/S

#define MD_IMAN $08000000 ! bit5

#define MD_TRK $04000000 ! bit6

#define MD_SEMI $01000000 ! bit8

#define MD_MAN $00800000 ! bit9

#define MD_AUT $00400000 ! bit10

#define MD_CAS $00200000 ! bit11

#define MD_PRD $00100000 ! bit12

#define MD_RCAS $00080000 ! bit13

#define MD_ROUT $00040000 ! bit14

10th Edition : Dec.18,2003-00

H1-19

IM 33S01B30-01E

<H1.1 Basics of SEBOL>

● sbsts.h

sbsts.h is a system-fixed include file used to reference block statuses individually.

The smode.h defines mask patterns, in which the bits corresponding to modes of the basicblock mode are set to “1.”

***** block status *****

#define BS_PAUS $80000000 ! bit1

#define BS_ANCK $80000000

#define BS_ERR $80000000

#define BS_FAIL $40000000 ! bit2

#define BS_ABRT $20000000 ! bit3

#define BS_IDLE $10000000 ! bit4

#define BS_ABORT $10000000 ! (ABORTED)

#define BS_SIML $08000000 ! bit5

#define BS_OFF $00800000 ! bit9

#define BS_PALM $00800000

#define BS_HI $00800000

#define BS_LOCK $00400000 ! bit10

#define BS_CTUP $00400000

#define BS_LO $00400000

#define BS_NR2 $00200000 ! bit11 (NR priority 2)

#define BS_SIM $00008000 ! bit17

#define BS_STRT $00008000

#define BS_RUN $00008000

#define BS_NR1 $00004000 ! bit18 (NR priority 1)

#define BS_STOP $00004000

#define BS_IBCH $00004000

#define BS_STUP $00002000 ! bit19

#define BS_STDY $00001000 ! bit20

#define BS_HOLD $00001000

***Continued to the next page***

10th Edition : Dec.18,2003-00

H1-20<H1.1 Basics of SEBOL>

IM 33S01B30-01E

***Continued from the previous page***

#define BS_ERLY $00000800 ! bit21

#define BS_WAIT $00000800

#define BS_PBCH $00000400 ! bit22

#define BS_END $00000200 ! bit23

#define BS_NCNT $00000100 ! bit24

#define BS_RSET $00000080 ! bit25

#define BS_SDWN $00000080

#define BS_EMST $00000040 ! bit26

#define BS_ESD $00000040

#define BS_EEMS $00000020 ! bit27

#define BS_RSTR $00000010 ! bit28

SEE ALSO

For the method to reference block modes individually, see the following:

H1.5.5, “Referencing Block Mode”

10th Edition : Dec.18,2003-00

H1-21

IM 33S01B30-01E

<H1.1 Basics of SEBOL>

● salarm.h

salarm.h is a system-fixed include file used to manipulate or reference alarm statusesindividually.

***** alarm status mask pattern *****

#define AL_AFL $80000000 ! bit1

#define AL_AOF $40000000 ! bit2

#define AL_AF $20000000 ! bit3

#define AL_NR $00800000 ! bit9

#define AL_OOP $00400000 ! bit10

#define AL_SGNL $00400000

#define AL_IOP $00200000 ! bit11

#define AL_VPTN $00200000

#define AL_IOPM $00100000 ! bit12 IOP-

#define AL_DATA $00100000

#define AL_HH $00080000 ! bit13

#define AL_NPLS $00080000

#define AL_TRIP $00080000

#define AL_HALM $00080000

#define AL_ESTP $00080000

#define AL_TYPE $00080000

#define AL_LL $00040000 ! bit14

#define AL_DV2 $00040000

#define AL_OUTS $00010000 ! bit16

#define AL_HI $00008000 ! bit17

#define AL_EMST $00008000

#define AL_END $00008000

#define AL_MALM $00008000

#define AL_LO $00004000 ! bit18

#define AL_PRE $00004000

#define AL_LEAK $00002000 ! bit19

#define AL_DVP $00000800 ! bit21 DV+

#define AL_BDVP $00000800 ! BDV+

#define AL_DV1 $00000800

#define AL_PERR $00000800

#define AL_CERR $00000800

#define AL_LALM $00000800

#define AL_DVM $00000400 ! bit22 DV-

#define AL_BDVM $00000400 ! BDV-

#define AL_VELP $00000080 ! bit25 VEL+

#define AL_ANSP $00000080 ! ANS+

#define AL_HDV $00000080

#define AL_RALM $00000080

#define AL_TRP $00000080

***Continued to the next page***

10th Edition : Dec.18,2003-00

H1-22<H1.1 Basics of SEBOL>

IM 33S01B30-01E

***Continued from the previous page***

#define AL_VELM $00000040 ! bit26 VEL-

#define AL_ANSM $00000040 ! ANS-

#define AL_LDV $00000040

#define AL_BEND $00000040

#define AL_SCBL $00000040

#define AL_MHI $00000020 ! bit27

#define AL_BPRE $00000020

#define AL_INT $00000020

#define AL_MLO $00000010 ! bit28

#define AL_ERR $00000010

#define AL_CNF $00000001 ! bit32

***** alarm status change command *****

#define AOF_NR "AL09OF"

#define AON_NR "AL09ON"

#define AOF_OOP "AL10OF"

#define AON_OOP "AL10ON"

#define AOF_SGNL "AL10OF"

#define AON_SGNL "AL10ON"

#define AOF_IOP "AL11OF"

#define AON_IOP "AL11ON"

#define AOF_VPTN "AL11OF"

#define AON_VPTN "AL11ON"

#define AOF_IOPM "AL12OF" ! IOP-

#define AON_IOPM "AL12ON" ! IOP-

#define AOF_DATA "AL12OF"

#define AON_DATA "AL12ON"

#define AOF_HH "AL13OF"

#define AON_HH "AL13ON"

#define AOF_NPLS "AL13OF"

#define AON_NPLS "AL13ON"

#define AOF_TRIP "AL13OF"

#define AON_TRIP "AL13ON"

#define AOF_HALM "AL13OF"

#define AOF_HALM "AL13ON"

#define AOF_ESTP "AL13OF"

#define AON_ESTP "AL13ON"

#define AOF_TYPE "AL13OF"

#define AON_TYPE "AL13ON"

#define AOF_LL "AL14OF"

#define AON_LL "AL14ON"

#define AOF_DV2 "AL14OF"

#define AOF_DV2 "AL14ON"

#define AOF_OUTS "AL16OF"

***Continued to the next page***

10th Edition : Dec.18,2003-00

H1-23

IM 33S01B30-01E

<H1.1 Basics of SEBOL>

***Continued from the previous page***

#define AON_OUTS "AL16ON"

#define AOF_HI "AL17OF"

#define AON_HI "AL17ON"

#define AOF_EMST "AL17OF"

#define AON_EMST "AL17ON"

#define AOF_END "AL17OF"

#define AON_END "AL17ON"

#define AOF_MALM "AL17OF"

#define AON_MALM "AL17ON"

#define AOF_LO "AL18OF"

#define AON_LO "AL18ON"

#define AOF_PRE "AL18OF"

#define AON_PRE "AL18ON"

#define AOF_LEAK "AL19OF"

#define AON_LEAK "AL19ON"

#define AOF_DVP "AL21OF" ! DV+

#define AON_DVP "AL21ON" ! DV+

#define AOF_BDVP "AL21OF" ! BDV+

#define AON_BDVP "AL21ON" ! BDV+

#define AOF_DV1 "AL21OF"

#define AON_DV1 "AL21ON"

#define AOF_PERR "AL21OF"

#define AON_PERR "AL21ON"

#define AOF_CERR "AL21OF"

#define AON_CERR "AL21ON"

#define AOF_LALM "AL21OF"

#define AON_LALM "AL21ON"

#define AOF_DVM "AL22OF" ! DV-

#define AON_DVM "AL22ON" ! DV-

#define AOF_BDVM "AL22OF" ! BDV-

#define AON_BDVM "AL22ON" ! BDV-

#define AOF_VELP "AL25OF" ! VEL+

#define AON_VELP "AL25ON" ! VEL+

#define AOF_HDV "AL25OF"

#define AON_HDV "AL25ON"

#define AOF_ANSP "AL25OF" ! ANS+

#define AON_ANSP "AL25ON" ! ANS+

#define AOF_RALM "AL25OF"

#define AON_RALM "AL25ON"

#define AOF_TRP "AL25OF"

#define AON_TRP "AL25ON"

#define AOF_VELM "AL26OF" ! VEL-

#define AON_VELM "AL26ON" ! VEL-

#define AOF_LDV "AL26OF"

***Continued to the next page***

10th Edition : Dec.18,2003-00

H1-24<H1.1 Basics of SEBOL>

IM 33S01B30-01E

***Continued from the previous page***

#define AON_LDV "AL26ON"

#define AOF_BEND "AL26OF"

#define AON_BEND "AL26ON"

#define AOF_ANSM "AL26OF" ! ANS-

#define AON_ANSM "AL26ON" ! ANS-

#define AOF_SCBL "AL26OF"

#define AON_SCBL "AL26ON"

#define AOF_MHI "AL27OF"

#define AON_MHI "AL27ON"

#define AOF_BPRE "AL27OF"

#define AON_BPRE "AL27ON"

#define AOF_INT "AL27OF"

#define AON_INT "AL27ON"

#define AOF_MLO "AL28OF"

#define AON_MLO "AL28ON"

#define AOF_ERR "AL28OF"

#define AON_ERR "AL28ON"

#define AOF_CNF "AL32OF"

#define AON_CNF "AL32ON"

SEE ALSO

For the method to reference the alarm status individually, see the following:

H1.5.12, “Referencing Alarm Status Individually”

10th Edition : Dec.18,2003-00

H1-25

IM 33S01B30-01E

<H1.1 Basics of SEBOL>

H1.1.10 Syntax of ExpressionsExpressions in SEBOL are divided into the following three categories:

• Conditional expressions at the right side of substitution statement, if statement,and etc.

• Operands of a statement

• Subscripts of an array

Syntax of expressions is explained in this chapter.

■ Category 1: Conditional Expressions at Right-side of Substitution State-ment, if Statement or etc.

Expressions categorized in this group include the following:

• Expressions at the right-side of substitution statement.

• Conditional expressions for “if” statement, “repeat” - “until” statement, “wait until”statement, “switch” statement, and “wait for qsignal” statement

• Expressions indicating the initial value, final value and increment for “for” statement

In the expressions above, up to three types of type-2 built-in functions can be called up. Fora “for” statement, the total of the initial value, final value and increment can be specified upto three. A compile error occurs when this limit is exceeded.

SEE ALSO

For type-1 and type-2 built-in functions, see the following:

H1.4.7, “Range for Variables and Expressions”

10th Edition : Dec.18,2003-00

H1-26<H1.1 Basics of SEBOL>

IM 33S01B30-01E

■ Category 2: Operands of a StatementThis refers to expressions as operands of a statement.

The following example shows how to specify two expressions, FIC001.PV/1000 (divide by1000) and FIC003.PV, in a “message” statement:

integer i

block PID FIC001,FIC003

......

delay i*1000

message “weight= %d KG, temperature = %d degree\n”, FIC001.PV/1000, FIC003.PV

......

In the expression above, a type-2 built-in function cannot be used, but a type-1 built-infunction can. There is no limitation on the number of functions to be called up. The built-infunctions for returning a character string cannot be used in this expression. To make a built-in function return character-string data, the returned value must be assigned to a character-string type local variable, then specify it as a statement operand.

SEE ALSO

For type-1 and type-2 built-in functions, see the following:

H1.4.7, “Range for Variables and Expressions”

■ Category 3: Array Subscript ExpressionsIn the following example, the expressions indicating array elements are placed in the brackets[ ].

An example of array subscript expression is shown below:

integer function setpv(tag,n,data,sec)

argblock PID tag[*]

integer n,sec

double data

......

tag[n].SV = data ! n is a subscript

wait until(tag[n].PV - data <= 0.5) time sec;\

error ERR000

return 0

......

ERR000:

return -1

In the above expression, simple local variables of integer type or long type (including thefunction’s dummy argument), or integer constants can be used.

10th Edition : Dec.18,2003-00

H1-27

IM 33S01B30-01E

<H1.1 Basics of SEBOL>

■ Variables Usable for Each Expression in Each CategoryFunction block data can be used in category 1 and category 2 expressions. Up to 32function block data can be used in one statement. If a single statement contains multipleexpressions, the total number of expressions can not exceed 32.

Table Variables Usable in Each Expression Category

Function block data Local variablesConstants

Type-1 built-infunctions

Type-2 built-infunctionsSimple

variablesArray

elementsSimple

variablesArray

elements

Category 1 � � � � � � �

Category 2 � � � � � �

Category 3 � �

H010113E.EPS

SEE ALSO

For type-1 and type-2 built-in functions, see the following:

H1.4.7, “Range for Variables and Expressions”

10th Edition : Dec.18,2003-00

H1-28<H1.1 Basics of SEBOL>

IM 33S01B30-01E

■ Operands for Local Variables OnlyThe operands shown below, can be only used for local variables or dummy argumentswhose corresponding formal argument is a local argument.

Table Special Operands

Usage Applicable types Related statement Remark

Error variable (error array) I, L (*1)

Error identifier I, L, F, D, C (*1) Constants can also be used.

Control variable of "for" statement I, L, F, D for-next

Dummy argument cannot beused even if thecorresponding formalargument is a local variable.

"time" value I, L, F, Dcomparewait-untildialogue

Constants can also be used.

Input variable of "dialogue"statement I, L, F, D, C dialogue

Character-string storage variable in"format" statement

C format

Sequence-table check I, L, F, D seqtable

Action signal of sequence table andlogic chart I, L, F, D seqtable/logic chart

Signal-name storage variable C wait for qsignal

Queue signal cancels I, L, F, D qsigcancel

Queue signal move result I, L, F, D qsigmove

ssread data status storage variable I, L, F, D ssread

ssread data storage variable I, L, F, D, C ssread

sswrite variable I, L, F, D, C sswrite

H010114E.EPS

I: integerL: longF: floatD: doubleC: char*n*1: Statements that allow the individual description of error handling

SEE ALSO

For statements that allow the individual description of error handling, see the following:

H1.13.1, “Error Handling for Statements with I/O or Communication”

10th Edition : Dec.18,2003-00

H1-29

IM 33S01B30-01E

<H1.2 Operators and Expressions>

H1.2 Operators and Expressions▼ Operators and Expressions

The following section explains about the operators and expressions used in SEBOLprogram.

■ SEBOL Operator TypesThe following are the types of SEBOL operators:

Operators

Binary operators + (Addition)- (Subtraction)* (Multiplication)/ (Division)mod (Remainder)

Unary operators + (Positive)- (Negative)

Relationaloperators

< (Less than)> (Greater than)<= (Less than or equal to)>= (Greater then or equal to)

Equality operators == (Equal to)<> (Not equal to)

Binary logicaloperators

and (Logical AND)or (Logical OR)eor (Logical Exclusive OR)

Unary logical operator not (Logical NOT)

Binary bitwise logical operators

& (Bitwise logical AND)� (Bitwise logical OR)^ (Bitwise logical Exclusive OR)

Unary bitwise logical operator

– (One's complement)

Bitwise shift operators

<< (Left bit shift)>> (Right bit shift)<@ (Left cyclic left)>@ (Right cyclic shift)

H010201E.EPS

Arithmeticoperators

Comparison operators

Logical operators

Bitwise operator

Figure List of Operators

10th Edition : Dec.18,2003-00

H1-30

IM 33S01B30-01E

<H1.2 Operators and Expressions>

■ Types of SEBOL ExpressionsA SEBOL expression is a statement that satisfies one of the following conditions:

• A function, constant or variable

• A statement in which functions, constants, and variables are combined with operators.

• A statement in which expressions are combined with operators.

The following are the concrete examples of SEBOL expressions:

Expressions

<function>

<constant>

<variable>

(<expression>)

<expression><binary arithmetic operator><expression>

<unary arithmetic operator><expression>

<expression><relational operator><expression>

<expression><equality operator><expression>

<expression><binary logical operator><expression>

<unary logical operator><expression>

<expression><binary bitwise logical operator><expression>

<unary bitwise logical operator><expression>

<expression><bitwise shift operator><expression>H010202E.EPS

Figure List of Expressions

10th Edition : Dec.18,2003-00

H1-31

IM 33S01B30-01E

<H1.2 Operators and Expressions>

H1.2.1 Arithmetic OperatorsArithmetic operators include binary logical operators and unary logical operators.Arithmetic operators are used for operations on numeric data.

■ Binary Arithmetic OperatorsThe binary operators used in arithmetic operations include the following:

+ Addition

- Subtraction

* Multiplication

/ Division

mod Remainder

TIP

• In the division operation on integers, the resulting decimals are rounded down.

• In the remainder operation, if the operands are real numbers, they are converted to long integervalues and rounded off below the decimal point before the computation.

• Addition (+) and subtraction (-) binary arithmetic operators have equal priority; however, among allbinary operators, their priority is lower than the others.

• A space is required before and after the remainder operator (mod).

In the following example, binary arithmetic operators are used.

In this example, a temperature value in Fahrenheit (fahr) is converted to Celsius (celsius).

float function CELSIUS(FAHR)

float FAHR

return (5.0 / 9.0) *(FAHR - 32.0)

10th Edition : Dec.18,2003-00

H1-32

IM 33S01B30-01E

<H1.2 Operators and Expressions>

■ Unary Arithmetic OperatorsThe unary operators used in arithmetic operations are:

+ Positive

- Negative

TIP

• With (+), no change in the sign of the computed value.

• With (-), the sign of the computed value is converted to positive when it is negative, and vice versa.

In the following example, unary arithmetic operators are used.

In this example, the system returns the negative value if the variable I is positive, andreturns 0 if negative.

integer function CONV(I)

integer I

if (I > 0) then

return - I

else

return 0

end if

10th Edition : Dec.18,2003-00

H1-33

IM 33S01B30-01E

<H1.2 Operators and Expressions>

H1.2.2 Comparison OperatorsComparison operators include relational operators and equality operators. Compari-son operators are used for operations on any numeric and character-string data.

■ Relational OperatorsThe operators used in the relational operation include the following:

< Less than

> Greater than

<= Less than or equal to

>= Greater than or equal to

TIP

• The computation result of the relational operation expression is “1” when the relationship betweenboth sides of the relational operator is satisfied, or “0” when it is not satisfied.

• The computation result of the relational operation expression is an integer.

■ Equality OperatorsThe operators used in the equality operation include the following:

== Equal to

<> Not equal to

TIP

• The computation result of the relational operation expression is “1” when the relationship betweenthe both sides of the relational operator is satisfied, or “0” when it is not satisfied.

• The computation result in the relational operation expression is an integer.

• If both equality operator and relational operator are used in one expression, the relational expressionhas higher priority in evaluation.

• Care should be taken when comparing two real numbers or a real number with an integer using anequality operator.

IMPORTANT

Since real numbers have finite precision, they produce a diminutive error in most casesduring operation or conversion of data type from double to float. A false result will be ob-tained if values containing errors are compared with (==).

Thus, it is necessary to use relational operators (>=, <=, >, <) in the comparison of realnumbers. Or, set high- and low-end values to confirm that the value is within the stipulatedrange.

10th Edition : Dec.18,2003-00

H1-34

IM 33S01B30-01E

<H1.2 Operators and Expressions>

H1.2.3 Logical OperatorsLogical operators include binary logical operators and unary logical operators.Logical operators are used in operations on any numeric data.

■ Binary Logical OperatorsThe binary operators used in the logical operation include the following:

and logical AND (and)

or logical OR (or)

eor logical Exclusive OR (eor)

TIP

• The computation result of the relational operation expression is “1” when the relationship betweenthe both sides of the relational operator is satisfied, or “0” when it is not satisfied.

• The computation result of a relational operation expression is an integer.

• A space is required before and after a logical operator.

In the following example, binary logical operators are used.

In this example, whether the character-string variable (A$) is alphabetic character or not isjudged.

char*1 A$

integer A

......

A = ichr(A$)

if ((A >= ichr("A") and A <= ichr("Z")) or \

(A >= ichr("a") and A <= ichr("z"))) then

* (A$ is alphabetic character)

else

* (A$ is not alphabetic character)

else if

......

Note: “ichr” is the built-in function to convert a character string into character codes.

10th Edition : Dec.18,2003-00

H1-35

IM 33S01B30-01E

<H1.2 Operators and Expressions>

■ Unary Logical OperatorThere is one unary operator used in logical operations:

not Negation

TIP

• In the logical expression “<expression><logical operator><expression>” or “not <expression>”,logical operation is performed interpreting values other than 0 as true and 0 as false, or produces 1when the result is true and 0 when false. The computation result is an integer.

• A space is required before and after a logical operator.

10th Edition : Dec.18,2003-00

H1-36

IM 33S01B30-01E

<H1.2 Operators and Expressions>

H1.2.4 Bitwise OperatorsBitwise operators include binary bitwise logical operators, unary bitwise logicaloperators and bitwise shift operators. Bitwise operators can be used for operationson numeric data.

■ Binary Bitwise Logical OperatorsOperators used in binary bitwise logical operations include the following:

& Bitwise logical AND

| Bitwise logical OR

^ Bitwise logical Exclusive OR

TIP

• If operands of a binary bitwise logical operation are real numbers, they are converted to long integersand rounded off below the decimal point before the computation.

• Bitwise logical operations are performed by each bit for values on both sides of the operator.

■ Unary Bitwise Logical OperatorThe operator used in unary bitwise logical operations is the following:– One’s complement

■ Bitwise Shift OperatorsThe operators used in bitwise shift operations include the following:

<< Left bit shift

>> Right bit shift

<@ Left cyclic shift

>@ Right cyclic shift

The following example shows an example of the operation using a sample expression,<operand 1><shift operator><operand 2>:

• The <operand 1> shifted bitwise or cyclically as much as the amount of <operand 2>.Arithmetic shift is performed for bit-shift operation. The original most-significant-bitvalue is stored in the most significant bit when bits are shifted to the right, while 0 isalways stored as the least significant bit when bits are shifted to the left.

• If <operand 1> or <operand 2> is a real number, it is rounded off below the decimalpoint and converted to a long integer before the operation.

• If <operand 1> is an integer, bits are shifted as much as the remainder of division of<operand 2> by 16.

• If <operand 1> is a long integer or a real number, bits are shifted as much as theremainder of division of <operand 2> by 32.

10th Edition : Dec.18,2003-00

H1-37

IM 33S01B30-01E

<H1.2 Operators and Expressions>

■ Example of Bitwise OperatorsThe following is an example in which bitwise logical operators and bitwise shift operatorsare used.

In this example, N-bits are extracted from bit-position P in X.

integer function GETBITS(X,P,N)

integer X,P,N

return ((X >> (P + 1 - N))&–(– 0 << N))

10th Edition : Dec.18,2003-00

H1-38

IM 33S01B30-01E

<H1.2 Operators and Expressions>

H1.2.5 Character-String OperandsJust like numeric data, character strings can be compared using relational operatorsand equality operators.

■ Character-String OperandsCharacter strings can be compared using relational and equality operators in the samemanner as numeric data. However, character strings cannot be modified via character-string operations.

● Character-String Comparison Method

Character-string comparisons are performed based on the following rules:

• Character comparison is performed by comparing the internal codes of the character.The internal codes are compared as unsigned 8-bit codes.

• Spaces are also subject to comparison.

• Comparison is done character-by-character, starting with the first characters of thestrings on the left and right sides.

● Judgment Criteria for Character-String Comparison

The relationship between two character strings is determined based on the followingconditions:

• When character strings on both sides are identical, both sides are regarded as equal.

• If a discrepancy is found, comparison is made up to the first character of the differentcharacters, and the string that contains larger internal codes is determined to begreater than the other.

• If lengths of the compared character strings differ, the longer character string is re-garded as greater.

● Example of Character-String Comparison

The following example shows a function that returns “1” when the two character strings areequal, and “0” when they are not.

integer function COMP(ASTR,BSTR)

char*100 ASTR,BSTR

return ASTR == BSTR

10th Edition : Dec.18,2003-00

H1-39

IM 33S01B30-01E

<H1.2 Operators and Expressions>

H1.2.6 Operation PrioritySpecific priority is given to each operator and expression available in SEBOL.

■ List of Operation Priority

Table List of Operation Priority

Operation Symbol (operator) Associativity Priority

Parenthetical ( ) Left to right Highest

Lowest

Function Function Left to right

Unary operators � (not), - (negative), + (positive) Right to left

Multiplication & division *, /, mod Left to right

Addition & subtraction +, - Left to right

Shift operation <<, >>, <@, >@ Left to right

Relational operators <, <=, >, >= Left to right

Equality operators ==, <> Left to right

Logical operator & Left to right

Logical operator ^ Left to right

Logical operator � Left to right

Logical operator and Left to right

Logical operator eor Left to right

Logical operator or Left to right

H010203E.EPS

■ Cautionary Items when Relational Operators and Equality Operators AreUsed

Relational operators (<, <=, >, >=) and equality operators (==, <>) need to be used care-fully. Expressions (0<A<10) and (0<A and A<10), for instance, are taken as two completelydifferent expressions. Because the relational operator “<“ is evaluated from left to right, theexpression (0<A<10) is evaluated as ((0<A)<10), in which operation is started with (0<A)and “1” (true) or “0” (false) is returned when the relational condition is satisfied or notsatisfied, respectively. The result is then compared with “10” to produce the final value,which cannot be other than “1” (true) because the result or the first comparison can only be“1” or “0” and is smaller than “10.” Thus, the expression (0<A and A<10) should in this casebe used instead of (0<A<10).

For example, if A is “-1,” the following two expressions will be evaluated to produce differentresults, because “<“ has priority over “and”:

( (0<A) and (A<10) ) → (0 and 1) → 0

( (0<A) <10) ) → (0<10) → 1

10th Edition : Dec.18,2003-00

H1-40

IM 33S01B30-01E

<H1.2 Operators and Expressions>

■ Example of SEBOL Operations in Different Expressions Having theSame Meaning

The expressions below show pairs of operations that are expressed differently but have thesame meaning due to the priority of operators:

4*2-8/4 and (4*2)-(8/4)

X=A==D and X=(A==D)

S<“0” or S>“9” and (S<“0”) or (S>“9”) (where S is a character variable)

10th Edition : Dec.18,2003-00

H1-41

IM 33S01B30-01E

<H1.2 Operators and Expressions>

H1.2.7 Conversion of OperandsIn binary operation, if the data types of operands on both sides are different, data-type conversion is performed prior to the operation. This chapter explains data-typeconversion of operands in binary operations.

■ Conversion of Operands in +, -, * and / OperationsIf operands with different data types exist on both sides of arithmetic operators such as “+”,“-”, “*”, and “/”, the data type of the operand having capability of handling data smaller thanthe other operand is automatically converted to that of the other operand. The followingoperand conversion rules are applied for each arithmetic operators.

Note that characters in each box represent: “Operand � Operand→Result.”

Table Conversion of Operands in +, -, * and / Operations

Rightinteger type long type float type double type

Left

Integer type I � I → I L � L→ L

Long type L � L→ L

Float type (*1)

Double typeH010204E.EPS

L � L→ L

D � D→ D

D � D→ D D � D→ D

D � D→ D

D � D→ D

D � D→ D

D � D→ D

D � D→ D

D � D→ D

D � D→ D

D � D→ D

D � D→ D

I: integer typeL: long typeD: double typeNote: Calculation wherein character string data and numeric data coexist cannot be performed. Data-type conversion cannot

be performed between character string type and numeric type.*1: The float type is unconditionally converted to the double type.

TIP

• If either of the operands is the double type, the other will be converted into double type, producing adouble-type result.

• If neither operand is double type and one of the two is a long type, the other operand will be con-verted into long type, producing a long-type result.

For example, multiplication of an integer-type operand and long-type operand is repre-sented by “L � L→L.” In this case, the integer-type operand on the left will be converted tothe long type to coincide with the right-hand operand, producing a long-type result. If anoverflow occurs during the operation, the operation will be repeated after performing a typeconversion to the data type with even larger capacity.

SEE ALSO

For the values and actions during an overflow error occurrence, see the following:

H1.13.5, “Values Used when an Error Occurred”

10th Edition : Dec.18,2003-00

H1-42

IM 33S01B30-01E

<H1.2 Operators and Expressions>

■ Conversion of Operands in “mod”, Binary Bitwise Logical and BitwiseShift Operations

The “mod” operator for remainder calculation, binary bitwise logical operators and bitwiseshift operators are used for integer-type operands. The real number operands are con-verted to integers and rounded off below the decimal point before operation. If an overflowis caused in type conversion, the maximum absolute value of the same sign will be used.

The following tables show rules of operand conversions for each arithmetic operator:

● Conversion of Operands in mod, &, | and ^ Operations

Table Conversion of Operands in mod, &, | and ^ Operations

Rightinteger type long type float type double type

Left

Integer type

Long type

Float type

Double typeH010205E.EPS

I � I → I L � L→ L

L � L→ L

L � L→ L

L � L→ L

L � L→ L

L � L→ L

L � L→ L

L � L→ L

L � L→ L

L � L→ L

L � L→ L

L � L→ L

L � L→ L

L � L→ L

L � L→ L

I: integer typeL: long typeD: double type

● Conversion of Operands in <<, >>, <@ and >@ Operations

Table Conversion of Operands in <<, >>, <@ and >@ Operations

Rightinteger type long type float type double type

Left

Integer type I � L → I I � L → I

Long type L � L→ L

Float type

Double typeH010206E.EPS

L � L→ L

L � L→ L

L � L→ L L � L→ L

L � L→ L

L � L→ L

L � L→ L

L � L→ L

I � L → I

L � L→ L

L � L→ L

I � L → I

L � L→ L

I: integer typeL: long typeD: double type

● Conversion of Operands in <, >, <=, >=, == and <> Operations

Table Conversion of Operands in <, >, <=, >=, == and <> Operations

Rightinteger type long type float type double type

Left

Integer type I � I → I L � L→ I

Long type L � L→ I

Float type

Double typeH010207E.EPS

I � L→ I

D � D→ I

D � D→ I D � D→ I

D � D→ I

D � D→ I

D � D→ I

D � D→ I

D � D→ I

D � D→ I

D � D→ I

D � D→ I

D � D→ I

I: integer typeL: long typeD: double type

10th Edition : Dec.18,2003-00

H1-43

IM 33S01B30-01E

<H1.2 Operators and Expressions>

H1.2.8 Assignment StatementIn an assignment statement, the right side expression is calculated and then as-signed to the variable on the left side.

■ Syntax of Assignment StatementIn an assignment statement, the right side operand is calculated and assigned to thevariable on the left-hand side. If the right side expression is numeric, the variable must alsobe numeric; likewise, if the operand is a character string, the variable must also be acharacter string. The assignment format is shown below:

<variable> = <operand>

<variable>: The variable to which the result of <expression> is assigned. <operand>: The expression that calculates the value assigned to the <variable>.

H010208E.EPS

● Assigning a Numeric Value

When an operand with a different data type is assigned to a variable, the data type of theoperand on the right-hand side will be converted to that of the variable on the left-handside. If the types are different, overflow or loss of digits might occur.

The following table shows the combinations of right-hand and left-hand side values, inwhich overflow or loss of digits might occur:

Table Right side and Left side Value Combinations In Which Overflow or Loss of Digits MightOccur

Rightinteger type long type float type double type

Left

Integer type - A A A

Long type -(*1) A A

Float type - B - A, B

Double type - - - -H010209E.EPS

-: No problemA: Overflow might occurB: Loss of digits might occur*1: When convert an integer-type value to a long-type, the sign will be attached to the converted operand.Note: An overflow error occurs if the assigned value exceeds the range that can be handled by the integer type.Note: When assigning a real-type value to an integer-type variable, the value must be rounded off at the first digit below the

decimal point before assignment. To round down the value below the decimal point, use the “int” built-in function.

SEE ALSO

For the details of overflow errors, see the following:

H1.13.5, “Values Used when an Error Occurred”

10th Edition : Dec.18,2003-00

H1-44

IM 33S01B30-01E

<H1.2 Operators and Expressions>

● Assigning a Character String

When the designated character string is longer than the character string variable, charac-ters are assigned from the beginning of the string for the number of character-string vari-able size, and the rest of the string is truncated.

When the designated character string is shorter than the character string variable, a termi-nator will be added at the end of the assigned character string. The length of the characterstring before the terminator is regarded as the size of the assigned character string.

10th Edition : Dec.18,2003-00

H1-45

IM 33S01B30-01E

<H1.3 Local Variables>

H1.3 Local Variables▼ Local Variables

Local variables are program-specific and are accessible only in the program inwhich they have been declared. If identically named local variables are declared inmultiple SEBOL steps, they will be two different local variables in different programunits, and one variable will be specific to one program, can not be shared.

■ Usage of Local VariablesLocal variables can be accessed at a relatively higher speed than function-block data. Thusin a program that demands high performance, function-block data, especially those of otherFCS, can be stored in local variables, which can then be referenced at high speeds.

However, discrepancies may be caused between the data stored for the convenience andthe actual function-block data when scanning process in function block is executed (inother words, the function blocks are activated), requiring special attention. Also, when aprogram contains such local variables, the readability of the program is generally affectedcompared to programs that require direct access to function block data.

The local variables in an SFC block or an operation are initialized to “0” when the block orthe operation is started. The local variables in a function, however, are not initialized by thesystem and their values are thus indefinite when the function is called.

Local variables are available only during the execution of the program, and the variablesare deleted when the program is exited. The local variables in an SFC block or an opera-tion are available only when the block status is RUN or PAUS.

■ Declaring and Referencing Local VariablesLocal variables include simple variable and array, and array includes one-dimensional andtwo-dimensional arrays.

Methods of declaration and referencing vary whether the variables are simple or array. Thefollowing section explains them.

10th Edition : Dec.18,2003-00

H1-46

IM 33S01B30-01E

<H1.3 Local Variables>

H1.3.1 Declaring and Referencing Simple VariablesLocal simple variables are declared by stating data type and one or more variablenames. To refer the simple variable, the variable name as it is.

In this section, declaring and referencing simple variables are explained.

■ Declaring Simple VariablesThe following shows the format to declare simple variables:

<type specifier> <variable name> [, <variable name>...]

<type specifier> State the data type (char* type, integer type, long type, float type and double type are available as type specifiers).<variable name> Specify variable name using identifier. Multiple variables can be specified in one declaration by delimiting variable names by commas.

H010301E.EPS

The following is an example of declaration.

Integer i1, i2

float f1, f2

In the above example, two integer-type variables “i1” and “i2” and two float-type variables“f1” and “f2” are declared.

The declaration must be made as action for the start symbol when writing an SFC blockprogram.

In the type specifier for a character-string variable (char*n), enter the length of the variable(1 to 255 bytes) in place of the “n.”

When a double-byte character such as a Japanese character (kanji) is entered, the numberof bytes must be considered when declaring.

10th Edition : Dec.18,2003-00

H1-47

IM 33S01B30-01E

<H1.3 Local Variables>

■ Referencing Simple VariablesThe following shows the format when referencing simple variables:

<variable name> /

H010302E.EPS

The following are the examples of declaring and referencing local simple variable:

integer I,J,K

char*4 CHR1,CHR2

char*8 CHR3

......

K = I*J

CHR3 = cat(CHR1, CHR2)

......

TIP

“cat” is a built-in function to concatenate character strings.

10th Edition : Dec.18,2003-00

H1-48

IM 33S01B30-01E

<H1.3 Local Variables>

H1.3.2 Declaring and Referencing ArrayWhen declaring a local variable array, describe array name and the number of ele-ments following the type specifier.

Use array name and subscription expression to reference an array.

■ Declaring ArrayThe following shows the syntax to declare an array:

• One-dimensional array <type specifier> <array name> [<No. of elements>] [, ···]• Two-dimensional array <type specifier> <array name> [<No. of 1-dim. elements>, <No. of 2-dim. elements>] [, ···]

<type specifier> State the data type (char* type, integer type, long type, float type and double type are available as type specifiers).<array name> State the array name using identifier. <No. of elements> State the number of elements to specify the array size using an integer constant.

H010303E.EPS

• More than one array can be declared for each data type specifier using commasbetween pairs of array name and number of elements.

• Simple variables and arrays can be declared using the same line.

• Subscript expressions begin with 1. When a[n] is declared, elements are expresseda[1], ...a[n].

• With a two-dimensional array, the declared array is placed in memory so that the two-dimensional elements are renewed first.

The following is a sequence example of data in a two-dimensional array:

integer a[2,3]

In the above example, the array will become as follows:

a[1,1] a[1,2] a[1,3] a[2,1] a[2,2] a[2,3]

H010304E.EPS

The range of the numbers of elements in local variable arrays is shown below:

• Number of one-dimensional array elements: 1 to 32767

• Number of one-dimensional elements for two-dimensional array: 1 to 32767

• Number of two-dimensional elements for two-dimensional array: 1 to 32767

10th Edition : Dec.18,2003-00

H1-49

IM 33S01B30-01E

<H1.3 Local Variables>

■ Referencing ArrayIndividual array element or entire array can be referenced when referencing array.

An entire array can be referenced by entering the array name and an asterisk instead of thesubscript expression, or the array name only.

• One-dimensional array element <type specifier> <array name> [<subscript expression>] • Two-dimensional array element <type specifier> <array name> [<subscript expression>, <subscript expression>] • Entire array <array name> [*] or <array name>

<array name> State the name of the array to be referenced. <subscript expression> Specify the element to be referenced using an integer expression.

H010305E.EPS

Constants and local simple variables can be used in the subscript expression.

■ Example of Declaring and Referencing ArrayThe example of declaring and referencing array is shown below:

integer I,J,K,SUM,A[3,3]

char*4 STAT[10]

......

SUM = 0

for I = 1 to 3

for J = 1 to 3

SUM = SUM + A{I,J]

next@

next@

......

message "message %4s %5d",STAT[K],SUM

......

14th Edition : Dec.26,2006-00

H1-50

IM 33S01B30-01E

<H1.3 Local Variables>

■ Example in Which the Same Local Variable is Declared in MultipleSEBOL Steps

The following is an example in which a local variable of the same name “i” is declared inmultiple SEBOL steps.

!description of SFC block

#define NUMDATA 100

integer average()

integer data[NUMDATA]

integer i,ave !: Local variable of "mainprog" SFC block

......

* Value-setup at array

i = data[0]

ave = average(data,NUMDATA)

* Value of "i" does not change because "i" in SFC block is different from "i"

in the function.

......

!description of SEBOL function

integer function average(buf,n)

integer buf[],n

integer i !: Local variable of function "average"

long sum

......

sum = 0

for i = 1 to n

sum = sum + buf[i]

next@

return(sum/n)

......

end

10th Edition : Dec.18,2003-00

H1-51

IM 33S01B30-01E

<H1.4 Functions>

H1.4 Functions▼ Functions

In SEBOL, several statements can be grouped together in a subprogram, and thissubprogram is called a function. Functions can be called from SEBOL programs.

In this section, SEBOL program functions are explained.

10th Edition : Dec.18,2003-00

H1-52

IM 33S01B30-01E

<H1.4 Functions>

H1.4.1 User-Defined FunctionsA user can define functions as subprograms comprising multiple statements. Newoperations can be created using the defined functions. This section explains how todefine and call functions.

■ Syntax of User FunctionThe following shows the syntax for defining a user function:

<Type specifier> function <function name> ([<dummy argument list>])Declaration of dummy arguments Declaration of variables

Executable statement

end

<type specifier> Specify the type of values returned by the function. The specifiable types include integer type, long type, float type and double type. Functions cannot return character-string type values. <function name> Specify the identifier to be used as the name of the function. <dummy argument list> Specify the list of variables received from the function caller side.

H010401E.EPS

Using functions enables exchange of data with the caller side via arguments and returnvalues. The arguments specified by the caller side on the function call line are referred toas “actual arguments,” while the arguments declared in the definition of a function arecalled “dummy arguments.” A maximum of 32 arguments can be stated.

IMPORTANT

In SEBOL, a function can call another function. However, function calls can be nested onlyup to 6 levels. If a function call is attempted by the 6th nested function, an error occurs atrun time. The SFC block in which the error occurred will be aborted.

10th Edition : Dec.18,2003-00

H1-53

IM 33S01B30-01E

<H1.4 Functions>

Functions end with a “return” statement or an “end” statement. The “return” statement canreturn a value to the caller side.

return [<value of function>]

<value of function> Specify the value to be returned to the function caller side using an expression.

H010402E.EPS

When an expression is specified after the “return” statement, the value of the expressionwill be returned as the function's return value. The value of the expression is first convertedto the type of the function (type specified before the “function” statement), then returned tothe caller side.

IMPORTANT

If a function is ended with a “return” statement or “end” statement that does not accompanyan expression, the function returns irregular values. If a function that does not return valuesis stated on the caller side in a numerical expression or on the right-hand side of an assign-ment statement, an error occurs at run time. If a run-time error occurs, the value of the left-hand-side variable in the assignment statement will not change.

10th Edition : Dec.18,2003-00

H1-54

IM 33S01B30-01E

<H1.4 Functions>

H1.4.2 Calling a FunctionSEBOL program functions can be called from SEBOL programs.

The following explains how to call a function in SEBOL programs.

■ Syntax for Calling a FunctionWhen a SEBOL program calls a function, the name and type of the function need to bedeclared.

The following shows the syntax for calling a function from a SEBOL program.

<type specifier> <function name> () [, <function name> () ...]

<type specifier> State the data type (char* type, integer type, long type, float type and double type are available as type specifiers). <function name> State the function name to be called.

H010403E.EPS

In SEBOL programs, a function and local variable can be declared in the same line, but thescript for declaration must be put before the statement for calling the function. Functionscannot return a character-string type data. Use arguments to exchange character-stringdata.

The following shows the syntax for calling a function:

<function name> ([<actual argument list>])

<actual argument list> States a list of data used in the function.

H010404E.EPS

example below, the function named “average” returns the average value to the local vari-able named “ave” using the “return” statement.

!calling program

#define NUMDATA 100

integer average( ),data(NUMDATA),ave

......

! Value setup in the array

ave = average(data,NUMDATA)

......

!called function

integer function average(buf,n)

integer buf[*],n

integer i

long sum

sum = 0

for i = 1 to n

sum = sum + buf(i)

next@

return (sum/n)

end

10th Edition : Dec.18,2003-00

H1-55

IM 33S01B30-01E

<H1.4 Functions>

H1.4.3 Function ArgumentsThe arguments that the caller of a function specifies on the function call line arecalled actual arguments. The arguments declared in a definition of a function iscalled dummy arguments. A maximum of 32 arguments can be stated.

■ Actual ArgumentsThe arguments that the caller of a function specifies on the function call line are calledactual arguments. The following can be used as actual arguments for functions:

• Constants

• Local simple variables

• Local variable array elements

• Local variable array

• Tag names

• Generic name simple variables

• Generic name array elements

• Generic name arrays

When the value of a dummy argument is changed in a function, the value of the actualargument on the caller side is also changed. If an actual argument is a constant, however,an error will be caused during execution when the corresponding dummy argument ischanged.

The following example shows that the entire array is specified as the actual argument in afunction call:

integer al[10],a2[3,6]

char*16 str

integer example( )

integer i1,i2

......

example(al[*],i1,a2[*], i2,str) !function call

......

As shown in the above example, an asterisk “*” can be attached to the array name whenthe entire array is specified.

10th Edition : Dec.18,2003-00

H1-56

IM 33S01B30-01E

<H1.4 Functions>

■ Dummy ArgumentsDeclare the type of dummy argument and the size of array at the beginning of a function.Implicit declaration cannot be used with dummy arguments. All of the dummy argumentsmust be declared explicitly.

The declaration statements for dummy arguments are shown below:

• integer: Dummy argument local variable

• long: Dummy argument local variable

• float: Dummy argument local variable

• double: Dummy argument local variable

• char*0: Dummy argument local variable

• argblock: Dummy argument function block

The following points need to be taken care of when implementing the declaration state-ments for dummy arguments.

• To declare a dummy argument of character-string type, specify 0 as the length ofstring as in “char*0.” With this setting, the character-string type argument is regardedas a string of the same length as the actual argument.

• To declare dummy arguments as a one-dimensional array, state '*' as the number ofelements. With this setting, the one-dimensional array argument is regarded as anarray having the same size as the actual argument.

• To declare dummy arguments as a two-dimensional array, state '*' as the number ofone-dimensional elements while using the same value as the actual argument for thenumber of two-dimensional elements. In SEBOL, the elements of two-dimensionalarrays are arranged in such a way that the two-dimensional elements are updatedfirst. Therefore, subscript calculation for array elements requires the size (number) ofthe two-dimensional elements.

The following shows an example of using a character string, one-dimensional array andtwo-dimensional array as arguments:

! calling program

integer a1[10],12[3,6]

char*16 str

integer example()

integer i1,i2

......

example(a1,i1,a2,i2,str) ! function call

......

......

! called function

integer function example (b1,n1,b2,n2,s)

integer b1[*] ! declaration of one-dimensional array dummy argument

integer n1

integer b2[*,6] ! declaration of two-dimensional array dummy argument

integer n2

char*0 s ! declaration of character-string dummy argument

......

......

10th Edition : Dec.18,2003-00

H1-57

IM 33S01B30-01E

<H1.4 Functions>

■ Actual Argument/Dummy Argument Type InspectionWhen a SEBOL program calls a function, whether or not the type of the actual argumentagrees with that of the dummy argument is checked. If either of the following two conditionsis satisfied, mismatching of types is detected and a run-time error occurs:

• When the actual argument is a local variable and the dummy argument is a functionblock

• When the actual argument is a function block and the dummy argument is a localvariable

The table below shows how the actual argument and dummy argument correspond witheach other when both arguments are local variables:

Table Correspondence Between Local Variable Arguments

Actual argumentDeclared dummy argument

Simple One-dimensional array Two-dimensional array

Constant �

Simple �

Array element �

One-dimensional array � �

Two-dimensional array � �

H010405E.EPS

�: Operation is performed normally.Blank: Results in a run-time error.

As shown in the table above, no error occurs at run time if both the actual argument anddummy argument are either a one-dimensional array or a two-dimensional array. Since theelements of two-dimensional arrays are arranged in such a way that the two-dimensionalelements are updated first, they correspond to the elements of one-dimensional arrays (orone-dimensional array type) in this order.

10th Edition : Dec.18,2003-00

H1-58

IM 33S01B30-01E

<H1.4 Functions>

The following example shows what happens when the actual argument is a two-dimen-sional array and the dummy argument is a one-dimensional array:

! calling program

integer array[2,4] ! actual argument is a two-dimensional array

integer example()

......

example(array,8) ! number of elements is 8

......

! called function

integer function example (arg,n)

integer arg[*] ! dummy argument is declared as a one-dimensional array

integer n ! number of elements of the array "arg"

arg[1]=1 ! corresponds to array[1, 1]of the actual argument

arg[2]=2 ! corresponds to array[1, 2]of the actual argument

arg[3]=3 ! corresponds to array[1, 3]of the actual argument

arg[4]=4 ! corresponds to array[1, 4]of the actual argument

arg[5]=5 ! corresponds to array[2, 1]of the actual argument

arg[6]=6 ! corresponds to array[2, 2]of the actual argument

arg[7]=7 ! corresponds to array[2, 3]of the actual argument

arg[8]=8 ! corresponds to array[2, 4]of the actual argument

arg[9]=9 ! results in a run-time error because the array subscript

is out of range.

If access is attempted beyond the number of array elements, a run-time error (subscript outof range) occurs.

10th Edition : Dec.18,2003-00

H1-59

IM 33S01B30-01E

<H1.4 Functions>

The following correspondence table applies when the dummy argument is a local variableof simple-variable type. No run-time error occurs if both of the arguments are numeric typeor character-string type. The dummy argument is regarded as having the same type as theactual argument.

Table Correspondence When Dummy Argument is a Simple Variable Type Local Variable

Actualargument type

Dummy argument type

integer long float double char*0

integer � � � �

long � � � �

float � � � �

double � � � �

char*0 �

H010406E.EPS

�: Operation is performed normally.Blank: Results in a run-time error.

The following correspondence table applies when the dummy argument is a local variableof array type. Unlike the case where the dummy argument is a simple variable, the actualvariable must also be an array if the dummy argument is an array. If the types of actualargument and dummy argument do not match, executing the function call may result in arun-time error.

Table Correspondence When Dummy Argument is an Array Type Local Variable

Actualargument type

Dummy argument type

integer long float double char*0

integer �

long �

float �

double �

char*0 �

H010407E.EPS

�: Operation is performed normally.Blank: Results in a run-time error.

■ Function Type InspectionIn case the types of the function are different between the one declared on the caller sideand the other of the function in the definition, the latter is used during execution and itcauses no run time error.

10th Edition : Dec.18,2003-00

H1-60

IM 33S01B30-01E

<H1.4 Functions>

H1.4.4 Arguments for Function Block DataThis section explains the declaration of dummy arguments for function block data.

■ Declaring Function Block Data ArgumentsDummy arguments for function blocks are declared using the “argblock” statement.

argblock <block code> [:<machine ID code>] <dummy argument name>, [<dummy argument name>...]

H010408E.EPS

A dummy argument array is regarded as having the same size as the actual argumentarray. A one-dimensional array and a simple variable may be declared on the same line.Two-dimensional arrays cannot be used for function blocks. One-dimensional arrays aredeclared in the format shown below:

argblock <block code> [:<machine ID code>] <dummy argument name [*]>, [<dummy argument name [*]>...]

H010409E.EPS

The table below shows the actual arguments that can be represented by a function blockdummy argument of simple-variable type:

Table Actual Arguments Specifiable to Function Block Dummy Arguments of Simple-VariableType

Actual argument Example of declaration Description exampleof function call

Tag name block PID TAG101 func1 (TAG101)

Tag name global block PID TAG201 func1 (TAG201)

Own block - func1 (%)

Current unit - func1 (%%)

Local generic name, simple genname PID gen101 func1 (gen101)

Local generic name, array element genname PID gen201[10] func1 (gen201[3])

Global generic name global genname PID gen301 func1 (gen301)

Global generic name, array element global genname PID gen401[10] func1 (gen401[3])

Generic name, simple unit genname PID gen101 func1 (ugen101)

Generic name, array element unit genname PID gen201[10] func1 (ugen201[3])

Generic name, simple global unit genname PID gen301 func1 (ugen301)

Generic name, array element global unit genname PID gen401[10] func1 (ugen401[3])

Dummy argument function block,simple argblock PID block1 func1 (block1)

Dummy argument function block,array element argblock PID block2 func1 (block2[3])

H010410E.EPS

10th Edition : Dec.18,2003-00

H1-61

IM 33S01B30-01E

<H1.4 Functions>

The description examples of function call in the above table call the function “func1” shownbelow:

integer function func1(blk001)

argblock PID blk001

char*8 blkmode

blkmode = blk001.MODE

......

return

10th Edition : Dec.18,2003-00

H1-62

IM 33S01B30-01E

<H1.4 Functions>

The table below shows the actual arguments that can be represented by a function blockdummy argument of one-dimensional array type:

Table Actual Arguments Specifiable to Function Block Dummy Arguments of One-DimensionalArray Type

Actual argument Example of declaration Description example offunction call

Local generic name, entire array genname PID gen502[3] func1 (gen502[*])

Global generic name, entire array global genname PID ugen gen602[3] func1 (gen602[*])

Generic name, entire array unit genname PID ugen702[3] func1 (ugen702[*])

Generic name, entire array global unit genname PID ugen802[3] func1 (ugen802[*])

Dummy argument function block,entire array argblock PID block[3] func1 (block3[*])

H010411E.EPS

Note: The [*] that indicates an entire array may be omitted.

The description examples of function call in the above table call the function “func2” shownbelow:

integer function func2(blk002)

argblock PID blk002[*]

char*8 blkmode

char*8 blksts[3]

blkmode = blk002[1].MODE ! description example of dummy argument array

element

......

[blkmode = blk002[*].BSTS] ! description example of dummy argument of an

entire array

......

return

When accessing the function blocks (internal instruments) of the previous series stationssuch as CENTUM-XL or CENTUM V field stations, the type of the machine of the functionblock can be identified by adding a machine ID code right after the function block modelseparated by a (:) colon. No space is allowed at each side of the colon.

The machine ID codes are shown as follows.

Table Machine ID Codes

Machine ID Codes Machine Series

CFCS CENTUM V Series

EFCS CENTUM-XL Series, �XL Series

Omitted CENTUM CS Series, CS 1000/CS 3000 Series

H010420E.EPS

When the machine ID code is not specified (omitted), the function blocks are treated as forCENTUM CS Series or CS 1000/CS 3000 Series stations.

10th Edition : Dec.18,2003-00

H1-63

IM 33S01B30-01E

<H1.4 Functions>

Here is an example of block statement with machine ID code. In this example, the functionblock with tag name XPID001 is declared as a PID block of CENTUM-XL field station.

..........

block PID:EFCS XPID001

..........

■ Referencing Function Block DataThe function block data called by a dummy argument is referenced by the names of thedummy argument and the data item.

integer function example(simple,array,n,max)

argblock PID simple,array[*] ! declaration of function block dummy argument

integer n,max ! element number of processing target and array

size

simple.MV = 10.0

wait until(simple.PV >= 9.9)

if (n <= max) then

array[n].MV = 10.00

wait until(array.PV >= 9.9)

end if

end

Specify the block code in the “argblock” statement. The compiler checks whether or not thedata item name can be used with the block code specified in the “argblock” statement.Setting a data item name that cannot be used or stating the name of a write-protected dataitem on the left-hand side of an assignment statement may result in a compilation error.

Note that an error does not occur even when the block code specified in the “argblock”statement is different from that of the function block specified for the actual argument.

10th Edition : Dec.18,2003-00

H1-64

IM 33S01B30-01E

<H1.4 Functions>

■ assignBy specifying the function block called by a dummy augment in an “assign” statement, atag name can be assigned to the generic name specified for the actual argument.

In the following example, the tag name “TAG101” is assigned to the local generic name“gen001” declared in the “genname” statement. The tag name of the argument “tag” isassigned to the argument “gen” with the “asschk” function, then "“gen.MODE” is read tocheck whether or not the tag name specified in “tag” exists. If no error is found, “0” isreturned; if an error is found, “-1” is returned.

genname PID gen001

integer asschk()

if (asschk(gen001,"TAG101")<>0) then

exit

end if

......

! tag name "TAG001" is assigned to the local generic name "gen001"

! omitted hereafter

integer function asschk(gen.tag)

argblock PID gen ! generic name

char*0 tag ! tag name

char*8 blkmode

assign tag to gen

[blkmode = gen.MODE];error ERR900

return 0

ERR900:

message "tag name %s does not exist.",tag

return -1

If the actual argument is a local generic name (declared by “genname”), global genericname (declared by “global genname”) or generic name (declared by “unit genname” or“global unit genname”), then a tag name can be assigned to the actual argument by usingan “assign” statement that specifies the function block called by the dummy argument.

If the actual argument is a tag name (declared by “block” or “global block”), own block (%)or current unit instrument (%%), then the “assign” statement that specifies the functionblock called by the dummy argument generates an error at run time.

10th Edition : Dec.18,2003-00

H1-65

IM 33S01B30-01E

<H1.4 Functions>

H1.4.5 Variables Declared Within FunctionsIn addition to dummy arguments, functions can also handle local variables that areused only within those functions.

■ Local VariableLocal variables are declared in the same way as SFC blocks. The local variable area for afunction is obtained when a function call is executed. If the function ends with a “return”statement or “end” statement, the local variable area is discarded.

Local variables declared in functions do not have fixed initial values. However, any localvariable for an SFC block is initialized (returns to 0) when the SFC block is started.

■ Tag NameA tag name can be declared within a function. Tag names are declared in the same way asSFC blocks.

To define a tag name directly in a function may nullify the generic property of the function.Declare a tag name only when the processing target has a fixed tag name and when thegeneric property of the function is not needed.

■ Local Generic NameA local generic name can be declared within a function. Local generic names are declaredin the same way as SFC blocks. Normally when a local generic name is declared in afunction, a tag name represented by a dummy argument as a character string is assignedto the name using the “assign” statement.

! calling program

integer setmv()

setmv("FIC001",10.0,9.9)

setmv("FIC002",12.0,11.0)

setmv("FIC003",20.0,19.0)

......

! called function

integer function setmv(tagname,value1,value2)

char*0 tagname

double value1,value2

genname PID block1 ! declaration of a local generic name for the function

"setmv"

assign tagname to block1

block1.MV = value1

wait until(block.PV >= value2)

10th Edition : Dec.18,2003-00

H1-66

IM 33S01B30-01E

<H1.4 Functions>

■ Generic NameA generic name for a unit instrument can be declared within a function. Generic names aredeclared in the same way as SFC sequences using the “unit genname” statement. The“global unit genname” statement cannot be used in functions. The assignment of taggeneric name and tag name can be performed on Unit Instrument Function Block DetailBuilder.

integer function example(value1,value2)

double value1,value2

unit genname PID ugen001

ugen001.SV = value1

wait until(ugen001.PV >= value2)

end

10th Edition : Dec.18,2003-00

H1-67

IM 33S01B30-01E

<H1.4 Functions>

H1.4.6 Built-In FunctionsBuilt-in functions are functions provided in SEBOL programs.

A built-in function can be called by specifying the function name and arguments.The name of built-in functions are handled as reserved words.

■ Built-In Function TypesBuilt-in functions include arithmetic functions, which perform basic calculation, and charac-ter string functions, which perform character-string operations.

Table List of Built-In Function Types (1/2)

Built-in function General format Argument type Function type

Arithmetic functions

Absolute valuelabs(a) L L

dabs(a) D D

Max. valuelmax(a,b,c,...) L L

dmax(a,b,c,...) D D

Min. valuelmin(a,b,c,...) L L

dmin(a,b,c,...) D D

Power power(a,b) D9 D

Decimal fraction round-down int(a) D D

Bit operationBit position search bitpstn(a,b) I or L (*1), I or L L

Bit position search bitsrch(a,b) I or L (*1), I or L L

High/low limit High/low limitllimit(a,b,c) L L

dlimit(a,b,c) D D

Trigonometricfunctions

Sine sin(a) D D

Cosine cos(a) D D

Tangent tan(a) D D

Arctangent atan(a) D D

Square root Square root sqrt(a) D D

Exponentiation Exponent exp(a) D D

Natural logarithm Natural logarithm log(a) D D

Character string

Conversion to integer type ichr(a) C*n I

Conversion to string type chr(a) I C*1

String length len(a) C*n I

String concatenation cat(a) C*m, C*n C*(m+n)

Substring index index(a,b) C*m, C*n I

String extraction

left(a,b) C*n, I C*n

right(a,b) C*n, I C*n

mid(a,b) C*n, I, I C*n

Numeric and string conversion snum(a) C*n D

Built-in functions General format Argument type Function typeH010412E.EPS

I: integer simple variable or array elementL: long simple variable or array elementF: float simple variable or array elementD: double simple variable or array elementC: char simple variable or array element*1: When an array element or entire array is specified, only local variables can be used.

10th Edition : Dec.18,2003-00

H1-68

IM 33S01B30-01E

<H1.4 Functions>

Table List of Built-In Function Types (2/2)

Built-in function General format Argument type Function type

Date & time

Date getdate(a,b,c) I, I, I (*1) L

Time gettime(a,b,c) I, I, I (*1) L

Elapsed time timems( ) - L

GMT serial seconds timegmt( ) - L

Date and time conversion localtime(a,b,c,d,e,f,g) L, I, I, I, I, I, I (*2) I

Function block data Data-status check dscheck(a,b) DS, C I

Error

Error classification code of latest error errc( ) - L

Detailed error code of latest error errce( ) - L

Line of error occurrence errl( ) - L

Function name of latest error errf( ) - C*8

Step number of latest error errs( ) - L

Plane number of latest error errp( ) - L

Value check at error occurrence errorval(a) I, L, F or D

Error-identifier extraction

cerrorid( ) - C*16

lerrorid( ) - L

derrorid( ) - D

Signal Signal parameter extraction

lreadpara(a) I L

dreadpara(a) I D

creadpara(a) I C*16

Other

Present block's tag name gettagno( ) - C*16

Generic name conversion getname(a) G C*16

Start status extraction boot( ) - I

Restart judgementckstep( ) - I

ckstepcl( ) - I

Built-in functions General format Argument type Function type

H010413E.EPS

I: integer simple variables or array elementsL: long simple variables or array elementsF: float simple variables or array elementsD: double simple variables or array elementsC: char simple variables or array elementsG: Local generic name or function block of dummy argumentDS: Function block data with the name “#<data item name>,” or local variable of the “long” type.*1: For all or the arguments, only local simple variables or array elements can be used.*2: For b, c, d, e, f, and g, only local simple variables or array elements can be used.

10th Edition : Dec.18,2003-00

H1-69

IM 33S01B30-01E

<H1.4 Functions>

■ Arithmetic FunctionsDetails of arithmetic functions are listed below:

● Absolute Value (labs)

“labs(arg)” is a function that returns the argument’s absolute value. Argument type andresult type are both “long.”

● Absolute Value (dabs)

“dabs(arg)” is a function that returns the argument’s absolute value. Argument type andresult type are both “double.”

● Max. Value (Imax)

“Imax(arg1, arg2, ...)” is a function that returns the maximum value from a list of arguments.Up to 32 arguments can be used. Argument type and result type are both “long.”

● Max. Value (dmax)

“dmax(arg1, arg2, ...)” is a function that returns the maximum value from a list of argu-ments. Up to 32 arguments can be used. Argument type and result type are both “double.”

● Min. Value (lmin)

“lmin(arg1, arg2, ...)” is a function that returns the minimum value from a list of arguments.Up to 32 arguments can be used. Argument type and result type are both “long.”

● Min. Value (dmin)

“dmin(arg1, arg2, ...)” is a function that returns the minimum value from a list of arguments.Up to 32 arguments can be used. Argument type and result type are both “double.”

● Power (power)

“power(arg1, arg2)” is a function that returns the value obtained by multiplying “arg1” thenumber of “arg2” times. Argument type and result type are both “double.” If “arg1” is “0” and“arg2” is less than “0,” or “arg1” is less than “0” and “arg2” is not an integer, an error will becaused and returns “0.”

● Decimal Fraction Round-Down (int)

“int(arg)” is a function that rounds down decimal fractions. Argument type and result typeare both “double.”

10th Edition : Dec.18,2003-00

H1-70

IM 33S01B30-01E

<H1.4 Functions>

■ Bit Operation FunctionsBit operation functions include the following two functions that search for a bit position:

• bitpstn(arg1, arg2)

• bitsrch(arg1, arg2)

The operation results of these functions are the “long” type.

Bit operation functions perform the following actions:

“bitpstn” searches for the value in each bit, starting from the significant bit. “bitsrch” returns“-1” if there are two or more bits that have the value “1” in arg1. “bitsrch” stops the searchwhen the first “1” bit is found, and returns the position of that bit.

The bit position is returned when the function is terminated normally, “0” when all bits are“0,” and “-1” when an error has occurred.

If “arg1” is a simple variable, “arg2” is ignored and the number of elements is assumed tobe “1.” When “arg1” is an array or array element, “arg2” needs to be assigned with thenumber of elements. When “arg1” is an array name or entire array specified with a “*”subscript, the search will be started from the first array element as far as the number ofelements specified by “arg2.” When “arg1” is an array element, the search will be startedfrom that array element as far as the number of elements specified by “arg2.” An error iscaused if the subscript of “arg1” or “arg2” is out of the array subscript range.

Bit positions returned by these functions are shown below:

integer: simple variable

1 16

long: simple variable

1 32

integer: array

1 16 17 32 33 48 49 64 65 80 81

long: array

1 32 33 64 65

H010414E.EPS

Figure Bit Position Returns when “arg1” is a Simple Variable or an Array

10th Edition : Dec.18,2003-00

H1-71

IM 33S01B30-01E

<H1.4 Functions>

integer: array element (Element 3 is specified as bitpstn(I[3],k))

1 16 17 32 33 48

Element 1 Element 2 Element 3 Element 4 Element 5

long: array element (Element 2 is specified as bitpstn(I[2],k)

1 32 33

Element 1 Element 2 Element 3H010415E.EPS

Figure Returned Bit Positions when “arg1” Contains Array Elements

The returned bit position is under the assumption that the most significant bit of arrayelement in arg1 is “1.”

■ High and Low Limit“llimit(arg1, arg,2, arg3)” and “dlimit(arg1, arg,2, arg3)” are functions used to confine datawithin the specified high and low limits. State data for arg1, low limit for arg2, and high limitfor arg3.

When llimit(data,min,max) or dlimit(data,min,max) is stated using “data,” “min” and “max”as the arguments, the return value will be as follows:

min (when data<min)data(when min�data�max)max(when data>max)

Function return value =

H010416E.EPS

The arguments and result of “llimit” are the long type, and those of “dlimit” are the doubletype. An error is caused if arg2 is greater than arg3, and the return value will be the datavalue.

10th Edition : Dec.18,2003-00

H1-72

IM 33S01B30-01E

<H1.4 Functions>

■ Trigonometric FunctionsThe details of trigonometric functions are shown bellow:

● Sine (sin)

“sin(arg)” is a function that returns the argument’s sine. The unit of the argument is radian.Argument type and result type are both “double.” The “sin” returns “0” when the error “theabsolute value of the argument is too large to operate” occurs.

● Cosine (cos)

“cos(arg)” is a function that returns the argument’s cosine. The unit of the argument isradian. Argument type and result type are both “double.” The “cos” returns “0” when theerror “the absolute value of the argument is too large to operate” occurs.

● Tangent (tan)

“tan(arg)” is a function that returns the argument’s tangent. The unit of the argument isradian. Argument type and result type are both “double.” The “tan” returns “0” when theerror “the absolute value of the argument is too large to operate” occurs.

● Arc tangent (atan)

“atan(arg)” is a function that returns the argument’s arc tangent. The unit of the argument isradian. Argument type and result type are both “double.”

■ Square Root“sqrt(arg)” is a function that returns the argument’s square root. Argument type and resulttype are both “double.” If the argument is a negative value, an error occurs and the “sqrt”returns “0.”

■ Exponent“exp(arg)” is a function that returns the result of the exponential function (value resulted bymultiplying “e” a number of “arg” times). Argument type and result type are both “double.”

■ Natural Logarithm“log(arg)” is a function that returns the argument’s natural logarithm (“e” as the logarithmbase). The argument must be greater than “0.” Argument type and result type are both“double.”

10th Edition : Dec.18,2003-00

H1-73

IM 33S01B30-01E

<H1.4 Functions>

■ String OperationThe string operation functions include the following:

● Conversion to Integer (ichr)

“ichr(arg)” is a function that converts an string argument into an integer value, and returnsthe code corresponding to each character as the return value. The first character is usedwhen the argument contains two or more characters.

● Conversion to Character String (chr)

“chr(arg)” is a function that converts the “integer” type argument into character-string type,and returns a character corresponding to each code as the return value. If the value speci-fied as arg is not in the character code, the system returns a space.

● String Length (len)

“len(arg)” is a function that returns the length of character string. The length is indicated bythe number of characters: single-byte and double-byte characters are both counted as onecharacter. The dummy argument is of character-string type, and the result is an integertype with the length of the argument.

● String Concatenation (cat)

“cat(arg1, arg2)” is a function that concatenates character strings. The dummy arguments,arg1 and arg2, are both character-string type. The system returns the character-string data“arg2” concatenated after “arg1” as the return value.

● Substring Index (index)

“index(arg1, arg2)” is a function that returns the position of substring “arg2” in the characterstring “arg1.” The dummy arguments are both character strings. When the character string“arg2” is a substring of the character string “arg1,” the system will return an integer to showthe start position of the substring “arg2” in “arg1.” The position is indicated by the number ofcharacters counted from left to right regardless of single-byte or double-byte characters.The system will return “0” if “arg2” is not a substring of “arg1.” If “arg2” appears twice ormore in “arg1,” the system will return the start position of the first substring appearance asthe return value. If the length of “arg1” is shorter than “arg2,” the system will return “0.”

● String Extraction (left)

“left(arg1, arg2)” are the functions that extracts an arbitrary character string from the leftside of the character string. “arg1” is a character string and “arg2” is an integer. As thereturn value, the system returns a character string consisting of “arg2” characters from theleft side of “arg1.” Both single-byte and double-byte characters are counted as one charac-ter.

10th Edition : Dec.18,2003-00

H1-74

IM 33S01B30-01E

<H1.4 Functions>

● String Extraction (right)

“right (arg1, arg2)” are the functions that extracts an arbitrary character string from the rightside of the character string. “arg1” is a character string and “arg2” is an integer. As thereturn value, the system returns a character string consisting of “arg2” characters from theright side of “arg1.” Both single-byte and double-byte characters are counted as onecharacter.

● String Extraction (mid)

“mid(arg1, arg2, arg3)” is a function that extracts an arbitrary character string in the middleof the character string. “arg1” is a character string and “arg2” is an integer. As the returnvalue, the system returns a character string consisting of “arg3” characters starting from thenth character in “arg1,” where n is specified by “arg2.” Both single-byte and double-bytecharacters are counted as one character.

● Numeric and String Conversion (snum)

“snum(arg)” is a function that returns a double-type numeric value which can be describedas a character string “arg.”

10th Edition : Dec.18,2003-00

H1-75

IM 33S01B30-01E

<H1.4 Functions>

■ Date and TimeDetails of functions relating to date and time are shown bellow:

● Date (getdate)

“getdate(arg1, arg2, arg3)” is a function that sets the current date by separating it into theyear (lower two digits of the year), month and day, which are set in “arg1,” “arg2,” and“arg3,” respectively. The date is the local date and not the Greenwich standard time. As thereturn value, the function returns the serial date of the year, assuming January 1 of the yearas “0,” as a long-type value. “-1” will be returned when an error has occurred.

● Time (gettime)

“gettime(arg1, arg2, arg3)” is a function that sets the current time by separating it into thehour (24-hour basis), minute and seconds, which are set in “arg1,” “arg2,” and “arg3,”respectively. The time is the local time and not the Greenwich standard time. As the returnvalue, the function returns the elapsed time in msec, by starting the counter at 00:00 in thelocal time. “-1” will be returned when an error has occurred.

● Elapsed Time (timems)

“timems()” is a function that returns the time in msec elapsed since 00:00 in the local time.The smallest resolution is 10msec.

● GMT Serial Seconds (timegmt)

“timegmt()” is a function that returns the serial seconds in msec elapsed since 00:00.00 onJanuary 1, 1970 in the Greenwich standard time.

● Date and Time Conversion (localtime)

“localtime(time, year, month, day, hour, min, sec)” converts the serial seconds elapsedsince 00:00.00 on January 1, 1970 in the Greenwich standard time specified as “time” intoyear, month, day, hour, min, and seconds, then sets them into “year,” “month,” “day,” “hour,”“min” and “sec,” respectively. Only lower two digits are used to indicate the year. The returnvalue of normal termination will be “0.” “-1” will be returned when an error occurs or theconversion fails.

■ Function Block Data“dscheck(arg1, arg2)” is a function that checks the data status specified by the characterstring in “arg2” in the function block data specified in “arg1.” The function returns “1” if thedata status is true and “0” if it is false. Attach a # preceding a data item in arg1, such as“function block.#data item”.

SEE ALSO

For checking the data status, see the following:

H1.5.8, “Checking Data Status”

10th Edition : Dec.18,2003-00

H1-76

IM 33S01B30-01E

<H1.4 Functions>

■ Error HandlingThe details of functions relating to error handling are shown bellow:

● Latest Error Code (errc)

“errc()” is a function that returns the error code of the latest error. “0” will be returned if noerror has occurred since the startup of the SFC block.

● Latest Detailed Error Code (errce)

“errce()” is a function that returns the detailed error code of the latest error. “0” will bereturned if no error has occurred after the startup of the SFC block.

● Latest Error Occurrence Line (errl)

“errl()” is a function that returns the line number where the latest error occurred.

“0” will be returned if no error has occurred after the startup of the SFC block. A value of “-1”through “-8” (negative value of the transition condition number) will be returned if an errorhas occurred in the transition condition of the SFC block.

The function will return “0” if an error has occurred in the action described in the sequencetable of the SFC block or logic chart.

● Latest Error Function Name (errf)

“errf()” is a function that returns the function name when the latest error has occurred withinthe function. If the latest error has not occurred within the function, a character string withlength 0 will be returned. A character string with 0-length will be returned if no error hasoccurred within the function since the startup of the SFC block or the latest error occur-rence is not within the function.

If an error has occurred in the transition condition of the SFC block or in the action de-scribed in the sequence table of the SFC block or logic chart, the function returns a charac-ter string with length 0.

● Latest Error Step Number (errs)

“errs()” is a function that returns the step number of the latest error. “0” will be returned if noerror has occurred since the startup of the SFC block.

10th Edition : Dec.18,2003-00

H1-77

IM 33S01B30-01E

<H1.4 Functions>

● Latest Error Plane Number (errp)

“errp()” is a function that returns the plane number of the latest error. “0” will be returned ifno error has occurred since the startup of the SFC block.

● Value Check at Error Occurrence (errorval)

“errorval(arg)” is a function that checks whether the value of the variable specified by “arg”is the same as the value during a calculation error occurrence. “1” is returned if it is thevalue during the error occurrence, and “0” if it is not. An integer, long, float, or double-typedata can be specified as the argument, but a character-string type data is not allowed.

● Retrieval of Error Identifier Value (cerrorid, lerrorid, derrorid)

“cerrorid(),” “lerrorid(),” and “derrorid()” are the functions that return the value of erroridentifier. “cerrorid” is returned for the “char*n” type, “lerrorid” for integer type, and “derrorid”for real-number type.

10th Edition : Dec.18,2003-00

H1-78

IM 33S01B30-01E

<H1.4 Functions>

■ Signal Related“Ireadpara(arg),” “dreadpara(arg)” and “creadpara(arg)” are functions that obtain signalparameters. A parameter number is specified for “arg.” The signal name can be retrieved if“0” is specified for “creadpara(arg).”

SEE ALSO

For the signal parameters, see the following:

H1.12, “Signal Processing”

■ MiscellaneousThe following shows the details of miscellaneous built-in functions:

● Present Block Tag Name (gettagno)

“gettagno()” is a function that returns the tag name of the present SFC block. However, inan SFC block that is started from the unit (operation), the function returns the tag name ofpresent unit instrument. Specify “getname(%)” to acquire the tag name of the present SFCblock at all times, and specify “getname”(%%) to acquire the tag name of the present unitinstrument at all times.

● Generic Name Conversion (getname)

“getname(arg)” is a function that retrieves the tag name string from a dummy argument oflocal generic name or function block. The result is a character string.

● Retrieval of Start Status (boot)

“boot()” is a function that returns the start status of the system. The following values arereturned by “boot()”:

• “0”: Initial start

• “1”: Restart

● Restart Judgment (ckstep, ckstepcl)

“ckstep()” is a function that judges whether or not the SFC block is in the restart status afterpause.

“ckstepcl()” clears the status after pause.

SEE ALSO

For the restart judgment, see the following:

“■ Identification of Restart Condition” in D5.6.6, “Pausing SFC Block Execution”

10th Edition : Dec.18,2003-00

H1-79

IM 33S01B30-01E

<H1.4 Functions>

H1.4.7 Range for Variables and ExpressionsIn SEBOL, a function block data and function call can be used in expressions oroperands of a statement. However, some restrictions apply, such as “only localvariables and constants can be used for array subscript expressions.” This sectionexplains those restrictions.

■ Classification of FunctionsFunctions are classified into two types: user-made and built-in functions. Built-in functionsare categorized into type 1 and type 2.

For the type 1 built-in functions, there are no particular restrictions as to which variablescan be specified as actual arguments. Calling methods of built-in functions are the same fortype 1 and type 2, but type 2 built-in functions have restriction in coding.

The following table shows types of built-in functions:

Table Types of Built-in Functions

Function name Type Function name Type Function name Type Function name Type

labs 1 atan 1 timems 1 lreadpara 1

dabs 1 sqrt 1 errc 1 dreadpara 1

lmax 1 exp 1 errce 1 creadpara 1

lmin 1 log 1 errl 1 lcmread 2

dmax 1 ichr 1 errf 1 dcmread 2

dmin 1 chr 1 errorval 1 ccmread 2

power 1 len 1 cerrorid 1 cmwrite 2

int 1 cat 1 lerrorid 1 urload 2

bitpstn 1 index 1 derrorid 1 urassign 2

bitpstn 2 (*1) left 1 gettagno 1 timegmt 1

bitsrch 1 right 1 getname 2 localtime 2

bitsrch 2 (*1) mid 1 boot 1 llimit 1

sin 1 snum 1 dscheck 1 dlimit 1

cos 1 getdate 2 ckstep 1 errp 1

tan 1 gettime 2 ckstepcl 1 errs 1H010417E.EPS

*1: When a variable other than that of simple variable type is specified, the built-in function is categorized into type 2.

10th Edition : Dec.18,2003-00

H1-80

IM 33S01B30-01E

<H1.4 Functions>

■ Restrictions for Built-In FunctionsOne variable or constant can be written as the real argument of a built-in function. Expres-sions such as “i+1” or function calls cannot be written.

Table Variables Usable for Real Argument In Built-In Functions

Function block data Local variables

Simplevariable

Arrayelement

Entirearray

Simplevariable

Arrayelement

Entirearray

Constant

Type-1 built-in functions � � N/A � � N/A �

Type-2 built-in functions � � (*1) - (*1) � � � (*1) �

H010418E.EPS

�: Able to write - : Not able to write*1: Only the first argument of “bitpstn” and “bitsrch” can specify the entire array of local variables.

Array elements and entire array of a function block cannot be specified for the first argu-ment of “bitpstn” and “bitsrch.”

The following are the built-in functions with special real arguments which cannot be catego-rized in the above groups:

Table Special Real Arguments

Function block data Local variables

Constant

Function block

Simplevariable

Arrayelement

Entirearray

Simplevariable

Arrayelement

Entirearray

Simplevariable

Arrayelement

a, b, c of getdate(a,b,c)a, b, c of gettime(a,b,c)

- - - � � - - - -

b, c, d, e, f, g oflocaltime(a,b,c,d,e,f,g)

- - - � � - - - -

a of bitpstn(a,b) (*1)a of bitsrch(a,b) (*1)

(*2) - - (*2) � � (*2) - -

a of dscheck(a,b) �(*3) �(*3) - �(*4) �(*4) - - - -

a of getname(a) - - - - - - - �(*5) �(*5)H010419E.EPS

�: Able to write - : Not able to write*1: In the case that the first argument is an array element or entire array, and the built-in function is type 2.

For type 1, it shall be categorized according to the table above, “Constants Usable for Real Argument of Built-inFunctions.”

*2: Built-in function type 1*3: Data items only with # such as <function block>.#<data item> can be specified.*4: Only long-type variables can be specified.*5: Function blocks declared in “block” statement, “genname” statement, “unit genname” statement or “argblock”

statement can be specified. If alias is specified in a “block” statement, <alias> is specified for real argument.

“getname” returns <tag name> which corresponds to the <alias>. If % is specified,“getname” will return the tag name of the present block.

10th Edition : Dec.18,2003-00

H1-81

IM 33S01B30-01E

<H1.5 Function Block Data>

H1.5 Function Block Data▼ Function Block Data

In SEBOL, function block data can be accessed by designating the tag name anddata item name.

■ Format of Function Block DataIn SEBOL, function block data which is declared using one of the following methods can beaccessed:

• Tag name declaration

• Local generic name declaration

• Generic name declaration

■ Grouped Manipulation of Function Block DataIn SEBOL, function block data can be read or written in a batch operation using the meth-ods indicated below:

• Group assignment statement

• “compare” statement

• “drive” statement

■ Mode, Status, and Alarm Operations of Function BlocksIn SEBOL, the operations shown below can be performed for mode, status and alarm offunction blocks:

• Referencing block mode

• Modifying block mode

• Referencing block status

• Checking data status

• Modifying data status

• Referencing alarm status

• Status control of process alarm

• Referencing alarm status individually

■ Other OperationsIn SEBOL, the operations shown below can be performed for function blocks:

• Process I/O and soft I/O operations

• Function block one-shot execution

• Sequence table (ST16) block operation

• Logic chart block operation

• Timer block operation

10th Edition : Dec.18,2003-00

H1-82

IM 33S01B30-01E

<H1.5 Function Block Data>

H1.5.1 Usage of Function Block DataIn SEBOL, function block data can be used in an expression or on the left-hand sideof an assignment statement, in the same way as local variables.

■ How to Access Function Block DataTo access function block data, designate the data using the format: [tag name.data itemname].

Data in an SFC block can be accessed by designating [%.data item name] instead of [tagname.data item name]. Also, data in a unit instrument can be accessed by designating[%%.data item name], instead of the above expression.

Depending on the declaration, function block data can be designated instead of a tagname. Function block declaration statements are shown below:

Table Declarations for Function Blocks

Declared item Statement SFC block (*1) Function (*1) One-dimensionalarray (*2)

Tag name "block" statement � �

Tag name "global block" statement �

Local generic name "genname" statement � � �

Global generic name "global" statement � �

Generic name "unit genname" statement � � �

Generic name "global unit genname" statement � �

Dummy argument "argblock" statement � �

H010501E.EPS

*1: Position where declaration is described*2: Position where declared name is described�: Description possibleBlank: Description not possible

SEE ALSO

• For “global block” statement and “global genname” statement, see the following:

“■ Function Block Declaration” in D5.2.1, “Step Common Items”

• For dummy arguments, see the following:

H1.4.4, “Arguments for Function Block Data”

Simple variables, one-dimensional arrays and two-dimensional arrays can be designatedas function block data items.

Function block data that can be described in an expression or on the left-hand side of anassignment statement are as follows:

Table Syntax that can be Used in an Expression or on the Left-Hand Side of an AssignmentStatement

Function block Data item Example

Simple variable Simple variable FIC001.PV

Array element Simple variable GEN01[1].PV

Simple variable Array element FIC001.ITEM[1]

Array element Array element GEN01[1].ITEM[2,1]

H010502E.EPS

10th Edition : Dec.18,2003-00

H1-83

IM 33S01B30-01E

<H1.5 Function Block Data>

■ Example of Accessing the Function Block DataThe following shows examples of accessing function block data:

● Assigning the PV Value of a Function Block with the Tag Name FIC001 tothe Local Variable pv_value

block PID FIC001

double pv_value

......

pv_value = FIC001.PV

......

● Waiting Until the PV Value for the Tag Name TAG001 Reaches 50.0 orHigher

block PID TAG001

......

wait until (TAG001.PV >= 50.0)

......

● Writing a Value 100.0 as the SV of Function Block with Tag Name PID001

block PID PID001

......

PID001.SV = 100.0

......

● Putting the Block Mode of an SFC Block to Local Variable s1

When % is used instead of a tag name, the variable that follows the [.] (period) is treated asan SFC block data item.

char*8 s1

......

s1 = %.MODE

......

10th Edition : Dec.18,2003-00

H1-84

IM 33S01B30-01E

<H1.5 Function Block Data>

■ Declaration of Tag NameA tag name is declared using a “block” statement.

block <block code> [:<machine ID code>] <tag name> <alias> alias <tag name> [, <tag name> ...] <alias> alias<tag name>

<block code> Designates a function block code.<machine ID code> Designates the station ID code when accessing the old series stations’ function blocks.

<tag name> Designates a function block tag name. Up to 16 characters can be used for the tag name.

<alias> Designate the alias of the tag name.

H010503E.EPS

When accessing the function blocks (internal instruments) of the previous series stationssuch as CENTUM-XL or CENTUM V field stations, the type of the machine of the functionblock can be identified by adding a machine ID code right after the function block modelseparated by a (:) colon. No space is allowed at each side of the colon.

The machine ID codes are shown as follows.

Table Machine ID Codes

Machine ID Codes Machine Series

CFCS CENTUM V Series

EFCS CENTUM-XL Series, �XL Series

Omitted CENTUM CS Series, CS 1000/CS 3000 Series

H010555E.EPS

When the machine ID code is not specified (omitted), the function blocks are treated as forCENTUM CS Series or CS 1000/CS 3000 Series stations.

Here is an example of block statement with machine ID code. In this example, the functionblock with tag name XPID001 is declared as a PID block of CENTUM-XL field station.

..........

block PID:EFCS XPID001

..........

When a [-] (hyphen) is included in the tag name, or if there is a numeral at the beginning ofthe tag name, it is necessary to use an alias to assign a different name.

10th Edition : Dec.18,2003-00

H1-85

IM 33S01B30-01E

<H1.5 Function Block Data>

● Example of Converting Tag Name [PID-001] to Alias [PID_001]

block PID PID_001 alias PID-001

......

PID_001.SV = 100.0 !Use the alias in the program.

......

During compilation, the following checks are performed with respect to the data item name:

• Whether a data item exists in the function block

• Whether it is possible to write to the data item with an assignment statement or groupassignment statement

• Whether calculations appropriate to the data type of the data item are being per-formedFor example, it is checked if data in the character-string format is being designated forthe operand of the arithmetic operator, or if numeric data is being assigned to thecharacter-string variable

If an error is detected, a compile error will occur.

During compilation, it is not checked whether the tag names declared in “block” statementshave been defined using the Function Block Detail Builder. If a tag name that has not beendefined using the Function Block Detail Builder is used, a run-time error occurs.

10th Edition : Dec.18,2003-00

H1-86

IM 33S01B30-01E

<H1.5 Function Block Data>

■ Declaring Local Generic Name and Allocating Tag NameA local generic name is used to dynamically change the tag name of the processing target.The local generic name is declared with a “genname” statement, then a tag name is as-signed to the local generic name with an “assign” statement.

● Declaring a Local Generic Name

Declare a local generic name using a “genname” statement. Simple variables or one-dimensional arrays can be used as the local generic name. The first eight characters arevalid in a local generic name.

The formats to declare a local generic name are shown below:

• Simple variables genname <block code> [:<machine ID code>] <generic name> [,<generic name>...]

• One-dimensional arrays genname <block code> [:<machine ID code>] <generic name> [<number of elements>] [, <generic name> [<number of elements>] ...]

<block code> Designate the function block code.

<machine ID code> Designates the station ID code when accessing the old series stations’ function blocks.

<local generic name> Designate the generic name of the function block with an identifier.

<element number> Designate the same value as the unit instrument for the number of elements in the array. The maximum number of elements is 128.

H010504E.EPS

When accessing the function blocks (internal instruments) of the previous series stationssuch as CENTUM-XL or CENTUM V field stations, the type of the machine of the functionblock can be identified by adding a machine ID code right after the function block modelseparated by a (:) colon. No space is allowed at each side of the colon.

The machine ID codes are shown as follows.

Table Machine ID Codes

Machine ID Codes Machine Series

CFCS CENTUM V Series

EFCS CENTUM-XL Series, �XL Series

Omitted CENTUM CS Series, CS 1000/CS 3000 Series

H010556E.EPS

When the machine ID code is not specified (omitted), the function blocks are treated as forCENTUM CS Series or CS 1000/CS 3000 Series stations.

10th Edition : Dec.18,2003-00

H1-87

IM 33S01B30-01E

<H1.5 Function Block Data>

Here is an example of block statement with machine ID code. In this example, the functionblock is declared as a PID block with a generic name of CENTUM-XL field station.

..........

genname PID:EFCS GPIDC01

..........

The array element number begins at 1. If the array is declared as g[10], that array willcontain elements g[1] to g[10].

The “genname” declaration is effective only in the step in which the declaration exists.

If an error is detected, a compile error will occur.

During compilation, the following checks are performed with respect to the data item name:

• Whether a data item exists in the function block

• Whether it is possible to write to the data item with an assignment statement or groupassignment statement

• Whether calculations appropriate to the data type of the data item are being per-formedFor example, it is checked if data in the character-string format is being designated forthe operand of the arithmetic operator, or if numeric data is being assigned to thecharacter-string variable

If a mistake is detected, a compile error will occur.

10th Edition : Dec.18,2003-00

H1-88

IM 33S01B30-01E

<H1.5 Function Block Data>

● Tag Name Assignment

A tag name is assigned to a local generic name using an “assign” statement. The first eightcharacters are valid in a local variable name or other identifiers such as names defined by“#define,” but the first 16 characters are valid in a tag name. However, the first eight charac-ters of the tag name must be different from other local variables and other identifiers.

The format of an “assign” statement is shown below:

assign <tag name> to <local generic name>

<tag name> Designate the tag name to be allocated to the local generic name with a character-string variable or character-string constant. If the character string exceeds 16 bytes, the first 16 bytes are used. A [-] (hyphen) can be included in tcharacter string. Also, numerals can be used at the beginning of tag names. Designate a tag name using upper-case letters.

<local generic name> Designate a simple variable or array element of the local generic name.

H010505E.EPS

In an “assign” statement, it is not checked if a designated tag name exists. If a functionblock data is designated using a local generic name assigned with a tag name that doesnot exist, a run-time error will occur.

An error does not occur even if the block code designated with the “genname” declarationdiffers from that of the tag name actually allocated.

● Assigning a Tag Name to a Local Generic Name

An example of assigning tag name PIC001 to the local generic name tag001 is shownbelow:

genname PID tag001

......

assign "PIC001" to tag001

tag001.sv = 100.0 !Set 100.0 to PIC001.SV

......

10th Edition : Dec.18,2003-00

H1-89

IM 33S01B30-01E

<H1.5 Function Block Data>

■ Declaration of Generic Name and Allocation of Tag NameGeneric name is a variable name used to replace tag name in the program. A generic nameis used when dynamically changing the tag name of the processing target. After declaringthe generic name with a “unit genname” statement, the tag name is allocated to the genericname using an “assign” statement. Normally, a correspondence table between the genericname and tag name is defined by using a unit instrument. The generic name of the unitinstrument can be used in an operation.

● Declaring a Generic Name

The generic name is declared with a “unit genname” statement. Simple variables and one-dimensional arrays can be used as the generic name.

The format of generic name declaration is shown below:

• When declaring a generic name locally within a step unit genname <block code> [:<machine ID code>] <generic name> [,<generic name>...]

• When declaring a generic name globally within an operation global unit genname <block code> [:<machine ID code>] <generic name> [,<generic name>...]

H010506E.EPS

When accessing the function blocks (internal instruments) of the previous series stationssuch as CENTUM-XL or CENTUM V field stations, the type of the machine of the functionblock can be identified by adding a machine ID code right after the function block modelseparated by a (:) colon. No space is allowed at each side of the colon.

The machine ID codes are shown as follows.

Table Machine ID Codes

Machine ID Codes Machine Series

CFCS CENTUM V Series

EFCS CENTUM-XL Series, �XL Series

Omitted CENTUM CS Series, CS 1000/CS 3000 Series

H010557E.EPS

When the machine ID code is not specified (omitted), the function blocks are treated as forCENTUM CS Series or CS 1000/CS 3000 Series stations.

Here is an example of block statement with machine ID code. In this example, the functionblock is declared as a PID block with a generic name of CENTUM-XL field station.

..........

genname PID:EFCS UGPID01

..........

10th Edition : Dec.18,2003-00

H1-90

IM 33S01B30-01E

<H1.5 Function Block Data>

A “unit genname” declaration is valid only within the step in which the declaration has beendescribed.

If the generic name declared in an operation has not been defined with a unit instrument, arun-time error will occur.

If the dimension of the generic name declared in an operation differs from that of thegeneric name defined via the unit instrument, a run-time error will occur. For example, if ageneric name is declared as a one-dimensional array in an operation while it is defined as asimple variable in the unit instrument, and if that generic name is used to designate afunction block data, a run-time error will occur.

During compilation, the following checks are performed with respect to the data item name:

• Whether a data item exists in the function block

• Whether it is possible to write to the data item with an assignment statement or groupassignment statement

• Whether calculations appropriate to the data type of the data item are being per-formedFor example, it is checked if data in the character-string format is being designated forthe operand of the arithmetic operator, or if numeric data is being assigned to thecharacter-string variable.

If a mistake is detected, a compile error will occur.

10th Edition : Dec.18,2003-00

H1-91

IM 33S01B30-01E

<H1.5 Function Block Data>

● Assigning a Tag Name

Assigning a tag name to a local generic name using “assign” statement. The first eightcharacters are valid in a local variable name or other identifiers such as names defined by“#define,” but the first 16 characters are valid in a tag name. However, the first eight charac-ters of the tag name must be different from other local variables and other identifiers.

The format of an “assign” statement is shown below:

assign <tag name> to <generic name>

<tag name> Designate the tag name to be assigned to the local generic name with a character-string variable or character-string constant. If the character string exceeds 16 bytes, the first 16 bytes will be used. A [-] (hyphen) can be included in the character string. Also, numerals can be used at the beginning of tag names. Tag name is in upper-case letters.

<generic name> Designate a simple variable or array element of the generic name.

H010507E.EPS

In “assign” statement, it is not checked if a designated tag name exists. If a function blockdata is designated using a local generic name assigned with a tag name that does notexist, a run-time error will occur.

An error does not occur even if the block code designated with the “unit genname” declara-tion differs from that of the tag name actually allocated.

The changed tag name by means of “assign” statement is effective in an operation ex-ecuted via the unit instrument.

After the tag name is changed with “assign” statement, even if the unit instrument is re-started, the tag name assigned by the “assign” statement still corresponds to the genericname. It does not correspond to the tag generic name defined via the unit instrument.

● Assigning a Tag Name to a Generic Name

An example of assigning ugen001 as the generic name and PID001 as the tag name isgiven below:

In this case, “ugen001” for tag generic name and “PID301” for tag name must be pre-defined on the Generic name definition window of the function block detail definition builderfor the unit instrument.

unit genname PID ugen001

double d1

d1 = ugen001.PV !PID301.PV value is read to d1

assign "PID001" to ugen001

ugen001.sv = 100.0 !100.0 is set to PID001.SV

In this example, by executing the “assign” statement, the tag name corresponding to thegeneric name ugen001 changes from PID301, which was defined during the tag genericname definition of the unit instrument, to PID001, which is assigned by the “assign” state-ment.

10th Edition : Dec.18,2003-00

H1-92

IM 33S01B30-01E

<H1.5 Function Block Data>

● Designation of a Sequence Table Using a Generic Name

In SFC sequences used in operations, the sequence table or the logic chart which de-scribes actions can be designated with a generic name.

The actions of sequence table steps and sequence table one-shot execution steps aredescribed using a sequence table. The actions of logic chart steps and logic chart one-shotsteps are described using a logic chart. In a single-started SFC block, the tag name of thesequence table block or the logic chart block is designated in the relevant SFC sequencestep.

Table Designating a Sequence Table/Logic Chart

Designation methodTag name Generic name

(simple variable)Generic name(array element)Block type

Operation SEQ0301 UGEN001 UGEN002[3]

SFC block start alone SEQ0301 Not allowed Not allowed

H010508E.EPS

• When designating a generic-name array element, declare it as a “global unitgenname” in the initial step.

• When designating a simple variable, it is not necessary to declare the generic nameas a “global unit genname.”

• When designating a generic name array element, designate only one integer-typeconstant as the subscript. Variables or “2+1” type expressions cannot be designated.

10th Edition : Dec.18,2003-00

H1-93

IM 33S01B30-01E

<H1.5 Function Block Data>

H1.5.2 Group Assignment StatementData designated as a list of variables or constants on the right-hand side are set in the listof variables on the left-hand side.

■ Usage of Group Assignment Statement

[<variable list>=<variable or constant list>] [<error array> [*] ] [; error <label> [, <error identifier>] ] errorsub

<variables list> This is a list of assigned variables. A maximum of 32 variables can be designated. For arrays, each array element is counted as one.

<variable or constants list> Designate a list of constants or variables of the type corresponding to the assigned variables.

<error array> Designate an integer-type local variable array for storing error codes when an error is generated while reading a variable on the right-hand side or writing to a variable on the left-hand side. When errors occur both on the left and right sides, the error code for the error occurring on the right-hand side is stored in the error array. Omit the error array if it is not necessary to check errors in individual data. When there is only one data to be assigned, a local simple variable or array element can be designated in the error array. If an <error array> is described, a 0 during normal operation and the error code when an error occurs, is set in the related array element so that it is possible to specify which function block data was being accessed at the time the error occurred.

<label> Designate the branching destination at the time an error occurs.

<error identifier> Designate a local variable or a constant to identify where the error was generated in the error handling section. If an <error identifier> is described, the location where the error occurred can be identified in the error handling section. In the error handling section, an <error identifier> value can be obtained using a built-in function.

H010509E.EPS

When assigning data in a group to data in multiple function blocks, the data is set in theorder in which the variable list is designated. However, the only instance where the order ofdata setting can be guaranteed is for function block data in the same FCS.

SEE ALSO

For details of error handling, see the following:

H1.13, “Error Handling”

10th Edition : Dec.18,2003-00

H1-94

IM 33S01B30-01E

<H1.5 Function Block Data>

● List of Variables that can be Designated on Both Sides of a GroupAssignment Statement

Designate constants, local variables or a list of function block data variables on the left- andright-hand sides of a group assignment statement.

Table Variables that Can be Designated in a Variable List

Constant, local variable, function block dataAssignment statement

Left

No

Right

Constant Yes

Variable in a local variable Yes Yes

Local variable array element Yes Yes

Local variable array Yes Yes

Tag name+Data item name Yes Yes

Simple variable in a local generic name+Data item name Yes Yes

Local generic name array element+Data item name Yes Yes

Local generic name array+Data item name Yes Yes

Simple variable in a function-block dummy argument+Data item name Yes Yes

Function-block dummy argument array element+Data item name Yes Yes

Function-block dummy argument array+Data item name Yes Yes

H010510E.EPS

● How to Describe a Function Block Array

In a group assignment statement, the function block array can be described in the expres-sion or on the left-hand side of the statement. However, it cannot be described in theformat, [function block array.data item array element].

In a group assignment statement, a maximum of 32 data can be manipulated in one state-ment. When an array is designated, the number of data becomes the number of elementsin the array.

Table Syntax of a Function Block Array

Function block Data item Example of description

Entire array Simple variable GEN01[*].PV

Entire array Array element Cannot be usedH010511E.EPS

10th Edition : Dec.18,2003-00

H1-95

IM 33S01B30-01E

<H1.5 Function Block Data>

● Usage of Function Block Data in a Variable List

Each of the variables or constants in a variable list are delimited with a [,] (comma) whendescribed. When simultaneously accessing multiple data items in a function block, themultiple data item names are delimited with a [.] (period) and designated.

<tag name>. <data item name> [.<data item name>...]

<local generic name>. <data item name> [.<data item name>...]

<function-block dummy argument>. <data item name> [.<data item name>...]

<local generic name array element>. <data item name> [.<data item name>...]

<function-block dummy argument array element>. <data item name> [.<data item name>...]

• SFC block data %.<data item name> [.<data item name>...]

• Unit instrument data %%.<data item name> [.<data item name>...]

• Array <local generic name array> [*]. <data item name> [.<data item name>...]

<function-block dummy argument array>[*]. <data item name> [.<data item name>...]

In an array, the following descriptions with [*] omitted are possible.

<local generic name array>. <data item name> [.<data item name>...]

<function-block dummy argument array>. <data item name> [.<data item name>...]

H010512E.EPS

Note: Enter in “<tag name>” a tag name that is declared in the “block” or “global block” statement.Note: Where a local variable can be used, a dummy argument local variable can also be used.Note: Where a local generic name can be used, a generic name or dummy argument function block can also be used.

10th Edition : Dec.18,2003-00

H1-96

IM 33S01B30-01E

<H1.5 Function Block Data>

● Checking the Number of Data on the Left- and Right-Hand Sides of aGroup Assignment Statement

The following checks are performed during compilation when the number of data on theleft- and right-hand sides of a group assignment statement differ, and a dummy argumentarray for the function is not included in the variable.

Table Checks on the Number of Data on the Left- and Right-Hand Sides of a Group AssignmentStatement

Variables designatedon the left-hand side

Variables designatedon the right-hand side Check details

Local variable only Function block data only Error caused if there are more data on the right-handside than the left-hand side.

Function block data only Local variable only Error caused if there are more data on the left-hand sidethan the right-hand side.

Function block data only Function block data only Data on the left-hand side compared with data on theright-hand side that have less number of data.Local variable only Local variable only

Both function block data and local variable oneither side or both sides. Error caused if numbers of data different on both sides.

H010513E.EPS

A compiler error occurs when the dummy argument array for the function is not included inthe variable. When a dummy argument array is included, no error is detected during compi-lation but a run-time error occurs. When a run-time error occurs, the values of the elementsin the left hand side variable and the error array do not change and remain as they werebefore the group assign statement was executed.

When the number of elements in the error array is greater than the number of data to beprocessed, 0 or an error code is set in the array element of the number of data that appearsat the start of the error array. If there is no corresponding data, the values of that error arrayelements do not change.

An error occurs if the number of elements in the error array is smaller than the number ofdata to be processed.

10th Edition : Dec.18,2003-00

H1-97

IM 33S01B30-01E

<H1.5 Function Block Data>

■ Describing a Group Assignment StatementAn example of describing a group assignment statement is given below.

● Accessing Data in the Same FCS

Suppose that tag names TAG0100A, TAG0100B exist as function blocks respectively.

In the example given below, because TAG0100A and TAG0100B exist in the same FCS,data setting in the order, TAG0100A.MODE, TAG0100A.SV, TAG0100B.MODE,TAG0100B.SV is guaranteed.

block PID TAG0100A,TAG0100B !FCS1

......

[TAG0100A.MODE.SV,TAG0100B.MODE.SV = "AUT",10.0, \

"AUT",10.0]

......

● Accessing Data in Another FCS

Suppose that tag names TAG0100A, TAG0100B and tag names TAG0200A, TAG0200Bexist as function blocks respectively in FCS1 and FCS2.

In the example given below, setting of data from left to right in each FCS respectively, isguaranteed as follows: for data in FCS1, TAG0100A.MODE, TAG0100A.SV,TAG0100B.MODE, TAG0100B.SV; for data in FCS2, TAG0200A.MODE, TAG0200A.SV,TAG0200B.MODE, TAG0200B.SV.

block PID TAG0100A,TAG0100B !FCS1

block PID TAG0200A,TAG0200B !FCS2

......

[TAG0100A.MODE.SV,TAG0100B.MODE.SV,TAG0200A.MODE.SV, \

TAG0200B.MODE.SV="AUT",5.0,"AUT",5.0,"AUT",5.0,\

"AUT",5.0,"AUT",5.0]

......

However, the order with respect to FCS1 data and FCS2 data is undefined. For example,whether TAG0100A.MODE or TAG0200A.MODE is set first cannot be determined.

IMPORTANT

The variable on the left-hand side of a group assignment statement cannot be used on theright-hand side or as the array subscript in the same statement. This is because it is con-fusing whether the value before or after the assignment to be used.

10th Edition : Dec.18,2003-00

H1-98

IM 33S01B30-01E

<H1.5 Function Block Data>

● Accessing a Local Generic Name

In the program given below, it cannot be confirmed whether GEN001[3] or GEN001[5] inthe local generic name array will be accessed.

......

integer i

genname PID GEN001[10],GNAM001

......

! incorrect program

i=3

[i,GEN001[i].MODE,GNAM001.SV = 5,"AUT",100.0]

......

To confirm whether GEN001[3] or GEN001[5] in the local generic name array is accessed,place the substitute for the variable used in the subscript outside and describe as follows:

......

integer i

genname PID GEN001[10],GNAM001

......

! correct program

i=5

[GEN001[i].MODE,GNAM001.SV = "AUT",100.0]

......

10th Edition : Dec.18,2003-00

H1-99

IM 33S01B30-01E

<H1.5 Function Block Data>

● When the Set Value Becomes Undefined

In the following program, whether 5 or 10 is set in TAG001.SV is undefined:

......

integer i

block PID TAG001

......

! incorrect program

i=5

[i,TAG001.SV = 10,i]

......

To set 10 in TAG001.SV, describe as follows.

......

integer i

block PID TAG001

......

! correct program

i=5

[i,TAG001.SV = 10,10]

......

● Reading the Block Mode and PV Value of the Function Block

In the example given below, block modes are read into local variables s1 and s2, and thePV values are read into local variables d1 and d2.

block PID TAG001,TAG002

char*16 s1,s2

double d1,d2

......

[s1,d1,s2,d2 = TAG001.MODE.PV,TAG002.MODE.PV]

......

10th Edition : Dec.18,2003-00

H1-100

IM 33S01B30-01E

<H1.5 Function Block Data>

● Designating Multiple Data Item Names for an Array

When designating multiple data item names for an array, the designation order is arrayelement, then data item name.

genname PID TAG[3]

......

assign "TAG001" to TAG[1]

assign "TAG002" to TAG[2]

assign "TAG003" to TAG[3]

......

[TAG[*].MODE.SV = "AUT","AUT","AUT",10.0,10.0,10.0]

......

Data item names are stored in TAG[*].MODE.SV in the order, TAG[1].MODE,TAG[2].MODE, TAG[3].MODE, TAG[1].SV, TAG[2].SV, TAG[3].SV .

10th Edition : Dec.18,2003-00

H1-101

IM 33S01B30-01E

<H1.5 Function Block Data>

H1.5.3 compare StatementThe “compare” statement compares a variable or constant on the left-hand side witha variable or constant on the right-hand side. When a comparison of all elementsmeets the conditions, the “compare” statement is terminated normally and the nextstatement is executed.

■ Usage of “compare” Statement

compare [<variable or constants list> <comparison symbol> <variable or constants list>] [<error array>[*]] [; time<time> [, error <label> [,<error identifier>] ] ] errorsub error <label> [,<error identifier>] errorsub

<variable or constant list> Specify a list of variables/constants for comparison. Up to 32 variables or constants can be designate on either side of the comparison symbol. For arrays, each element is counted as one.

<comparison symbol> Specify the type of comparison using a relational operator (>, <, >=, <=) or an equality operator (==, <>).

<error array> Designate an integer-type local variable array for storing error codes when the comparison condition is unsatisfied or when an error is generated in obtaining a variable value. When an error occurs on both the left and right hand sides, the error code for the error occurring on the right-hand side is set in the error array. Omit the error array if it is not necessary to check errors for individual data. When comparison conditions are unsatisfied or when an error is generated in obtaining a variable value, the error code is set in the element corresponding to the location where the error occurred. If the conditions are satisfied, 0 is set. When there is only one data to be compared, a simple variable or array element in the local variable can be designated in the error array.

<time> Specify a period of time for comparison in seconds using an integer constant or local variable. If not specified, comparison continues until the condition is satisfied. Specify 0 if comparison is to be made just once. When <time> is specified, a condition-satisfaction error occurs if the conditions are not satisfied within the specified time.

<label> Specify the branching destination when an error is caused.

<error identifier> Specify a local variable or constant for the identification of the location where an error is caused. If an <error identifier> is described, the location where the error occurred can be identified in the error handling section. In the error handling section, an <error identifier> value can be obtained using a built-in function.

H010514E.EPS

10th Edition : Dec.18,2003-00

H1-102

IM 33S01B30-01E

<H1.5 Function Block Data>

When the types of corresponding data on the left- and right-hand side differ, the type will beconverted. Format conversion rules are the same as those for relational operators orequality operators.

SEE ALSO

For format conversion, see the following:

H1.2.7, “Conversion of Operands”

When comparing function block data with a local variable or constant, consolidate thefunction block data on either side. This shortens the processing time.

If an “outside the range of array subscript” error or a function block data communicationerror occurs on either the left- or right-hand side, the “compare” statement is terminatedwith a run-time error. Also, if numeric data and string data are compared, the “compare”statement is terminated with a run-time error.

SEE ALSO

For details of error handling, see the following:

H1.13, “Error Handling”

If analog data or real number data are to be compared using the “compare” statement, use>=, <=, > and <. Real number data are values with limited accuracy. If the data type isconverted from “double” to “float” or calculation is executed, minute discrepancies occur inmost cases. If comparisons are made for values containing discrepancies using ==, resultswill not match.

Uncertain comparisons (such as PV�50, approximately 50) cannot be executed with“compare” statements. Also, take note that there are instances where the results will notmatch when real number data of a function block (float or double type) is compared with areal-type constant using == (equal to).

● Constant List that can be Designated on Either Side of a “compare” State-ment

Constants, local variables or variable lists for function block data can be designated on theleft- and right-hand sides of a “compare” statement.

Table Variables that can be Designated as a Variable List

Constants, local variables, function block data“compare” statement

Left Right

Constant Yes Yes

Variable in a local variable Yes Yes

Local variable array element Yes Yes

Local variable array Yes Yes

Tag name+Data item name Yes Yes

Simple variable in a local generic name +Data item name Yes Yes

Local generic name array element+Data item name Yes Yes

Local generic name array+Data item name Yes Yes

Simple variable in a function-block dummy argument+Data item name Yes Yes

Function-block dummy argument array element+Data item name Yes Yes

Function-block dummy argument array+Data item name Yes Yes

H010515E.EPS

10th Edition : Dec.18,2003-00

H1-103

IM 33S01B30-01E

<H1.5 Function Block Data>

● How to Describe a Function Block Array

In “compare” statement, the function block array can be described in the expression or onthe left-hand side of the “compare” statement. However, it cannot be described in theformat, [function block array.data item array element].

In “compare” statement, a maximum of 32 data can be manipulated in one statement.When an array is designated, the number of data becomes the number of elements in thearray.

Table Syntax of a Function Block Array

Function block Data item Example of description

Entire array Simple variable GEN01[*].PV

Entire array Array element Cannot be used

H010516E.EPS

● Format of Function Block Data in a Variable List

Each of the variables or constants in a variable list are delimited with a [,] (comma). Whensimultaneously accessing multiple data items in a function block, the multiple data itemnames are delimited with a [.] (period) and designated.

<tag name>. <data item name> [.<data item name>...]

<local generic name>. <data item name> [.<data item name>...]

<function-block dummy argument>. <data item name> [.<data item name>...]

<local generic name array element>. <data item name> [.<data item name>...]

<function-block dummy argument array element>. <data item name> [.<data item name>...]

• SFC block data %.<data item name> [.<data item name>...]

• Unit instrument data %%.<data item name> [.<data item name>...]

• Array <local generic name array> [*]. <data item name> [.<data item name>...]

<function-block dummy argument array>[*]. <data item name> [.<data item name>...]

In an array, the following descriptions with [*] omitted are possible.

<local generic name array>. <data item name> [.<data item name>...]

<function-block dummy argument array>. <data item name> [.<data item name>...]

H010517E.EPS

Note: Enter in “<tag name>” a tag name that is declared in the “block” or “global block” statement.Note: Where a local variable can be used, a dummy argument local variable can also be used.Note: Where a local generic name can be used, a generic name or dummy argument function block can also be used.

10th Edition : Dec.18,2003-00

H1-104

IM 33S01B30-01E

<H1.5 Function Block Data>

● Checking the Number of Data on the Left- and Right-Hand Sides of a“compare” Statement

The following checks are performed during compilation when the number of data on theleft- and right-hand sides of a “compare” statement differ, and a dummy argument array forthe function is not included in the variable.

Table Checks on the Number of Data on the Left- and Right-Hand Sides of a “compare”Statement

Variables designatedon the left-hand side

Variables designatedon the right-hand side Check details

Local variable only Function block data only Error caused if there are more data on the right-handside than the left-hand side.

Function block data only Local variable only Error caused if there are more data on the left-hand sidethan the right-hand side.

Function block data only Function block data only Data on the left-hand side compared with data on theright-hand side that have less number of data.Local variable only Local variable only

Both function block data and local variable oneither side or both sides. Error caused if numbers of data different on both sides.

H010518E.EPS

A compiler error occurs when the dummy argument array for the function is not included inthe variable. When a dummy argument array is included, no error is detected during compi-lation but a run-time error occurs. When a run-time error occurs, the values of the elementsin the left hand side variable and the error array do not change and remain as they werebefore the compare statement was executed.

When the number of elements in the error array is greater than the number of data to beprocessed, 0 or an error code is set in the array element of the number of data that appearsat the start of the error array. If there is no corresponding data, the values of that error arrayelements do not change.

An error occurs if the number of elements in the error array is smaller than the number ofdata to be processed.

● Comparing with Function Block Data in Another FCS

When function block data existing in the same FCS as the SFC block describing a “com-pare” statement, is described on both the right- and left-hand sides, the function block dataof both sides will be acquired with the same timing. However, when comparing with functionblock data in another FCS, the timing for the acquisition of left-hand side data and right-hand side data cannot be guaranteed since the data is acquired via communication. Evenwhen comparisons are made among function block data existing in the same FCS that isseparate from the one the SFC block belongs, it cannot be guaranteed that data will beacquired using the same timing.

Take note that when the object of comparison is function block data in another FCS, com-parisons may not be performed every second due to the communication speed. It is par-ticularly important to be aware of this when designating data at multiple FCS’s. This doesnot mean, however, that comparisons are not performed: even if the designated time isexceeded, comparison will be performed at least once.

10th Edition : Dec.18,2003-00

H1-105

IM 33S01B30-01E

<H1.5 Function Block Data>

■ Example of “compare” Statement UsageAn example of describing a “compare” statement is shown below:

block PID TAG001,TAG002

......

[TAG001.SV,TAG002.SV = 10.0,10.0] !Group assignment statement

compare[TAG001.PV,TAG002.PV >= 9.7,9.7]

......

In this example, 10.0 is set to the SV values of two function blocks with a group assignmentstatement. The “compare” statement will continue comparisons until the PV values of thetwo function blocks reach 9.7 or above.

10th Edition : Dec.18,2003-00

H1-106

IM 33S01B30-01E

<H1.5 Function Block Data>

H1.5.4 drive StatementThe “drive” statement executes the output operation with respect to the motorcontrol block or switch instrument block and waits until the function block com-pletes an answer back check.

■ Format of “drive” Statement

drive [<function block list>=<local variable/constant list>] [<error array>[*] [; error <label> [,<error identifier>] ] errorsub

<function-block list> Designate the function block that is the target of the operation. A maximumof 16 function blocks can be manipulated. For arrays, each array element is counted as one. In a “drive” statement, since the data item name that is the target of the operation is fixed, the data item name is not described.

<local variable/constant list> Specify an output value (0, 1 or 2) using local variables or constants.

<error array> Designates an integer-type local variable array for storing the error codes when an error occurs. When the operation terminates normally, 0 is set. If there is only one output data, a simple variable or array element in a local variable can be used. If an <error array> is described, a 0 during normal operation and the error code when an error occurs, is set in the related array element so that it is possible to specify which function block data was being accessed at the time the error occurred.

<label> Designate the branching destination at the time an error occurs.

<error identifier> Designate a local variable or a constant to identify where the error was generated in the error handling section. If an <error identifier> is described, the location where the error occurred can be identified in the error handling section. In the error handling section, an <error identifier> value can be obtained using a built-in function.

H010519E.EPS

10th Edition : Dec.18,2003-00

H1-107

IM 33S01B30-01E

<H1.5 Function Block Data>

Constants, local variables, or function block data variable can be designated on the left andright hand sides of a drive statement.

Table Data that can be Designated as a Variable

Constant, local variable, function block datadrive statement

Left Right

Constant Yes

Variable in a local variable Yes

Local variable array element Yes

Local variable array Yes

No

No

No

No

Tag name Yes

Simple variable in a local generic name Yes

Local generic name array element Yes

Local generic name array Yes

Simple variable in a function-block dummy argument Yes

Function-block dummy argument array element Yes

Function-block dummy argument array Yes

No

No

No

No

No

No

No

H010520E.EPS

Designate a function block such as the output destination switch instrument on the left-hand side, and the output value on the right-hand side.

10th Edition : Dec.18,2003-00

H1-108

IM 33S01B30-01E

<H1.5 Function Block Data>

■ Actions of the “drive” Statement▼ “drive” Statement Action Type

Details of the actions caused by “drive” statement are shown below:

● Checking on the Block Code

The block code of the function block is checked. If a block code other than listed below isdesignated, an error occurs.

• Switch instrument block (*1)SO-1, SO-2, SIO-11, SIO-12, SIO-21, SIO-22, SIO-12P, SIO-22PSO-1E, SO-2E, SIO-11E, SIO-12E, SIO-21E, SIO-22E, SIO-12PE, SIO-22PE

• Motor control blockMC-2, MC-3, MC-2E, MC-3E

*1: “Drive” statement cannot be applicable to SI-1, SI-2, SI-1E, SI-2E switch instrument block.

● Checking Block Mode

This checks to see if output and operation with respect to the function block are possible,according to the block mode and action type. There are three action types as shown below:

Table Action Type of the “drive” Statement

Actiontype

Block mode of subject instrument

IMAN TRK MAN AUT CAS ROUT (*3)

Type 1 � � �

Type 2 � (*1) � � �

Type 3 � (*2) � � �

H010521E.EPS

�: Output allowedBlank: Output not allowed (treated as an error)*1: Operation is carried out after changing the block mode to AUT, which is not returned to MAN.*2: Operation is carried out with the block mode remained at MAN.*3: MAN (ROUT) is handled the same as MAN, AUT (ROUT) as AUT, and CAS (ROUT) as CAS.

If the program mode does not allow output, an error occurs.

● Setting as Manipulated Output Value (MV)

The value on the right-hand side is set as the manipulated output value (MV). If the value isnot 0, 1 or 2, an error occurs.

When 1 is set as the manipulated output value (MV), the answer back check for the motorcontrol block (MC-2, MC-3) or switch instrument block does not work. When 1 is set as themanipulated output value, the “drive” statement terminates.

11th Edition : Oct.28,2004-00

H1-109

IM 33S01B30-01E

<H1.5 Function Block Data>

● Delay

If all the function blocks that have performed output operation are in the same FCS as theSFC block, processing timing will be delayed by one cycle. If a function block of anotherFCS is included, processing timing will be delayed by two cycles. This is to provide anaction timing to the function block and wait for the answer back check to begin.

● Waiting for Completion of the Answer Back Check

Checks to see if the answer back check for the function block is completed. This check isexecuted once during each cycle until the answer back check for all of the function blocksthat have performed output operation are completed.

Even within the answer back check masking time, the check is completed normally when anormal answer back is obtained.

● Checking for the Block Mode and MV Value

The block mode at the time of output operation and at the completion of answer back checkare compared, and an error occurs if they are different. Also, the value set in the manipu-lated output value (MV) is compared to the manipulated output value (MV) at the comple-tion of answer back check, and an error occurs if the values differ.

● Checking on the Alarm Status

Checks the alarm status. If the alarm status is ANS+, ANS- or PERR, an error occurs.

SEE ALSO

For details of error handling, see the following:

H1.13, “Error Handling”

A compile error occurs if the left- or right-hand side of a “drive” statement is not a dummyargument array and if the number of data on the right-hand side is smaller than the left-hand side. If either side is a dummy argument array and if the number of data on the right-hand side is less than the left-hand side, an error is not detected during compilation, andresults in a run-time error.

If an error occurs during the check on the number of data, output is not performed. Thevalue of the error variable remains as it was prior to the execution of the drive statement.

When the number of elements in the error array is greater than the number of data to beprocessed, 0 or an error code is set in the array element of the number of data that appearsat the start of the error array. If there is no corresponding data, the values of that error arrayelements do not change.

An error occurs if the number of elements in the error array is smaller than the number ofdata to be processed.

10th Edition : Dec.18,2003-00

H1-110

IM 33S01B30-01E

<H1.5 Function Block Data>

■ Example of “drive” Statement UsageIn the following example, 0 is set in the manipulated output value (MV) of the switch instru-ment block with the tag names VALVE01 and VALVE02 to close the valve.

#define CLOSE 0

block SIO-22 VALVE01 VALVE02

......

drive[VALVE01,VALVE02 = CLOSE,CLOSE];errorsub ERR000

......

exit

ERR000:

message "VALVE close error line = %d errcode = %d-%x",errl(),errc(),errce()

ereturn

......

When an error occurs, the line number and error code will be output as a message.

10th Edition : Dec.18,2003-00

H1-111

IM 33S01B30-01E

<H1.5 Function Block Data>

H1.5.5 Referencing Block ModeThe block mode of the function block can be referenced using data item MODE,OMOD or CMOD. Also, a reference as to which basic block modes are in effect canbe made using @MODE.

■ Data Items that can be Used in a Block Mode Reference

Table Data Items that can be Used in a Block Mode Reference

Data item Name Type

MODE Block mode char*8

OMOD Block mode (lowest priority) char*4

CMOD Block mode (highest priority) char*4

H010522E.EPS

● Character Strings Stored in Data Item Block Mode (MODE)

When multiple basic block modes are in effect, the character string representing the basicblock modes in the order of lowest priority to highest priority is stored in the data item blockmode (MODE). If the lowest priority block mode does not use four bytes, the rest of thebytes are filled with spaces. The highest priority block mode begins from the fifth byte. If thehighest priority block mode does not use four bytes, the rest of the bytes are not filled withspaces and the number of bytes for the character string becomes smaller.

If there is only one basic block mode in effect, the MODE is a character string of four bytesor less, representing that block mode.

● Character Strings Stored in the OMOD Data Item

Among the basic block modes that are in effect, the character string of the basic blockmode with the lowest priority is stored. If there is only one basic block mode in effect,OMOD becomes the character string for that block mode. If the block mode character stringis less than four bytes, the number of bytes for the character string becomes smaller.Spaces are not used to fill out the rest of the bytes.

● Character Strings Stored in the CMOD Data Item

Among the basic block modes that are in effect, the character string of the basic blockmode with the highest priority is stored. If there is only one basic block mode in effect,CMOD becomes a character string with length 0. If the block mode character string is lessthan four bytes, the number of bytes for the character string becomes smaller. Spaces arenot used to fill out the rest of the bytes.

An example of a block mode reference is shown below:

Table Example of Block Mode Reference

Block modeCharacter string

MODE OMOD CMOD

AUT "AUT" "AUT" ""

TRK (AUT) "AUT TRK" "AUT" "TRK"

IMAN (AUT(RCAS)) "RCASIMAN" "RCAS" "IMAN"

H010523E.EPS

10th Edition : Dec.18,2003-00

H1-112

IM 33S01B30-01E

<H1.5 Function Block Data>

■ Referencing Block Mode Using @MODETo reference which basic block mode among others is in effect, use @MODE. @MODE is a32-bit (long-type) data, each bit of which corresponds to a basic block mode. For the bitvalue, 1 means the basic block mode is in effect, and 0 means it is not in effect.

In the system-fixed include file “smode.h,” the correlation between the basic block modeand bit number is defined as a mask pattern using the “#define” instruction, as indicatedbelow:

Table Basic Block Mode Labels and Values

Bit position Basic block Mode Value smode.h label

1 O/S $80000000 MD_OS

5 IMAN $08000000 MD_IMAN

6 TRK $04000000 MD_TRK

8 SEMI $01000000 MD_SEMI

9 MAN $00800000 MD_MAN

10 AUT $00400000 MD_AUT

11 CAS $00200000 MD_CAS

12 PRD $00100000 MD_PRD

13 RCAS $00080000 MD_RCAS

14 ROUT $00040000 MD_ROUTH010524E.EPS

For example, if the mode for tag name FIC001 is IMAN (AUT (RCAS) ), the data item modeis “RCASIMAN,” OMOD is “RCAS,” and CMOD is “IMAN”. However, even if a reference ismade to data item MODE, OMOD, and CMOD, it is necessary to inquire about each bit in@MODE since it cannot be judged whether or not automatic (AUT) is in effect.

An example of referencing a basic block mode using @MODE is given below:

#include "smode.h"

block PID FIC001

if ((FIC001.@MODE & MD_AUT)0) then ! processing when the basic block mode

! AUT is in effect

......

end if

......

When the FIC001 block mode is IMAN(AUT(RCAS)), bit 5, bit 10 and bit 13 of @MODEbecome 1, so @MODE becomes $08480000. If the block mode is AUT, bit 10 becomes 1,so MD_AUT becomes $00400000. If a calculation is made with the logical product operator“&” for each bit, TAG001.@MODE&MD_AUT becomes $00400000 (a non-0 value).

Because the logical product operator “&” has a lower priority than other operators, it isnecessary to enclose the expression in ( ) in the conditional expression as shown below:

((FIC001.@MODE & MD_AUT) 0)

10th Edition : Dec.18,2003-00

H1-113

IM 33S01B30-01E

<H1.5 Function Block Data>

H1.5.6 Modifying Block ModeThe block mode of the function block can be modified by setting a block modecharacter string in the data item block mode (MODE).

■ Modifying the Block Mode with a Block Mode Character StringBlock mode character strings that can be set when modifying a block mode are shown asfollows:

• “O/S”Sets O/S mode and resets all other modes.

• “MAN”Sets MAN mode and resets modes other than O/S, IMAN and TRK.

• “AUT”Sets AUT mode and resets modes other than O/S, IMAN and TRK.

• “SEMI”Sets SEMI mode and resets modes other than O/S, IMAN and TRK.

• “CAS”Sets CAS mode and resets modes other than O/S, IMAN and TRK.

• “PRD”Sets PRD mode and resets modes other than O/S, IMAN and TRK.

• “PCAS”Sets PCAS mode.

• “ROUT”Sets ROUT mode.

In SEBOL, the initialization manual (IMAN) mode or the tracking mode (TRK) cannot beset.

SEE ALSO

Depending on the block mode prior to the modification, there are cases where the block mode cannot bemodified.

For the details, see the following:

C6.1, “Block Mode”

■ Modifying Block ModeAn example of modifying the TAG001 mode to automatic (AUT), and TAG002, TAG003modes to manual (MAN) using an assignment statement and group assignment statement,is given below:

block PID TAG001,TAG002,TAG003

......

TAG001.MODE = "AUT" ! assignment statement

......

[TAG002.MODE,TAG003.MODE = "MAN","MAN"] ! group assignment statement

......

10th Edition : Dec.18,2003-00

H1-114

IM 33S01B30-01E

<H1.5 Function Block Data>

H1.5.7 Referencing Block StatusBlock status can be referenced using the data item BSTS or @BSTS.

■ Referencing Block Status Using BSTSThe data item block status (BSTS) is a character string data consisting of 8 bytes or less.When multiple basic block statuses are in effect at the same time, the BSTS becomes thecharacter string of the basic block status with the highest priority.

As with an SFC block or unit instrument, in a function block where all basic block statuseshave the same priority, multiple block statuses will not be in effect at the same time. Whenhandling a block like this, it is recommended to reference the block status using the dataitem BSTS and create a program that treats block status as a character string.

An example of referencing the status of a function block in which all basic block statuseshave the same priority using data item BSTS, is shown below:

block SF001 SFC0301

if (SFC0301.BSTS<>"RUN") then ! processing when block status is not RUN

......

end if

......

switch (SFC0301.BSTS)

case"RUN": ! processing when the block status is RUN

......

case"PAUS" ! processing when the block status is PAUS

......

case"STOP" ! processing when the block status is STOP

......

case"ABRT" ! processing when the block status is ABRT

......

end switch

......

■ Referencing Block Status Using @BSTS@BSTS is a 32-bit (long-type) data. Each bit in @BSTS corresponds to a basic blockmode. For the bit value, 1 means the basic block mode is in effect, and 0 means it is not ineffect. The mask pattern corresponding to the bit number is defined with “#define” in thesystem-fixed include file “sbsts.h”.

When multiple basic block statuses are in effect at the same time, whether the basic blockstatus with lower priority is in effect cannot be determined using the data item BSTS.Because of this, as with the timer block, it is necessary to use @BSTS to reference theblock status of the function block in which basic block status has the priority, and then writea program describing the block status as a 32-bit data.

10th Edition : Dec.18,2003-00

H1-115

IM 33S01B30-01E

<H1.5 Function Block Data>

■ Example of Referencing Block Status Using @BSTSAn example when the basic block status has the priority is described below. There are threelevels of priority in the block status of a Timer Block (TM) as indicated below:

Table Block Status of a Timer Block (TM)

Priority Basic block status Meaning Bit position

3 (high) PAUS Paused 1

2

PALM Prealarm 9

CTUP Timeout 10

NR Normal 11

1 (low)RUN Running 17

STOP Stopped 18

H010525E.EPS

When there is a pause in a TM block that is counting normally, the block status becomesPAUS (NR (RUN) ). In this condition, PAUS has the highest priority so data item BSTSbecomes “PAUS”. Thus, with data item block status (BSTS), whether or not the basic blockstatuses RUN, NR, etc. are in effect cannot be detected.

● Mask Pattern for Basic Block Status

To check the block status using @BSTS, the system-fixed include file “sbsts.h” is used. Inthis file, the mask pattern for basic block status is defined using “#define” with the patternnames given below:

BS_ <Basic block status>

H010526E.EPS

Note: Block status NR has the following two labels:• BS_NR1 is used when NR is allocated to priority level 1, such as a switch instrument block.• BS_NR2 is used when NR is allocated to priority level 2, such as a TM block.

Note: The label for block status ABORTED is BS_ABORT. However, there will be no problem if BS_ABORTED (as inUNT001.@ALRM & BS_ABORTED) is described in the program. Since BS_ABORTED contains 10 characters, thelast 2 characters, “ED” are disregarded.

The mask patterns for the block statuses of a TM block in sbsts.h are shown below:

......

#define BS_PAUS $80000000 ! bit1

#define BS_PALM $00800000 ! bit9

#define BS_CTUP $00400000 ! bit10

#define BS_NR2 $00200000 ! bit11 (NR priority 2)

#define BS_RUN $00008000 ! bit17

#define BS_STOP $00004000 ! bit18

......

When the program status is PAUS (NR (RUN) ), bit 1, bit 11 and bit 17 become 1, then the@BSTS becomes $80208000.

10th Edition : Dec.18,2003-00

H1-116

IM 33S01B30-01E

<H1.5 Function Block Data>

● Example of Referencing the Block Status of a Timer Block (TM)

The following is an example of using @BSTS and the include file “sbsts.h” to check on theblock status of a TM block:

#include "sbsts.h"

block TM TM0305

......

if ((TM0305.@BSTS & BS_RUN) == 0) then

! processing when RUN is in effect

......

end if

......

if ((TM0305.@BSTS & BS_CTUP) == 0) then

! processing when CTUP is not in effect

......

end if

......

Because the operator & has a lower priority than operator ==, it is necessary to enclose theexpression in ( ), in the type of conditional expression shown below:

(TM0305.@BSTS & BS_RUN) == 0

10th Edition : Dec.18,2003-00

H1-117

IM 33S01B30-01E

<H1.5 Function Block Data>

H1.5.8 Checking Data StatusData status can be checked using the built-in function, dscheck.

■ Checking Data Status Using a Dscheck Statement

dscheck (<function block data>, <data status>)

<function block data> Designate the function block data on which the status check is to be performed. In the function block, tag name, local generic name and simple variable or aray element in a dummy argument function block can be designated.

<data status> Designate the data status to be checked with a character-string constant or a character-string variable.

H010527E.EPS

The built-in function “dscheck” returns 1 if data status is true and 0 if it is false. The dscheckreturns an integer.

In SEBOL, even when reading or writing function block data, the system does not performdata status check.

■ Example of Data Status CheckAn example checking a data status is shown below:

● Determining the Data Status of the Process Variable (PV) for TAG002

An example of determining the data status of the process variable (PV) for TAG002 isshown below:

block PID TAG002

......

if (dscheck(TAG002.#PV,”CAL”) == 1) then

! processing when the status is CAL

......

else

! processing when the status is not CAL

......

end if

......

10th Edition : Dec.18,2003-00

H1-118

IM 33S01B30-01E

<H1.5 Function Block Data>

● Waiting for Cancellation of Calibration Status

An example of waiting for the cancellation of calibration status for FIC003 is shown below:

block PID FIC003

......

wait until (dscheck(FIC003.#PV,”CAL”) == 0)

......

● Checking Two or More Data Statuses Using the Logical Operator “or”

The following example checks using the logical operator “or” to find out which of the two ormore data statuses are true:

block PID FIC004

......

if (dscheck(TAG004.#PV,”CAL”) == 1

or dscheck(TAG004.#PV,”BAD”) == 1) then

! processing when the status is CAL or BAD

......

end if

......

● Checking Two or More Data Status Using the Logical Operator “and”

The following example checks using the logical operator “and” to find out which of the twoor more data statuses are true:

block PID TAG005

......

if (dscheck(TAG005.#PV,”CAL”) == 0

and dscheck(TAG005.#PV,”BAD”) == 1) then

! processing when the status is not CAL, but BAD

......

end if

......

10th Edition : Dec.18,2003-00

H1-119

IM 33S01B30-01E

<H1.5 Function Block Data>

● Checking Using the Logical Operators “and” and “or” in Combination

It is possible to perform checking with a logical expression that uses a combination of thelogical operators “and” and “or”. How to read data value and check data status with thesame timing is explained below.

dscheck (<long-type variable>, <data status>)

<long-type variable> Designates a long-type variable acquired with the format <function block>.#<data item name>. When a value other than the one acquired with the above format is designated, operation becomes uncertain, but a run-time error does not occur.

<data status> Designate the data status to be checked with a character-string constant or a character-string variable.

H010528E.EPS

The value acquired with [#data item name] can be stored in a long-type variable. If thislong-type value is designated for the built-in function “dscheck,” a data status check can beperformed.

Thus, data value read and data status check can be done with the same timing by readingboth the data value and data status at one time using a group assignment statement. Anexample of reading the PV value and its data status simultaneously and perform process-ing is given below. If the data status is BAD, error handling is performed, but if it is not BAD,the PV value (set in the local variable “pvvalue”) which is read with the same timing as thedata status, is used.

block PID TAG006

long dstat

double pvvalue

......

[pvvalue,dstat = TAG006.PV,TAG006.#PV]

! Read data and data status

if (dscheck(dstat,”BAD”) == 1) then

! Processing if status is BAD

......

else

! process using pvvalue

......

end if

......

10th Edition : Dec.18,2003-00

H1-120

IM 33S01B30-01E

<H1.5 Function Block Data>

H1.5.9 Modifying Data StatusThe data status can be modified by setting a data status character string in [&dataitem name].

■ Modifying Data Status with a Data Status Character StringData status character strings used when modifying the data status are shown below:

• “CAL”: Sets the calibration status.

• “NCL”: Cancels the calibration status.

The following is an example of setting the data status of the process variable (PV) tocalibration (CAL) in order to place the PID Controller Block in calibration status:

block PID FIC001

......

FIC001.&PV = “CAL”

......

■ Example of Modifying Data StatusAn example of modifying the data status is shown below:

block PID TAG007,TAG008,TAG009

genname PID GEN000[2]

......

assign “PID001” to GEN000[1]

assign “PID002” to GEN000[2]

......

[GEN000[*].&PV = “CAL”,”CAL”]

[TAG007.&PV,TAG008.&PV = “CAL”,”CAL”]

TAG009.&PV = “CAL”

......

Data cannot be read to [&data item name]. If [&data item name] is described on the right-hand side of a group assignment statement or in a “compare” statement parameter, acompile error occurs.

10th Edition : Dec.18,2003-00

H1-121

IM 33S01B30-01E

<H1.5 Function Block Data>

H1.5.10 Referencing Alarm StatusAn alarm status can be referenced using the data item ALRM.

■ Referencing Alarm Status Using the Data Item ALRMThe data item ALRM can hold an eight-byte character string.

When the process alarm character string is less than 8 bytes, the data item ALRM willindicate the character string as it is. Spaces will not be used to fill out the length. If multiplealarms occur, the data item ALRM will indicate the process alarm with the highest priority.

SEE ALSO

For the method to reference the alarm status individually, see the following:

H1.5.12, “Referencing Alarm Status Individually”

■ Example of Referencing the Alarm StatusAn example of referencing the FIC001 alarm status and reading to the local variable “alm”is shown below:

block PID FIC001

char*8 alm

......

alm = FIC001.ALRM

......

When the process alarm character string is less than 8 bytes, the data item ALRM willindicate the character string as it is. Spaces will not be used to fill out the length. If multiplealarms occur, the data item ALRM will indicate the process alarm with the highest priority.

SEE ALSO

For the method to reference the alarm status individually, see the following:

H1.5.12, “Referencing Alarm Status Individually”

Data cannot be written to the data item ALRM. If the data item ALRM of the function blockwith a tag name declared in a block statement or a local generic name declared in a“genname” statement is described on the left-hand side of an assignment or group assign-ment statement, a compiler error occurs.

10th Edition : Dec.18,2003-00

H1-122

IM 33S01B30-01E

<H1.5 Function Block Data>

H1.5.11 Status Control for Process AlarmAlarm Detection (AF), Alarm Inhibition (AOFS) and Alarm Flashing (AFLS) are thedata items for controlling behavior of process alarms. Changing these data items ona function block, the process alarms’ behavior of the function block can be manipu-lated.

■ Manipulating Status with Respect to a Process AlarmTo change a data item with respect to a process alarm, a status change command charac-ter string is set in the data item.

Table Status Change Instruction Character Strings for Process Alarm Status Manipulation

Data item name Status change instruction character string Description

AF"AOF" Enables group bypassing of alarm detection

"AON" Disables group bypassing of alarm detection

AOFS"AOF" Enables group alarm masking

"AON" Disables group alarm masking

AFLS "ACK"Acknowledges alarms in group (turnsflashing off)

H010529E.EPS

SEE ALSO

For details on SFC block alarms, see the following:

D5.6.9, “SFC Block Alarm Processing”

An example of status manipulation with respect to a process alarm is shown below:

● Enabling Group Alarm Masking for Function Block FIC001

block PID FIC001

......

FIC001.AOFS = “AOF” !”AOF” is the status change command character

string

......

● Acknowledging Alarms in Another SFC Block in Group

block _SFCSW SEBOL001

......

SEBOL001.AFLS = “ACK” !”ACK” is the status change command character string

......

10th Edition : Dec.18,2003-00

H1-123

IM 33S01B30-01E

<H1.5 Function Block Data>

■ Manipulating System - Fixed Alarm StatusTo manipulate individual block’s alarm behaviors, such as Alarm Detection (AF) and AlarmInhibition (AOFS), the system-fixed include file “salarm.h” can be used. Alarm Flashing(AFLS) cannot be applied individually. In salarm.h, labels for individually manipulatingalarms are defined using “#define” in the format below:

• Enable bypassing of alarm status detection• Enable alarm status masking AOF_<alarm status>

• Disable bypassing of alarm status detection• Disable alarm status masking AON_<alarm status>

However, it is necessary to substitute [+] with [P] and [-] with [M] in the alarm status.

H010530E.EPS

An example of manipulating a PID Controller Block alarm is given below:

#include “salarm.h”

block PID FIC301

FIC301.AF = AOF_IOPM ! enable bypassing IOP- alarm detection

FIC301.AF = AOF_VELP ! enable bypassing VEL+ alarm detection

FIC301.AOFS = AOF_HI ! enable HI alarm masking

......

FIC301.AF = AON_IOPM ! disable bypassing of IOP- alarm detection

FIC301.AF = AON_VELP ! disable bypassing of VEL+ alarm detection

FIC301.AOFS = AON_HI ! disable HI alarm masking

......

■ Manipulating User-Defined Alarm StatusThe blocks like SFC blocks may have user-defined alarm statuses. The following methodscan be used to manipulate the alarm statuses with user-defined character strings. Theuser-defined alarm statuses can be manipulated based on the status change commandscripts in the table below.

Table Status Change Command Scripts for Data Item AF, AOFS.

Status Change Command Scripts Description

ALnnOFALnnON

AF (Alarm Detection) for bit nn is disabledAF (Alarm Detection) for bit nn is enabled

ALnnOFALnnON

AOFS (Alarm Inhibition) for bit nn is enabledAOFS (Alarm Inhibition) for bit nn is disabled

H010555E.EPS

• In ALnnOF and ALnnON scripts, nn stands for the bit number, it can be specifiedwithin the range of 09 to 32.

• For AF, AL09OF or AL09ON commands will be ignored since bit 9 stands for statusNR which can not be disabled.

10th Edition : Dec.18,2003-00

H1-124

IM 33S01B30-01E

<H1.5 Function Block Data>

User-defined status character string can be defined on User-Defined Status CharacterString Builder, the bit number corresponds to the number in [Bit] column. The followingfigure shows an example in which the bit 9 is for NR, bit 17 is for HI, bit 18 is for LO and bit28 is for ERR strings.

#define ALOF_HI “AL17OF”

#define ALON_HI “AL17ON”

#define ALOF_LO “AL18OF”

#define ALON_LO “AL18ON”

#define ALOF_ERR “AL28OF”

#define ALON_ERR “AL28ON”

block _SFCSW SFC203

SFC203.AF = ALOF_LO ! Disables LO alarm detection

SFC203.AOFS = ALOF_HI ! Enables HI alarm inhibition

.....

SFC203.AF = ALON_LO ! Enables LO alarm detection

SFC203.AOFS = ALON_HI ! Disables HI alarm inhibition

File Edit View Tools Window Help

User-defined Status Character String Builder - [Pjt:MYPJT File:AlmStsLabel.edf - Alarm Status Definition]

USER12 USEF9 USEF10 USEF11 USEF12 USEF13 USEF14 USEF15 USEF16Bit89

1011121314151617181920212223242526272829303132

NAOOPIOPIOP-ESTP

HIHILOLOHTLO

DV+DV-

TAPSOBLINTEARDISCBLCK

CNF

NRALARM01ALARM02ALARM03ALARM04ALARM05ALARM06ALARM07ALARM08ALARM09ALARM10ALARM11ALARM12ALARM13ALARM14ALARM15ALARM16ALARM17ALARM18ALARM19ALARM20ALARM21ALARM22ALARM29

NR

HILO

ERR

NRALARM01ALARM02ALARM03ALARM04ALARM05ALARM06ALARM07ALARM08ALARM09ALARM10ALARM11ALARM12ALARM13ALARM14ALARM15ALARM16ALARM17ALARM18ALARM19ALARM20ALARM21ALARM22ALARM29

Ready

H010556E.EPS

MILOALMALL

MILOALMALL

Position: Line 9 Column 5 Change

Figure User-Defined alarm Status Character Strings

11th Edition : Oct.28,2004-00

H1-125

IM 33S01B30-01E

<H1.5 Function Block Data>

■ Confirming Status with Respect to a Process AlarmData items AF, AOFS and AFLS can be read as 8-byte character strings.

By referencing AF and AOFS, whether or not group is designated can be confirmed. Byreferencing AFLS, whether or not there is an unacknowledged alarm (flashing) can beconfirmed.

Table Data Items and the Meanings

Data item name Data type Character string Meaning

AF

char*8

"AF" Group bypass of alarm detection is enabled

AOFS "AOF" Group masking of alarm detection is enabled

AFLS "AFL" There is a flashing alarmH010531E.EPS

When the data item does not indicate the meaning in the table above, AF, AOFS and AFLSbecome character strings of length 0 (null character string).

An example of confirming status with respect to a process alarm is given below:

block PID FIC001

char*4 str1

......

FIC001.AOFS = “AOF” ! enable alarm group masking.

str1 = FIC001.AOFS ! “AOF” is set in str1.

......

FIC001.AOFS = “AON” ! disable alarm group masking.

str1 = FIC001.AOFS ! “”(character string of length 0) is set in str1.

......

10th Edition : Dec.18,2003-00

H1-126

IM 33S01B30-01E

<H1.5 Function Block Data>

H1.5.12 Referencing Alarm Status IndividuallyThe alarm status can be referenced individually using @ALRM, @AF, @AOFS and@AFLS.

■ Data Used in Individual Inquiry of Alarm Status@ALRM, @AF, @AOFS and @AFLS are 32-bit data (long-type). Each bit of the @ALRM,etc. indicates the state of each alarm status.

Table Meaning of Bit Value Indicating Each Alarm Status

@Data item Bit value Meaning

@ALRM10

Alarm is occurringAlarm is not occurring

@AF10

Alarm detection bypass is enabledAlarm detection bypass is disabled

@AOFS10

Alarm is maskedAlarm is not masked

@AFLS10

Alarm is flashingAlarm is not flashing

H010532E.EPS

Table Correlation between Alarm Status and Bit Number

Bit number @ALRM @AFLS @AOFS @AF

1 0 (*1) 0 0

2 0 0 (*2) 0

3 0 0 0 (*3)

4 to 8 0 0 0 0

9 to 32 (*4) (*4) (*4) (*4)H010533E.EPS

*1: The first bit of @AFLS is 1 if there is a flashing alarm, and 0 if there is no flashing alarm.*2: The second bit of @AOFS is 1 if alarm detection group masking is enabled, and 0 if it is disabled.*3: The third bit of @AF is 1 if alarm detection group bypass is enabled, and 0 if it is disabled.*4: Alarm status such as OOP, IOP+, and IOP- are allocated to bits 9 through 32.

In the system-fixed include file “salarm.h,” the correlation between the alarm status and bitnumber is defined using “#define” as mask patterns with a name in the format given below:

AL_<alarm status>However, it is necessary to substitute [+] with [P] and [-] with [M] in the alarm status.

H010534E.EPS

10th Edition : Dec.18,2003-00

H1-127

IM 33S01B30-01E

<H1.5 Function Block Data>

The following are some of the mask patterns in salarm.h:

......

#define AL_AFL $80000000 ! bit1

#define AL_AOF $40000000 ! bit2

#define AL_AF $20000000 ! bit3

#define AL_NR $00800000 ! bit9

#define AL_OOP $00400000 ! bit10

#define AL_IOP $00200000 ! bit11

#define AL_IOPM $00100000 ! bit12 IOP-

#define AL_HH $00080000 ! bit13

#define AL_LL $00040000 ! bit14

#define AL_HI $00008000 ! bit17

#define AL_LO $00004000 ! bit18

#define AL_DVP $00000800 ! bit21 DV+

#define AL_DVM $00000400 ! bit22 DV-

......

■ Example of Referencing Alarm Status IndividuallyAn example of individual reference to the alarms for the PID Controller Block (PID) and thetwo-position motor control unit (MC-2) using salam.h is shown below:

#include “salarm.h”

block PID FIC301

block MC-2 MO302

if ((FIC301.@ALRM & AL_OOP) <> 0) then ! processing when an OOP alarm occurs

......

end if

if ((FIC301.@AOFS & AL_HI) == 0) then ! processing when bypass is disabled for

! HI alarm

......

end if

if ((MO302.@AF & AL_PERR) <> 0) then ! processing when PERR alarm is masked

......

end if

if ((MO302.@AFLS & AL_ANSM) <> 0) then ! processing when ANS- alarm is flashing

......

end if

......

Because the operator “&” has a lower priority than the operator “<>”, “==,” expressionssuch as the conditional expressions as shown below must be enclosed by ( ).

((FIC301.@ALRM & AL_OOP) <> 0)

10th Edition : Dec.18,2003-00

H1-128

IM 33S01B30-01E

<H1.5 Function Block Data>

User-defined status character string can be defined on User-Defined Status CharacterString Builder, the bit number corresponds to the number in [Bit] column. The followingshows an example of program.

#define ALM_HI $00008000 !Bit 17

#define ALM_LO $00000400 !Bit 18

#define ALM_ERR $00000010 !Bit 28

block _SFCSW SFC203

if ((SFC203.@ALRM & ALM_ERR) <> 0) then

! Processing for error alarm occurrence.

....................

end if

if ((SFC203.@AOFS & ALM_HI) == 0) then ! Processing for HI alarm occurrence.

....................

end if

11th Edition : Oct.28,2004-00

H1-129

IM 33S01B30-01E

<H1.5 Function Block Data>

H1.5.13 Operation of Process I/O and Software I/OProcess I/O, software I/O and communication I/O with no tag names are accessedusing the terminal number or element number instead of a tag name.Process I/O and software I/O can be input or output as a group in 16-bit units.

■ Format of a Process I/O Terminal Number ¡ £

<process I/O identifier> <node number> <unit number> <slot number> <terminal number>[<auxiliary modification number>]

<process I/O identifier> Designate %Z.

<node number> Designate the node number. (*1)

<unit number> Designate the unit number.

<slot number> Designate the slot number.

<terminal number> Designate the terminal number.

<auxiliary modification number> Designate the domain number and station number when a process I/O in other control station is accessed.

H010535E.EPS

*1: ¡ £ Define 01 as the node number in PFCS and SFCS.

● Acquiring the PV Values of Process I/O from Terminals 1 through 3, Slot 3,Unit 2, Node 1 of the Present FCS

block %Z %Z012301, %Z012302, %Z012303

integer data[3]

......

[data[*] = %Z012301.PV, %Z012302.PV, %Z012303.PV]

......

● Acquiring the PV Values of Process I/O for Domain 3, Station 5

block %Z %Z015001S0305, %Z015002S0305, %Z015003S0305

integer data[3]

......

[data[*]=%Z015001S0305.PV,%Z015002S0305.PV,%Z015003S0305.PV]

......

● SI Bus Process Inputs/Outputs (Secondary I/O Bus for RFCS)

The syntax for applying the second process I/O bus, SI bus is as follows.%Y:nest number: 01 to 05 (Two digits)slot number: 1 to 8 (One digit)1: Fixedterminal number: 01 to 64 (Two digits)

To access an FCS local I/O signal PV of Nest 1, Slot 6, Terminal 33;

data = %Y016133

10th Edition : Dec.18,2003-00

H1-130

IM 33S01B30-01E

<H1.5 Function Block Data>

■ Usage of Software I/O Element Number ¡ £

<software I/O identifier> <regulatory number> [<auxiliary modification number>]

<software I/O identifier> Indicate the software I/O type.

<regulatory number> The internal switch regulatory numbers and message numbers are unique within the control station.

<auxiliary modification number> Designate the station number when a software I/O of other control station is accessed.

H010536E.EPS

The software I/O signals may be accessed by SEBOL are internal switches (globalswitches and common switches) and annunciator messages (message outputs).

● Usage of Global Switch £

The global switch may be referred in the following format.

%GSnnnmm[Sddss]

nnn: element number (001 to 256)mm: station number (01 to 64) (*1)dd: domain number (01 to 16, S is fixed)ss: station number (01 to 64)

*1: When set 00 to mm, the mm represents the current station number.

● Usage of Common Switch ¡

The common switch may be referred in the following format.

%SWnnnn[Sddss]nnnn: element number (0001 to 1000)dd: domain number (01 to 16, S is fixed)ss: station number 01 to 24)

● Usage of Common Switch £

The common switch may be referred in the following format.

%SWnnnn[Sddss]nnnn: element number (0001 to 4000)dd: domain number (01 to 16, S is fixed)ss: station number (01 to 64)

● Usage of Annunciator ¡

The annunciator may be referred in the following format.

%ANnnnn[Sddssaa]nnnn: element number (0001 to 0200)dd: domain number (01 to 16, S is fixed)ss: station number (01 to 24)aa: area number (fixed to 01)

10th Edition : Dec.18,2003-00

H1-131

IM 33S01B30-01E

<H1.5 Function Block Data>

● Usage of Annunciator £

The annunciator may be referred in the following format.

%ANnnnn[Sddssaa]nnnn: element number (0001 to 0500)dd: domain number (01 to 16, S is fixed)ss: station number (01 to 64)aa: area number (fixed to 01)

Software I/O’s other than those listed above cannot be accessed in SEBOL. For the regula-tory and other numbers listed in the above table, use zeros to make the numeric characterthe specified number of digits. Some of the common switches (%SW0001 to %SW0200)are elements that have predetermined applications for system use, such as the FCS startaction identifier. System-use common switch references are not regulated but setting islimited to specific items.

■ Format of Communication I/O Element NumbersThe format of communication I/O element number is shown below:

<communication I/O identifier> <regulatory number> <bit number>

<communication I/O identifier> Indicate the method for accessing communication I/O. %WW accesses the same area in word units, and %WB in bit units.

<regulatory number> This is the regulatory number within the communication I/O area.

<bit number> This is the bit number in the word. Designate in the range from 1 to 16. 1 indicates the most significant bit.

H010537E.EPS

In communication I/O, the same point can be accessed in word units and in bit units. Forexample, each of the 16bit of %WW0020 can be accessed as %WB002001 through%WB002016.

Word unit

%WW0020

1 2 3 16

Bit unit%WB002003

16bit

H010538E.EPS

Figure Identification Using %W

10th Edition : Dec.18,2003-00

H1-132

IM 33S01B30-01E

<H1.5 Function Block Data>

■ Identifiers Used in I/O Function DeclarationThe following identifiers are used instead of block codes when declaring process I/O,software I/O or communication I/O using a “block” or “genname” statement:

• Process I/O: %Z

• Global switch: %GS

• Common switch: %SW

• Communication I/O: %W or %WB

• Annunciator message: %AN

The following example declares a common switch with a tag name of SWITCH01:

block %SW SWITCH01

integer i

......

i = SWITCH01.PV

......

■ 16-Bit Group I/O Using Process I/O and Software I/O16 PV values with consecutive numbers can be consolidated as one data (16-bit unit) andinput or output by using the data item PV16 for the internal switch, annunciator messageand process I/O. The PV16 data is a 32-bit integer (long-type) in which the upper 16 bitsare 0 and each of the PV values corresponds to the lower 16 bits. The format for usingPV16 is shown below:

<tag name>.PV16<local generic name>.PV16<dummy argument function block>.PV16<terminal number>.PV16<element number>.PV16

H010539E.EPS

An array or array element can be used in the local generic name or dummy argumentfunction block. In the integer data input to PV16, the bit is 0 when there is no correspondingdata.

10th Edition : Dec.18,2003-00

H1-133

IM 33S01B30-01E

<H1.5 Function Block Data>

● Example of Group Input from Software I/O

The correlation between data input to PV16 and the PV value of the designated software I/O is as follows:

. . . . . . . . .Bit 30: %SW0020.PVBit 31: %SW0021.PVBit 32: %SW0022.PV

Bit 1 to16: 0Bit 17: %SW0007.PVBit 18: %SW0008.PVBit 19: %SW0009.PV

1 2 323 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

MSB LSB

H010540E.EPS

Figure Example of Group lnput from Software I/O (%SW0007, PV16)

An example of inputting the PV value using PV16 is shown below:

block %SW SW0001

long z1,zdata[3]

......

z1 = %SW0001.PV16

[zdata[*] = %SW0017.PV16,%SW0033.PV16,%SW0049.PV16]

......

● Group Input from Process I/O

Since the terminal numbers for process I/O are 1 to 32, when %Z015129.PV16 (unitnumber 5, slot number 1, terminal number 29) is designated, the PV values of terminalnumbers 29, 30, 31 and 32 correspond to bits 17 to 32, and the remaining lower 12 bitsbecome 0.

Bit 20: %Z0175132.PVBit 21: 0Bit 22: 0. . . . . . . . .Bit 31: 0Bit 32: 0

Bit 1 to16: 0Bit 17: %Z0175129.PVBit 18: %Z0175130.PVBit 19: %Z0175131.PV

1 2 323 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

MSB LSB

H010541E.EPS

Figure Example of Group lnput from Process I/O

10th Edition : Dec.18,2003-00

H1-134

IM 33S01B30-01E

<H1.5 Function Block Data>

● Assigning PV16 Data to a Long-Type Variable

When PV16 data is assigned to long-type variable, 0 is set for the upper 16 bits. WhenPV16 data is assigned to an integer-type variable and if the PV value of the designatedprocess I/O or software I/O (corresponding to bit 17) is 1, be aware that this will cause anoverflow.

The example below shows when the PV value for %SW0101 is 1.

block %SW SW0101

integer int1

long lng1

......

lng1 = %SW0101.PV16

! upper 16 bits of lng1 are 0.

! $00008000 is assigned to lng1.

......

int1 = %SW0101.PV16

! Overflow is caused.

! $00008000 = 32768 is outside the range of an inte

! ger type.

......

● Outputting a Long-Type Value to PV16 Data

When outputting a long-type value to the PV16 data, set the upper 16 bits to 0. Even in acase where a negative integer value (most significant bit is 1) is to be set in PV16, set theupper 16 bits to 0 by masking with $0000FFFF before the setting.

block %SW SW0101

long lng1

integer int1

! setpoint value is retained in the lower 16 bits of

! lng1

! set 0 to the upper 16 bits before setting.

%SW0101.PV16 = lng1 & $0000FFFF

......

! setpoint is retained in lng1’s 16 bits.

! the result of int1 & $0000FFFF is a long-type value

! of which the upper 16 bits are 0.

%SW0101.PV16 = int1 & $0000FFFF

● Note on Setting a Value in PV16 for Process I/O

A value can be set in PV16 of the process I/O only when the terminal action modes of the16 points of terminals that correspond to PV16 are set to all SO or all PO.

10th Edition : Dec.18,2003-00

H1-135

IM 33S01B30-01E

<H1.5 Function Block Data>

H1.5.14 One-Shot Execution of a Function BlockThe “oneshot” statement performs a one-shot execution of the designated functionblock.

■ One-Shot Execution of a Function Block Using a “oneshot” Statement

oneshot <function block> [,<parameter>] [;<error variable>] [; error <label> [,<error identifier>] ] errorsub

<function block> Designate a function block such as a tag name declared with a "block" statement, a local generic name declared with a "genname" statement and a generic name declared with a "unit genname" statement.

<parameter> Designate a parameter with a numeric-type constant or variable. If this is omitted, the parameter becomes 0.

<error variable> Designate the local variable to which the error code is set. If no error occurs, this is set to 0.

<label> Designate the branching destination at the time an error occurs.

<error identifier> Designate a local variable or a constant to identify where the error was generated in the error handling section.

H010542E.EPS

If a parameter is designated in a function block where there is no parameter designation, itwill be disregarded.

A sequence table cannot be designated in a “oneshot” statement. To perform a one-shotexecution of a sequence table, use a “seqtable oneshot” statement.

The “oneshot” statement can not be applied to logic chart. To execute the logic chart foroneshot action, “logicchart oneshot” statement may be used.

12th Edition : Mar.31,2005-00

H1-136

IM 33S01B30-01E

<H1.5 Function Block Data>

The function blocks that can be designated with a “oneshot” statement are shown below:

Table Function Blocks Designated with a “oneshot” Statement

Block type Code Name Parameter

Software counter block CTS Software Counter Block 0, 1

Code input block CI Code Input Block NoneCode output block CO Code Output Block

Calculation auxiliary

BDSET-1L One-Batch Data Set Block

0 to 17BDSET-1C One-Batch String Data Set Block

BDSET-2L Two-Batch Data Set Block

BDSET-2C Two-Batch String Data Set Block

BDA-L Batch Data Acquisition Block0 to 17

BDA-C Batch String Data Acquisition Block

General-purposecalculation

CALCU General-Purpose Calculation BlockNone

CALCU-C General-Purpose Calculation Block with String I/O

Arithmetic calculation

ADD Addition Block

None

None

MUL Multiplication Block

DIV Division Block

AVE Averaging Block

H010543E.EPS

AND Logical AND Block

OR Logical OR Block

NOT Logical NOT Block

SRS1-S Set-Dominant Flip-Flop Block with 1 Output

SRS1-R Reset-Dominant Flip-Flop Block with 1 Output

SRS2-S Set-Dominant Flip-Flop Block with 2 Outputs

SRS2-R

WOUT Wipeout Block

Logic Operation (*1)OND ON-Delay Timer Block

OFFD OFF-Delay Timer Block

One-Shot Block (Rising-Edge Trigger)

TOFF One-Shot Block (Falling-Edge Trigger)

GT Comparator Block (Greater Than)

GE Comparator Block (Greater Than or Equal)

EQ Equal Operator Block

BAND

BOR Bitwise OR Block

BNOT Bitwise NOT Block

TON

Reset-Dominant Flip-Flop Block with 2 Outputs

Bitwise AND Block

*1: Logic operation block can be used in FCSs except PFCS.

The parameters for the Software Counter Block (CTS) are shown below:

• 1: Updates the counter.

• 0: Stops the counter.

12th Edition : Mar.31,2005-00

H1-137

IM 33S01B30-01E

<H1.5 Function Block Data>

The parameters for the batch data setting blocks (BDSET-1C, BDSET-1L, BDSET-2C andBDSET-2L) are given below:

• 0: Changes all current setting data to 0.

• 1 to 16: Sets only designated current setting data (DTnn).

• 17: Sets all current setting data.

Parameters for the batch data acquisition blocks (BDA-C, BDA-L) are shown below:

• 0: Changes all acquired data to 0.

• 1 to 16: Acquires only designated data (DTmm).

• 17: Acquires all data.

■ One-Shot Execution of a Function BlockAn example of one-shot execution of a function block is given below:

● Updating the Counter

By designating 1 for the parameter of a “oneshot” statement and executing a softwarecounter (CTS) block, counter update is performed and the counter value of the softwarecounter (CTS) block (PV) increases by 1.

block CTS CTS003

......

oneshot CTS003,1 ! Parameter 1 is for updating the counter.

......

In the above example, the action is the same as when the sequence table operation signalshown below is executed:

CTS003.ACT.ON ——— Y

● Stopping the Counter

By designating 0 for the parameter of a “oneshot” statement and executing a softwarecounter block, the counter of the software counter block stops. The block status (BSTS) ofthe software counter block becomes STOP.

block CTS CTS003

......

oneshot CTS003,0 ! Parameter 0 is for counter stop operation.

......

In the above example, the action is the same as when the sequence table operation signalshown below is executed:

CTS003.ACT.OFF ——— Y

10th Edition : Dec.18,2003-00

H1-138

IM 33S01B30-01E

<H1.5 Function Block Data>

H1.5.15 Sequence Table (ST16) Block OperationIn SEBOL, one-shot execution, one-shot check, periodic start with one-shot execu-tion and periodic start of a sequence table (block code ST16) can be performed.

■ Sequence Table Operation Using a “seqtable” StatementA sequence table (ST16) block can perform a one-shot execution or check while the blockmode is either MAN or AUT. The block mode does not change even after a one-shotexecution or check has been performed. However, the operation that include oneshotexecution may be only applied to the sequence table within the same control station.

Table Sequence Table (ST16) Blocks Operated with a seqtable Statement

Operation TC/TE type OC/OE type B/I type Control of otherstations

One-shot execution, one-shot check � � �

Periodic start with one-shot execution �

Periodic start (Change block mode to AUT) � � � �

H010544E.EPS

�: Operation allowedBlank: Run-time error�: Block mode changes to AUT, but periodic start is not performed.

Types for sequence table (ST16) block processing timing one shown as follows:

• TC: Outputs only during periodic start or when status changes

• TE: Outputs during periodic start or each time when conditions establish

• OC: Outputs only during one-shot start or when status changes

• OE: Outputs during periodic start or each time conditions are satisfied

• B: Executed once after initial cold start

• I: Executed once after initial cold start and restart after momentary power failure

A sequence table (ST16) block with a processing timing of B type or I type is originally usedto execute user defined initialization processing when the FCS executes an initial cold startor restart. However, these sequence table (ST16) blocks can be activated by designatingthem in a SEBOL “seqtable” statement. In this case, it is important to note that the block willperform a one-shot execution at the point the SEBOL statement is executed.

10th Edition : Dec.18,2003-00

H1-139

IM 33S01B30-01E

<H1.5 Function Block Data>

■ One-Shot ExecutionWith “oneshot” designation in “seqtable” statement, the sequence table (ST16) block of thedesignated tag name will be executed as a one-shot. If it the result of condition checkindicates that the condition is satisfied, status manipulation is executed. The format of one-shot execution is given below.

seqtable oneshot <tag name> [,<execution step name>] ;<check result> [;<error variable>] [; error <label> [,<error identifier>] ] errorsub

<tag name> Designate a tag name. A local generic name and dummy argument function block can also be designated.

<execution step name> Designate the step name for a step-type sequence table with a character-string constant or character-string variable of two bytes or less. If the character string is longer than two bytes, the first two bytes are used.

<check result> Designate an integer-type local variable to which the result of testing the sequence table conditions is set. If the sequence table is a non-step type, 1 is set when at least one of the 32 conditions is satisfied, and 0 when none of the conditions is satisfied. In the case of a step-type table, the step rule for the designated <execution step name> (if the <execution step name> is not designated, the step rule for the PV value of the sequence table) is checked, and 1 is set when at least one of the conditions is satisfied, and 0 when none of the conditions is satisfied.

<error variable> Designate the local variable to which the error code is set. If no error occurs, this is set to 0.

<label> Designate the branching destination at the time an error occurs.

<error identifier> Designate a local variable or a constant to identify where the error was generated in the error handling section.

H010545E.EPS

When a “seqtable” statement is executed, the rules of the step designated in the <execu-tion step name> and the [00] step are executed or checked.

When <execution step name> is designated, the sequence table’s PV value changes to<execution step name> if “oneshot” is designated. If the designated <execution stepname> does not exist, a run-time error occurs and the sequence table is not executed.

If a step-type sequence table is executed without designating an <execution step name>,the step for the PV value held by the sequence table at that point as well as the [00] stepwill be subjected to execution.

If the sequence table is a non-step type, all rules are executed. Even if an <execution stepname> is designated in a non-step type sequence table, it will be disregarded.

10th Edition : Dec.18,2003-00

H1-140

IM 33S01B30-01E

<H1.5 Function Block Data>

■ One-Shot CheckWith “check” designation in “seqtable” statement, the sequence table (ST16) block of thedesignated tag name will be checked as a one-shot. Since the sequence table (ST16)block is only checked with the conditions, status manipulation is not performed even if theconditions are satisfied. Except for the fact that status manipulation is not executed, the“check” designation operates in the same way as the “oneshot” designation.

The format of a one-shot check is shown below:

seqtable check <tag name> [, <execution step name>]; <check result> [; <error variable>] [; error <label> [, <error identifier>] ] errorsub

<tag name> Designate a tag name. A local generic name and dummy argument function block can also be designated.

<execution step name> Designate the step name for a step-type sequence table with a character-string constant or character-string variable of 2 bytes or less. If the character string is longer than 2 bytes, the first 2 bytes are used.

<check result> Designate an integer-type local variable to which the result of testing the sequence table conditions is set. If the sequence table is a non-step type, 1 is set when at least one of the 32 conditions is satisfied, and 0 when none of the conditions is satisfied. In the case of a step-type table, the step rule for the designated <execution step name> (if the <execution step name> is not designated, the step rule for the PV value of the sequence table) is checked, and 1 is set when at least one of the conditions is satisfied, and 0 when none of the conditions is satisfied.

<error variable> Designate the local variable to which the error code is set. If no error occurs, this is set to 0.

<label> Designate the branching destination at the time an error occurs.

<error identifier> Designate a local variable or a constant to identify where the error was generated in the error handling section.

H010546E.EPS

When a “seqtable” statement is executed, the rules of the step designated in the <execu-tion step name> and the [00] step are checked.

When <execution step name> is designated, the designated execution step is checked, butthe PV value does not change if “check” is designated. If the designated <execution stepname> does not exist, a run-time error occurs and the sequence table is not checked.

If a step-type sequence table is checked (“check” designation exists) without designatingan <execution step name>, the step for the PV value held by the sequence table at thatpoint as well as the [00] step will be subjected to the check.

If the sequence table is a non-step type, all rules are checked. Even if an <execution stepname> is designated in a non-step type sequence table, it will be disregarded.

10th Edition : Dec.18,2003-00

H1-141

IM 33S01B30-01E

<H1.5 Function Block Data>

■ Periodic Start with One-Shot ExecutionThere are two methods to perform periodic start with one-shot execution for sequencetable (ST16) block: “drive” designation in “seqtable” statement and “drivewait” designationin “seqtable” statement.

● Periodic Start with One-Shot Execution Using “drive” Designation in“seqtable” Statement

With “drive” designation in “seqtable” statement, the block mode of the sequence table(ST16) block changes to AUT after the periodic start type sequence table (ST16) block (TEtype or TC type) of the designated tag name is executed as a one-shot. The sequencetable (ST16) block is periodically started from the next operation timing.

The format of a “drive” designation in a “seqtable” statement is shown below:

seqtable drive <tag name> [,<execution step name>] [;<error variable>] [; error <label> [,<error identifier>] ] errorsub

<tag name> Designate a tag name. A local generic name and dummy argument function block can also be designated.

<execution step name> Designate the step name for a step-type sequence table with a character-string constant or character-string variable of two bytes or less. If the character string is longer than two bytes, the first two bytes are used.

<error variable> Designate the local variable to which the error code is set. If no error occurs, this is set to 0.

<label> Designate the branching destination at the time an error occurs.

<error identifier> Designate a local variable or a constant to identify where the error was generated in the error handling section.

H010547E.EPS

In the case of step type sequence table (ST16) block, when the <execution step name> isdesignated, the step is changed to <execution step name> prior to the one shot execution.After the designated step and the [00] step are executed in one shot, the sequence table(ST16) block is periodically started.

If the step in the <execution step name> does not exist, a run-time error occurs. In this casethe sequence table (ST16) block is not executed and the block mode does not change.

If an <execution step name> is not designated, the step of the PV value held by the se-quence table at that point and the [00] step are executed as a one-shot, then that sequencetable (ST16) block is periodically executed from that step.

If the sequence table (ST16) block is a non-step type, all rules are executed. Even if an<execution step name> is designated in a non-step type sequence table, it will be disre-garded.

10th Edition : Dec.18,2003-00

H1-142

IM 33S01B30-01E

<H1.5 Function Block Data>

● Periodic Start with One-Shot Execution Using “drivewait” Designation in“seqtable” Statement

With “drivewait” designation in “seqtable” statement, after the periodic start type sequencetable (ST16) block (TE type or TC type) of the designated tag name is one-shot periodicallystarted, the ST16 block mode changes to AUT, and the program waits for an SFC/SEBOLreturn event message to be output from the sequence table (ST16) block.

Except for that the program waits for the message output from the sequence table (ST16)block, the “drivewait” designation operates in the same way as the “drive” designation.

The format of “drivewait” designation in “seqtable” statement is shown below:

seqtable drivewait <tag name> [, <execution step name>]; <action signal column parameter> [;<error variable>] [; error <label> [,<error identifier>] ] errorsub

<tag name> Designate a tag name. A local generic name and dummy argument function block can also be designated.

<execution step name> Designate the step name for a step-type sequence table with a character-string constant or character-string variable of two bytes or less. If the character string is longer than two bytes, the first two bytes are used.

<action signal column parameter> Designates a long-type local variable to which the parameter for the sequence table action signal column (SFC/SEBOL return event message, %RE) will be returned.

<error variable> Designate the local variable to which the error code is set. If no error occurs, this is set to 0.

<label> Designate the branching destination at the time an error occurs.

<error identifier> Designate a local variable or a constant to identify where the error was generated in the error handling section.

H010548E.EPS

In the case of step type sequence table (ST16) block, when the <execution step name> isdesignated, the step is changed to <execution step name> prior to the one shot execution.After the designated step and the [00] step are executed in one shot, the sequence table(ST16) block is periodically started.

If the step in the <execution step name> does not exist, a run-time error occurs. In this casethe sequence table (ST16) block is not executed and the block mode does not change.

If an <execution step name> is not designated, the step of the PV value held by the se-quence table (ST16) at that point and the [00] step are executed as a one-shot, then thatsequence table (ST16) block is periodically executed from that step.

If the sequence table (ST16) block is a non-step type, all rules are executed. Even if an<execution step name> is designated in a non-step type sequence table, it will be disre-garded.

10th Edition : Dec.18,2003-00

H1-143

IM 33S01B30-01E

<H1.5 Function Block Data>

● SFC/SEBOL Return Event Message for “drivewait” Designation in“seqtable” Statement

With “drivewait” designation in “seqtable” statement, the parameter designated in thesequence table (ST16) block’s action signal column is returned to <action signal columnparameter> when an SFC/SEBOL return event message is output from the sequence table(ST16) block. Because the parameter value is in the range of 0 to 65535, designate a long-type local variable in the <action signal column parameter>. Since the range for integers isfrom -32768 to 32767, an overflow will occur if the parameter is larger than 32767 when aninteger-type variable is used.

If the block mode changes to MAN without an SFC/SEBOL return event message havingbeen output from the sequence table (ST16) block that was started with a “drivewait”designation, the “seqtable” statement is terminated normally and 1 is returned to <actionsignal column parameter>. If the block mode of the sequence table (ST16) block becomesO/S, the “seqtable” statement generates a run-time error and the <action signal columnparameter> will retain the same value as the one prior to the execution of the “seqtable”statement.

If the sequence table (ST16) block that was started with the “drivewait” designation outputsan SFC/SEBOL return event message, or if the SFC block that started a sequence table(ST16) block with a “drivewait” designation is forced to terminate, the block mode of thatsequence table (ST16) block changes automatically from AUT to MAN.

More precisely, the timing that the ST16 block automatically changes its mode from AUT toMAN is the moment that the SFC block is forced to terminate by a block status changecommand while the ST16 block started by “drivewait” statement is in AUT mode, and rightbefore SFC/SEBOL return message is output.

When a one-shot execution is performed for the first time, if that sequence table (ST16)block outputs an SFC/SEBOL return event message, the block mode becomes MAN and aperiodic start will not be executed after that.

When the block mode of the sequence table (ST16) block is AUT and it has already beenexecuted periodically, an error does not occur even if the “seqtable” statement is executed.The sequence table (ST16) block is executed as a one-shot and will continue to be startedperiodically.

10th Edition : Dec.18,2003-00

H1-144

IM 33S01B30-01E

<H1.5 Function Block Data>

■ Periodic StartIf the block mode of a periodic start type sequence table (ST16) block (TE type or TC type)is changed to AUT, the sequence table (ST16) block will be periodically started from thenext operation timing.

The expression when the block mode of the sequence table (ST16) block is changed toAUT is shown below:

<tag name>. MODE= "AUT"

H010549E.EPS

To perform periodic start of the sequence table (ST16) block with error check, use a groupassignment statement.

SEE ALSO

For details on group assignment statement, see the following:

H1.5.2, “Group Assignment Statement”

With “drive” designation in “seqtable” statement, the sequence table (ST16) block will firstbe executed as one-shot during the execution of the “seqtable” statement. However, if theblock mode is changed to AUT, execution begins from the sequence table (ST16) block’snext operation timing.

The sequence table (ST16) block is started by changing the block mode when startingsequence table (ST16) blocks in another FCS or when one-shot execution is not desirable.When start ST16 block in other control stations, if the one-shot start is not required, theblock may be started by changing the block mode.

10th Edition : Dec.18,2003-00

H1-145

IM 33S01B30-01E

<H1.5 Function Block Data>

H1.5.16 Logic Chart Block (LC64) OperationIn SEBOL, one-shot execution, periodic start with one-shot execution and periodicstart may be applied to Logic Chart Block (LC64).

■ Logic Chart Operation Using a “logicchart” StatementA logic chart block can perform one-shot execution when the block mode is either MAN orAUT. The block mode does not change even after a one-shot execution has been per-formed. However, the operation that include oneshot execution may be only applied to thelogic chart within the same FCS.

Table Logic Chart Blocks Operated with “logicchart” Statement

Operation T type O type B/I typeControl other

stations

One-shot execution � � �

Periodic start with one-shot execution �

Periodic start (Change block mode to AUT) � � � �

H010550E.EPS

�: Operation allowedBlank: Run-time error�: Block mode changes to AUT, but periodic start is not performed.

Types for logic chart block processing timing are shown as follows:

• T: Periodic start, and output only when condition establishes.

• O: One-shot start, and output every scan when condition establishes

• B : Execute once after initial cold start

• I: Execute once after initial cold start or after restart caused by momentary powerfailure

Logic chart block with processing timing of B type or I type is originally provided for runningthe user defined initialization processing when the FCS executes an initial cold start orrestart. However, the logic chart blocks may also be activated by a SEBOL “logicchart”statement. In this case, please be noted that the block will perform a one-shot execution atthe timing that the SEBOL statement is executed.

10th Edition : Dec.18,2003-00

H1-146

IM 33S01B30-01E

<H1.5 Function Block Data>

■ One-Shot ExecutionWhen the “logicchart” statement is designated as a one-shot execution command, the logicchart block with the designated tag name will be executed for a one-shot. If it the result ofcondition check indicates that the condition is satisfied, status manipulation will be ex-ecuted.

The format for one-shot execution is given as below.

logicchart oneshot <tag name> [;<error variable>] [; error <label> [,<error identifier>] ] errorsub

<tag name> Designate a tag name. A local generic name and dummy argument function block can also be designated.

<error variable> Designate the local variable to which the error code is set. If no error occurs, this is set to 0.

<label> Designate the branching destination at the time an error occurs.

<error identifier> Designate a local variable or a constant to identify where the error was generated in the error handling section.

H010551E.EPS

10th Edition : Dec.18,2003-00

H1-147

IM 33S01B30-01E

<H1.5 Function Block Data>

10th Edition : Dec.18,2003-00

■ Periodic Start with One-Shot ExecutionThere are two methods to perform periodic start with one-shot execution for logic chartblock by “logicchart” statement with “drive” designation or by “logicchart” statement with“drivewait” designation.

● Periodic Start with One-Shot Execution by “logicchart” Statement with“drive” Designation

By “logicchart” statement with “drive” designation, the block mode of the periodic startedlogic chart block (T type) may change to AUT after the one-shot execution. Logic chartblock is periodically started at the following timings.

The format of “logicchart” statement with “drive” designation is shown as follows.

logicchart drive <tag name> [;<error variable>] [; error <label> [,<error identifier>] ] errorsub

<tag name> Designate a tag name. A local generic name and dummy argument function block can also be designated.

<error variable> Designate the local variable to which the error code is set. If no error occurs, this is set to 0.

<label> Designate the branching destination at the time an error occurs.

<error identifier> Designate a local variable or a constant to identify the location where the error was generated in the error handling section.

H010552E.EPS

H1-148

IM 33S01B30-01E

<H1.5 Function Block Data>

10th Edition : Dec.18,2003-00

● Periodic Start with One-Shot Execution by “logicchart” Statement with“drivewait” Designation

By “logicchart” statement with “drivewait” designation, the block mode of the periodicstarted logic chart block (T type) may change to AUT after the one-shot execution. Then theprocess is waiting for the SFC/SEBOL return event message output from the logic chartblock.

Except for waiting the returned message from LC64 block, “drivewait” designation is thesame as the “drive” designation.

Logic chart block is periodically started at the following timings.

The format of “logicchart” statement with “drivewait” designation is shown as follows.

logicchart drivewait <tag name>;<parameter for action signal> [;<error variable>] [; error <label> [,<error identifier>] ] errorsub

<tag name> Designate a tag name. A local generic name and dummy argument function block can also be designated.

<parameter for action signal> When “drivewait” is used, the local variable defined in the action column of the logic chart is required to be defined in long type for returned message (SFC/SEBOL return event message, %RE).

<error variable> Designate the local variable to which the error code is set. If no error occurs, this is set to 0.

<label> Designate the branching destination at the time an error occurs.

<error identifier> Designate a local variable or a constant to identify the location where the error was generated in the error handling section.

H010553E.EPS

H1-149

IM 33S01B30-01E

<H1.5 Function Block Data>

10th Edition : Dec.18,2003-00

● SFC/SEBOL Return Event Message for in “logicchart” Statement with“drivewait” Designation

With a “logicchart” statement with “drivewait” designation, an SFC/SEBOL return eventmessage is output from the logic chart block, thus returns the parameter designated in theaction signal column to <action signal column parameter> . Since the parameter value is inthe range of 0 to 65535, a long-type local variable should be defined in the <action signalcolumn parameter>. If an integer-type variable is used, an overflow will occur when theparameter is larger than 32767 because of the range for integers is from -32768 to 32767.

If the block mode changes to MAN without the SFC/SEBOL return event message outputfrom the logic chart block started by “drivewait” designation, the “logicchart” statement willbe terminated normally and return a value 1 to <action signal column parameter>. If theblock mode of the logic chart block is O/S, the “logicchart” statement may generate a run-time error and the <action signal column parameter> will retain the same value prior to theexecution of the “logicchart” statement.

If an SFC/SEBOL return event message is output by the logic chart block started by the“drivewait” designation, or if the SFC block that started the logic chart block with the“drivewait” designation is forced to terminate, the logic chart block mode may automaticallychange from AUT to MAN. More precisely, the timing that the LC64 block automaticallychanges its mode from AUT to MAN is the moment that the SFC block is forced to termi-nate by a block status change command while the LC64 block started by “drivewait” state-ment is in AUT mode, and right before SFC/SEBOL return message is output.

If the logic chart block outputs an SFC/SEBOL return event message at the first time theone-shot execution is performed, the block mode will become MAN, thus there will be noperiodic start after.

When the block mode of the logic chart block is AUT and it has been periodically executed,no error will occur even when the “logicchart” statement is executed.

The logic chart block is executed for a one-shot and then will continue to be started periodi-cally.

H1-150

IM 33S01B30-01E

<H1.5 Function Block Data>

10th Edition : Dec.18,2003-00

■ Periodic StartIf the block mode of a periodic start type logic chart block (T type) is changed to AUT, thelogic chart block will be started periodically from the next execution timing.

The syntax for changing the logic chart block mode to AUT is as follows:

<tag name>.MODE=“AUT”

H010554E.EPS

To perform periodic start of the logic chart block with error check, group assignment state-ment may be used.

SEE ALSO

For details on group assignment statement, see the following:

H1.5.2, “Group Assignment Statement”

With a in “logicchart” statement with “drive” designation, the logic chart block will first beexecuted for a one-shot execution by the “logicchart” statement. However, if the blockmode is changed to AUT, will continue to start according to its own execution timing. Whenstart ST16 block in other control stations, if the one-shot start is not required, the block maybe started by changing the block mode.

H1-151

IM 33S01B30-01E

<H1.5 Function Block Data>

10th Edition : Dec.18,2003-00

H1.5.17 Timer Block (TM) OperationThe Timer Block can be started and stopped from SEBOL. Also, the timer block’sstop status and status during counting can be confirmed by referencing the blockstatus. Elapsed time can be found by referencing the PV value of the timer block.

■ Data Items Used in Timer Block (TM) OperationMajor data item names for the Timer Block (TM) and their usage are as follows:

• OP: Used in operations such as start and stop.

• BSTS: Used to obtain the timer block status.

• PV: Used to obtain elapsed time.

A timer block not only counts the elapsed time but also give a user-specified output whentime-up.

Actions such as changing the SFC block mode or status as well as transmission of signalsto the SFC block can be designated for the actions after the designated time has elapsed.

TIP

SEBOL itself has no function same as a timer block. Processing can be delayed using a “delay” state-ment or “delaycycle” statement, but for operations after a designated time has elapsed or at pre-selectedintervals, use the timer block.

The timer block can be operated if the integer values given in the table below are set in thetimer block data item, OP, using an assignment or group assignment statement.

• 1: Stops the timer.

• 2: Starts the timer.

• 3: Restarts a paused timer.

• 4: Temporarily stops a timer in the course of counting.

■ Example of Timer Block (TM) OperationAn example of timer block operation is shown below:

#include “std.h “ ! label TM**** is defined in std.h

block TM TIM0001

TIM0001.OP = TMSTAT ! starts the timer block

......

TIM0001.OP = TMPAUS ! stops temporarily

......

TIM0001.OP = TMCONT ! restarts

......

TIM0001.OP = TMSTOP ! stop

H1-152

IM 33S01B30-01E

<H1.6 Process Management>

H1.6 Process Management▼ Process Management

To operate a plant using the process management functions, execute a unit recipeon unit instruments. Operations are started from unit recipes.

Some functions are provided by operations that are started from a non-unit-reciperesident unit. In addition to these functions, several other functions are availablethat are unique to operations started from a unit recipe.

This section explains these special functions available with operations started froma unit recipe.

■ Accessing Common BlocksOperations started from a unit recipe can access common blocks using built-in functions.The following two types of functions are provided when accessing common blocks:

• Read common block data

• Write common block data

■ Manipulating Unit RecipesOperations started from a unit recipe can manipulate unit recipes using built-in functions.The unit recipe functions that can be carried out from operations are shown below:

• Dynamic assignment of units

• Download

• Start

• Abort

• Complete

• Cancel

■ Reserving RecipesOperations started from a unit recipe can reserve control recipes (or perform recipe setup)using built-in functions.

■ Built-In Functions with Batch ID SpecificationAny operation or SFC block can use the built-in functions with specified Batch ID andperform the followings; However, using the functions is subject to certain restrictions.

• Read common block data (batch ID specification)

• Write common block data (batch ID specification)

• Manipulate unit recipes (batch ID specification)

SEE ALSO

For more information about the restriction for using built-in functions with Batch ID, see the following:

“■ Conditions for Accessing Common Block Data” in H1.6.4, “Built-In Functions with Batch ID”

14th Edition : Dec.26,2006-00

H1-153

IM 33S01B30-01E

<H1.6 Process Management>

H1.6.1 Accessing Common Block DataOperations started from a unit recipe can access common blocks using built-infunctions. This section explains the types of recipe common blocks and how to reador write common block data.

■ Types of Recipe Common BlocksThe recipe common blocks include system-fixed common blocks and user-defined com-mon blocks. The system-fixed common blocks are further classified into two types:SYSRCM and SYSPCMnn.

• SYSRCMThere is one SYSRCM for Each recipe.

• SYSPCMnnThere is one SYSPCMnn for each unit recipe. nn indicates the unit recupe number. Ifthe number is a single-digit value, add “0” as in “SYSPCM01” and “SYSPCM02.”

In operations started from a unit recipe, all of the common block data for that recipe can beread or written using built-in functions.

10th Edition : Dec.18,2003-00

H1-154

IM 33S01B30-01E

<H1.6 Process Management>

■ Reading Common Block DataUse the built-in functions lcmread(), dcmread() and ccmread() to read common block data.

• Simple variable lcmread (<common block name>, <data item name>) dcmread (<common block name>, <data item name>) ccmread (<common block name>, <data item name>)• One-dimensional array element lcmread (<common block name>, <data item name>, <1-dim. subscript>) dcmread (<common block name>, <data item name>, <1-dim. subscript>) ccmread (<common block name>, <data item name>, <1-dim. subscript>)• Two-dimensional array element lcmread (<common block name>, <data item name>, <1-dim. subscript>, <2-dim. subscript>) dcmread (<common block name>, <data item name>, <1-dim. subscript>, <2-dim. subscript>) ccmread (<common block name>, <data item name>, <1-dim. subscript>, <2-dim. subscript>) <common block name> Specify the common block name using a character-string variable or character-string constant. Use uppercase letters for the common block name. <data item name> Specify the data item name using a character-string variable or character-string constant. Use uppercase letters for the data item name. <1-dim., 2-dim. subscript> Specify the array subscript(s) using a variable or constant. An expression comprising two or more terms such as “i + 1” cannot be specified.

H010601E.EPS

lcmread() is a built-in function of long type, dcmread() of double type and ccmread() ofchar*n type.

To read numeric data from a common block, use lcmread() or dcmread(). If the type of thecommon block data is different from that of the built-in function, the common block data isconverted to the type of the built-in function.

It is recommended that lcmread() be used when reading integer-type and long-type com-mon block data, while dcmread() be used when reading float-type and long-type commonblock data.

Use ccmread() when reading character-string type common block data.

Table Reading Common Block Data

H010602E.EPS

Function name Type Return value at normal execution

lcmread long Common block data other than of long type are converted to long type.

dcmread double Common block data other than of double type are converted to double type.

ccmread char*n A character string of the string length of the common block data.

10th Edition : Dec.18,2003-00

H1-155

IM 33S01B30-01E

<H1.6 Process Management>

• If common block data cannot be read because the common block or data item notexist or because the array subscript range is exceeded, the execution of that line isstopped. For example, if an error occurs in the following lcmread assignment state-ment for any of these reasons, assignment to the left-hand side is not performed andthe “ldata” value will not change.

......

long data

......

ldata = lcmread ("SYSRCM", "MISTAKE") ! data item "MISTAKE" does not exist

......

• If the common block data is of float or double type in lcmread(), long-type conversionmay cause the data to overflow. In this case, the return value becomes the maximumvalue of the same sign.

10th Edition : Dec.18,2003-00

H1-156

IM 33S01B30-01E

<H1.6 Process Management>

■ Writing Common Block DataUse the built-in function cmwrite() to write common block data.

• Simple variable cmwrite (<common block name>, <data item name>, <data>)• One-dimensional array element cmwrite (<common block name>, <data item name>, <1-dim. subscript>, <data>)• Two-dimensional array element cmwrite (<common block name>, <data item name>, <1-dim. subscript>, <2-dim. subscript>,<data>)

<common block name> Specify the common block name using a character-string variable or character-string constant. Use uppercase letters for the common block name. <data item name> Specify the data item name using a character-string variable or character-string constant. Use uppercase letters for the data item name. <1-dim., 2-dim. subscript> Specify the array subscript(s) using a variable or constant. <data> Specify the data to be set as common block data using a variable or constant.

H010603E.EPS

cmwrite() sets <data> as common block data. If the type of the <data> specified as anargument of the built-in function is different from that of the common block data, <data> isconverted to the type of the common block data. However, if <data> is of numeric type andthe common block data is of character-string type, or if <data> is of character-string typeand the common block data is of numeric type, a run-time error occurs and data will not beset.

Table Setting Common Block Data

H010604E.EPS

Function name Type Return value at normal execution Return value at error

cmwrite integer 0 -1

10th Edition : Dec.18,2003-00

H1-157

IM 33S01B30-01E

<H1.6 Process Management>

H1.6.2 Manipulating Unit RecipesOperations started from a unit recipe can manipulate the unit recipes using built-infunctions. This section explains the manipulation of unit recipes using built-infunctions.

The operation started from a unit recipe can perform the following manipulation tothe unit recipe.

• Dynamic assignment of units

• Download

• Start

• Abort

• Complete

• Cancel

10th Edition : Dec.18,2003-00

H1-158

IM 33S01B30-01E

<H1.6 Process Management>

■ Manipulating Unit Recipes

Table Unit Recipe Functions that Can be Manipulated from Operations

Function Change in unit recipe status Manipulation method

Dynamic assignment of units NOASSIGN→ASSIGNED urassign built-in function

Download ASSIGNED→READY urload built-in function

Start READY→ACTIVE Set “START” (*2) in SYSPCMnn.STATUS (*1).

Abort

NOASSIGN→ABORTEDASSIGNED→ABORTEDREADY→ABORTEDACTIVE→ABORTEDLOG→ABORTED

Set “ABORT” in SYSPCMnn.STATUS.

CompleteNOASSIGN→COMPLETEASSIGNED→COMPLETEREADY→COMPLETE

Set “END” in SYSPCMnn.STATUS.

Cancel ASSIGNED→NOASSIGNREADY→NOASSIGN Set “CANCEL” in SYSPCMnn.STATUS.

H010605E.EPS

*1: SYSPCMnn is a system-fixed common block for each unit recipe. nn indicates the unit recipe number. If nn is a single-digit value, add “0” as in “SYSPCM01” and “SYSPCM02.”

*2: “START,” “ABORT,” “END” and “CANCEL” are status change directives.

The diagram below shows the transition of unit recipe statuses:

Unit assign

NOASSIGN ASSIGNED

Download

Cancel Abort

AbortAbort

Abort

Abort

READY

Start

CompleteComplete Complete

ACTIVE

ABORTED

LOG COMPLETE

Cancel

H010606E.EPS

Figure Unit Recipe Statuses

14th Edition : Dec.26,2006-00

H1-159

IM 33S01B30-01E

<H1.6 Process Management>

■ Dynamic Assignment of Units and Download Operationsurassign() assigns a unit recipe to a unit instrument at run time. urload() downloads a unitrecipe for which a unit instrument has already been assigned, from the HIS to the controlstation.

urassign (<unit recipe number>, <unit name>)urload (<unit recipe number>)

<unit recipe number> Specify the unit recipe number using a variable or constant. <unit name> Specify the unit instrument tag name using a character-string variable or character-string constant. Use uppercase letters for the unit name.

H010607E.EPS

Table Manipulating Unit Recipes

Function name Type Return value at normal execution

Return value aterror

urassign

Function

Dynamic assignment of units integer 0 -1

H010608E.EPS

urload Download integer 0 -1

The dynamic assignment of unit using urassignbid() can be performed for a unit recipe onlywhen the status of the unit recipe is either NOASSIGN, ASSIGNED or READY.

The operation and monitoring functions will generate a system error when the dynamicassignment fails. The main cause of system alarms are shown below:

• The status of the specified unit recipe is neither NOASSIGN, ASSIGNED nor READY.

The downloading of unit using urloadbid() can be performed for a unit recipe only when thestatus of the unit recipe is ASSIGNED.

The operation and monitoring functions will generate a system error when the downloadingfails. The main causes of system alarms are shown below:

• The specified batch ID does not exist.

• The status of the specified unit recipe is not ASSIGNED.

10th Edition : Dec.18,2003-00

H1-160

IM 33S01B30-01E

<H1.6 Process Management>

An example of assigning a unit to the unit recipe of unit recipe number 3 dynamically, thendownloading and starting the unit recipe, is shown below:

! SEBOL steps for SFC block

! unit recipe number 3 is assumed to have been set in the global variable

"partno"

! tag name of the unit instrument to be assigned is assumed to have been set in

the global variable "unittag"

char*8 comblk ! variable to store the common block name

*

* --- sets the system-fixed common block name "SYSPCM03" in "comblk" ---

*

format "SYSPCM%02d",partno;comblk

*

* --- checks whether or not the unit recipe status is NOASSIGN ---

*

if (ccmread (comblk,"STATUS")<>"NOASSIGN") then

message "Cannot be assigned since the status is not NOASSIGN."

quit

end if

*

* --- assigns the unit recipe to a unit instrument with the tag name "unittag" ---

*

if (urassign (partno,unittag) <> 0) then

message "urassign generated an error."

quit

end if

*

* --- confirms that the unit recipe has been assigned ---

* --- common block data UNITNAME becomes the specified unit instrument tag ---

*

wait until (ccmread(comblk,"STATUS") == "ASSIGNED" and \

ccmread (comblk,"UNITNAME") == unittag);time 300,error ASGNERR

*

* --- downloads the unit recipe ---

*

if (urlord (pratno) <> 0) then

message "urload generated an error."

quit

end if

***continued to the next page***

10th Edition : Dec.18,2003-00

H1-161

IM 33S01B30-01E

<H1.6 Process Management>

***continued from the previous page***

*

* --- confirms that the unit recipe status changes to READY ---

*

wait until (ccmread (comblk,"STATUS") == "READY" );time 300,error LOADERR

*

* --- starts the unit recipe ---

*

if (cmwrite (comblk,"STATUS","START") <> 0) then

message "Setting of START generated an error."

quit

end if

*

* --- confirms that the unit recipe status changes to START ---

*

wait until (ccmread (comblk,"STATUS") == "ACTIVE");time 30,error STRTERR

• If the started unit recipe is to end shortly, its status will also change from

• ACTIVE to LOG (and to COMPLETE) at the same time; therefore, consider the

• possibility of status change to LOG or COMPLETE.

*processing continues following the start

......

quit ! ends the step

* ----------- error handling -----------

ASGNERR:

message "Does not change to ASSIGNED even 300 seconds after the assignment."

quit

LOADERR:

message "Does not change to READY even 300 seconds after the load."

quit

STETERR:

message "Does not change to ACTIVE even 30 seconds after the start."

quit

! end of SEBOL steps

10th Edition : Dec.18,2003-00

H1-162

IM 33S01B30-01E

<H1.6 Process Management>

■ Start, Delete and Cancel OperationsTo perform start, delete or cancel operation, set a character string for the correspondingstatus change directive using cmwrite(), in the common block status of the system-fixedcommon block for each recipe.

When a directive for manipulating a unit recipe using the built-in function urassign(),urload() or cmwrite() ends without generating an error, it means the process managementfunctions acknowledged the directive. It does not mean the operation has been completed.

If necessary, the user may be required to reference the common block data status usingccmread() after the directive has been executed, and check if the operation with respect tothe unit recipe has been completed.

■ Aborting the Unit RecipeThere are three methods by which to abort a unit recipe as explained below:

● Changing the Unit Instrument Status to “END”

A unit recipe can be aborted by setting a directive that changes the unit instrument’s blockstatus to END in the unit instrument’s data item BSTS.

With this method, preprocessing and post-processing for the status change is performedfor the operation currently executed by the unit supervision. The unit instrument’s BSTSchanges to “END” when the status change directive is set in the BSTS.

When the unit recipe has been aborted, the status of the SYSPCMnn common blockchanges to COMPLETE.

The user should use this method to stop the unit recipe operation if the execution of prepro-cessing and post-processing for the status change are needed.

● Setting “ABORT” in the Unit Instrument’s BSTS

A unit recipe can be aborted by setting the status change directive ABORT in the unitinstrument’s data item BSTS. At this time, the block status of the unit changes toABORTED.

With this method, preprocessing and post-processing for the status change are not carriedout for the operation currently executed by the unit. Since the ABORT directive executesforcible termination, the unit instrument is aborted when ABORT is set in the unitinstrument’s BSTS.

When the unit recipe has been aborted, the status of the SYSPCMnn common blockchanges to ABORT.

● Setting “ABORT” in the Status of the SYSPCMnn Common Block

A unit recipe can be aborted by setting ABORT in the common block data status of thesystem-fixed common block SYSPCMnn (nn is the unit recipe number). At this time, thecommon block SYSPCMnn status changes to ABORTED. The block status of the unitinstrument also changes to ABORTED.

With this method, preprocessing and post-processing for the status change are not carriedout for the operation currently executed by the unit supervision. Also, the unit instrument isaborted not when ABORT is set in the common block data status but when the unit instru-ment is executed according to the set order after the setting of ABORT.

10th Edition : Dec.18,2003-00

H1-163

IM 33S01B30-01E

<H1.6 Process Management>

H1.6.3 Reserving RecipesOperations started from a unit recipe can reserve master recipes (or perform recipesetup) using built-in functions.

■ Recipe SetupUse the built-in function rpreserve() to reserve master recipes. rpreserve() enables auto-matic reservation or repeated reservation for the next batch.

rpreserve (<recipe group number>, <master recipe name>, <batch ID>, <train>

<recipe group number> Specify the recipe group number using a variable or constant. <master recipe name> Specify the master recipe name using a character-string variable or character-string constant. Use uppercase letters for the master recipe name. <batch ID> Specify the batch ID using a character-string variable or character-string constant. Use uppercase letters for the batch ID. When the ID system assignment function is used, specify a null character string (character string of length 0). <train> Train can be specified with a character variable or a character constant. The name of the train should be in upper case. If the train is not designated, a null (zero length string) will be set.

H010609E.EPS

Table Recipe Setup

H010610E.EPS

Function name Type Return value at normal execution Return value at error

rpreserve integer 0 -1

When rpreserve() is executed, a request for recipe setup is output to the HIS. The HISreserve the recipe and create a control recipe. The status of the control recipe becomes“RESERVED.”

H010611E.EPS

HIS

Reserve

Request for recipe setup

RESERVED

Execute rpreserve( )FCS

Master recipe

Control recipe

Process management

Figure Recipe Setup

10th Edition : Dec.18,2003-00

H1-164

IM 33S01B30-01E

<H1.6 Process Management>

• rpreserve() being executed without generating an error means that the request forrecipe setup was output to the process management of the HIS. It does not mean therecipe setup has been completed. For example, rpreserve() does not cause an erroreven when a master recipe name that does not exist is specified.

• When the recipe setup fails, a system alarm occurs. The main causes of systemalarms are shown below:

The specified recipe group number or master recipe does not exist.The specified batch ID already exists in the same recipe group.The specified train name does not exist.The batch ID cannot be uniquely determined by the batch ID systemauto-assignment function set in the Process Management Builder.The maximum number of reserved control recipes has been exceeded.

• The name of the unit that executes the unit recipe of unit recipe number 1 should bespecified in advance in the equipment requirements or train definition for the masterrecipe. The dynamic assignment of units (“-”) cannot be used. If the unit name is notdefined, the recipe setup fails and a system alarm occurs. The dynamic assignment ofunits (“-”) can be used for the unit names of unit recipes of unit recipe numbers 2 andgreater.

• To automatically start the recipe operation, change the download mode of the recipeto “AUT.” To enable downloading via manipulation by the operator, specify “MAN.”

• Reservation using rpreserve() does not allow setting of charge quantities or otherparameters during recipe setup. The formula specified in the recipe data setup panelof the recipe builder is used.

• When a null character string is specified for batch ID, a batch ID is determined auto-matically by the specified batch ID system assignment method set in the ProcessManagement Builder. If a null character string is specified for batch ID when the batchID system assignment is not specified, a system alarm occurs.

• When the batch ID system assignment is specified in the Process ManagementBuilder, specifying a batch ID using rpreserve() causes the batch ID precedence to begiven to that specified in rpreserve().

• If the HIS for the server of the recipe group does not exist, recipe setup is not ex-ecuted. In this case, no system alarm is generated.

• If there are multiple mater recipes with the same name within a recipe group, themaster recipe with the smallest number is set up.

10th Edition : Dec.18,2003-00

H1-165

IM 33S01B30-01E

<H1.6 Process Management>

An example of using rpreserve() to reserve a control recipe from the master recipeRECIPE-3 and executing it repeatedly with the unit instrument UNIT301 is shown below.This example assumes the following definitions:

• The recipe contains only one unit recipe.

• The recipe group number is 2.

• The name of the unit that executes the unit recipe of unit recipe number 1 is specifiedas UNIT301 in the equipment requirements for the master recipe.

• The download mode of recipe for the master recipe is “AUT.”

• The batch ID is set as BATCH301-nnn, where nnn is determined by the unit instru-ment data COUNT.

• The train name is not defined.

H010612E.EPS

HIS

DownloadRequest for recipe setup

Recipe setup

FCS

UNIT301

J01

J01

11

2

4

3

Initialization

Control recipe

Process management

Mater recipeRECIPE-3

Monitoring operation

Charge

11

2

Initialization

Reservation

Heating

Cleaning

Figure Repeated Execution

10th Edition : Dec.18,2003-00

H1-166

IM 33S01B30-01E

<H1.6 Process Management>

The “reservation” phase of the monitoring operation issues a request for recipe setup whenthe block status of the current unit instrument changes to END. The block status of the unitinstrument remains RUNNING while the unit recipe is being executed. When the unitinstrument execution completes successfully, the block status of the unit changes to END.

The control recipe is reserved and executed with a new batch ID:

* --- "reservation" phase of the monitoring operation ---

char*16 bchid

char*16 recipe

long ierr

*

* --- waits for the current unit instrument to become END ---

*

wait until (%%.BSTS=="END")

* --- batch ID ---

*

if (%%.COUNT =< 0 OR %%.COUNT >= 100) then

%%.COUNT = 1

else

%%.COUNT = %%.COUNT + 1

end if

format "BATCH301-%03d",%%.COUNT;bchid

recipe = "RECIPE-3"

*

* --- recipe setup ---

*

if (rpreserve (2,recipe,bchid,"") <> 0) then

message "Reservation error; recipe = %s, batch ID = %s",recipe,bchid

%%.BSTS = "ABORT" ! aborts the current unit instrument

quit

end if

*

* --- confirms the start of execution ---

*

wait until (%%.BSTS == "RUNNING" AND %%.BATCHID ==bchid) ;ierr ;time 300

if (ierr <> 0) then

message "Execution does not start even after 300 seconds; recipe = %s, batch ID

= %s (BATCHID = %s)",\

recipe,bchid,%%.BATCHID

%%.BSTS = "ABORT" ! aborts the current unit instrument

quit

end if

quit

10th Edition : Dec.18,2003-00

H1-167

IM 33S01B30-01E

<H1.6 Process Management>

H1.6.4 Built-In Functions with Batch IDThe following explains how to access common block data and how to manipulateunit recipes using built-in functions with batch ID specification. In the unit monitor-ing operation, the built-in functions lcmread(), dcmread(), ccmread(), cmwrite(),urload() and urassign() cannot be used.

■ Reading Common Block Data (Batch ID Specification)Use the built-in functions lcmreadbid(), dcmreadbid() and ccmreadbid() to read commonblock data with batch ID specification. The built-in functions lcmreadbid(), dcmreadbid()and ccmreadbid() behave in the same manner as lcmread(), dcmread() and ccmread()except that the batch ID and recipe group number are specified for the first three.

• Simple variable lcmreadbid (<recipe group number>, <batch ID>, <common block name>, <data item name>) dcmreadbid (<recipe group number>, <batch ID>, <common block name>, <data item name>) ccmreadbid (<recipe group number>, <batch ID>, <common block name>, <data item name>)• One-dimensional array element lcmreadbid (<recipe group number>, <batch ID>, <common block name>, <data item name>, <1-dim. subscript>) dcmreadbid (<recipe group number>, <batch ID>, <common block name>, <data item name>, <1-dim. subscript>) ccmreadbid (<recipe group number>, <batch ID>, <common block name>, <data item name>, <1-dim. subscript>)• Two-dimensional array element lcmreadbid (<recipe group number>, <batch ID>, <common block name>, <data item name>, <1-dim. subscript>, <2-dim. subscript>) dcmreadbid (<recipe group number>, <batch ID>, <common block name>, <data item name>, <1-dim. subscript>, <2-dim. subscript>) ccmreadbid (<recipe group number>, <batch ID>, <common block name>, <data item name>, <1-dim. subscript>, <2-dim. subscript>) <recipe group number> Specify the recipe group number using a variable or constant. <batch ID> Specify the batch ID using a character-string variable or character-string constant. Use uppercase letters for the batch ID. <common block name> Specify the common block name using a character-string variable or character-string constant. Use uppercase letters for the common block name. <data item name> Specify the data item name using a character-string variable or character-string constant. Use uppercase letters for the data item name. <1-dim., 2-dim. subscript> Specify the array subscript(s) using a variable or constant. An expression comprising two or more terms such as “i + 1” cannot be specified.

H010613E.EPS

10th Edition : Dec.18,2003-00

H1-168

IM 33S01B30-01E

<H1.6 Process Management>

lcmreadbid() is a built-in function of long type, dcmreadbid() of double type andccmreadbid() of char*n type.

To read numeric data from a common block, use lcmreadbid() or dcmreadbid(). If the typeof the common block data is different from that of the built-in function, the common blockdata is converted to the type of the built-in function.

It is recommended that lcmreadbid() be used when reading integer-type and long-typecommon block data, while dcmreadbid() be used when reading float-type and double-typecommon block data.

Use ccmreadbid() when reading character-string type common block data.

Table Reading Common Block Data

H010614E.EPS

Function name Type Return value at normal execution

lcmreadbid long Common block data other than of long type are converted to long type.

dcmreadbid double Common block data other than of double type are converted to double type.

ccmreadbid char*n A character string of the string length of the common block data will be returned.

10th Edition : Dec.18,2003-00

H1-169

IM 33S01B30-01E

<H1.6 Process Management>

■ Writing Common Block Data (Batch ID Specification)Use the built-in function cmwritebid() to write common block data with batch ID specifica-tion. The built-in function cmwritebid() behaves in the same manner as cmwrite() exceptthat the batch ID and recipe group number are specified for the former.

• Simple variable cmwritebid (<recipe group number>, <batch ID>, <common block name>, <data item name>, <data>)• One-dimensional array element cmwritebid (<recipe group number>, <batch ID>, <common block name>, <data item name>, <1-dim. subscript>, <data>)• Two-dimensional array element cmwritebid (<recipe group number>, <batch ID>, <common block name>, <data item name>, <1-dim. subscript>, <2-dim. subscript>, <data>) <recipe group number> Specify the recipe group number using a variable or constant. <batch ID> Specify the batch ID using a character-string variable or character-string constant. Use uppercase letters for the batch ID. <common block name> Specify the common block name using a character-string variable or character-string constant. Use uppercase letters for the common block name. <data item name> Specify the data item name using a character-string variable or character-string constant. Use uppercase letters for the data item name. <1-dim., 2-dim. subscript> Specify the array subscript(s) using a variable or constant. <data> Specify the data to be set as common block data using a variable or constant.

H010615E.EPS

cmwritebid() sets <data> as common block data. If the type of the <data> specified as anargument of the built-in function is different from that of the common block data, <data> isconverted to the type of the common block data. However, if <data> is of numeric type andthe common block data is of character-string type, or if <data> is of character-string typeand the common block data is of numeric type, a run-time error occurs and data will not beset.

Table Setting Common Block Data

H010616E.EPS

Function name Type Return value at normal execution Return value at error

cmwritebid integer 0 -1

10th Edition : Dec.18,2003-00

H1-170

IM 33S01B30-01E

<H1.6 Process Management>

■ Conditions for Accessing Common Block DataThe following explains the conditions that must be met before common block data can beaccessed using the built-in functions lcmreadbid(), dcmreadbid(), ccmreadbid() andcmwritebid() with batch ID specification. Common block data can be accessed if either ofthe following two conditions is met:

• Condition (A)In the FCS where the common block data is downloaded, the data can be accessed ifthe recipe status is either READY or ACTIVE.

• Condition (B)In the FCS where the common block data is not downloaded, the data can be ac-cessed if there is a unit recipe of the specified batch ID within the FCS and if the statusof the unit recipe is either READY or ACTIVE. If one of the unit recipes in a recipe isREADY or ACTIVE, the recipe status will be READY or ACTIVE.

In the FCS that satisfies either of the two conditions above, common block data can beaccessed from any SFC block or operation by specifying a batch ID.

Access is also possible from an SFC block started independently or from an operation notrelated to the recipe.

10th Edition : Dec.18,2003-00

H1-171

IM 33S01B30-01E

<H1.6 Process Management>

An example of a recipe comprising two unit recipes is shown below. Unit Recipe 1 is ex-ecuted by the unit instrument UNIT101 at FCS 1. Unit Recipe 2 is executed by the unitinstrument UNIT201 at FCS 2. The common block data is downloaded to FCS 1 in whichUnit Recipe 1 exists.

Control Station 1 satisfies Condition (A). At FCS 1, the common block data can be ac-cessed using a built-in function with batch ID specification if the recipe status is eitherREADY or ACTIVE.

FCS 2 satisfies Condition (B). At FCS 2, the common block data can be accessed using abuilt-in function with batch ID specification only while the unit recipe status of Unit Recipe 2is either READY or ACTIVE

H010617E.EPS

Common block data

Unit Recipe 1

Unit Recipe 2

Recipe

UNIT201UNIT101

Download

Download

Download

Unit Recipe 2

Common block data

Note: The common block data must be downloaded to the unit recipe 1 and the same FCS.

Unit Recipe 1

Accessible

FCS1 FCS2

Figure Conditions for Accessing Common Block Data

10th Edition : Dec.18,2003-00

H1-172

IM 33S01B30-01E

<H1.6 Process Management>

While a unit recipe is being executed by a unit instrument, the monitoring operation thatbelongs to that unit can obtain a batch ID and recipe group number from the unit instrumentdata items BATCHID and RECIPEGR and access common block data using a built-infunction with batch ID specification.

While a unit recipe is being executed, the executing unit instrument data items BATCHIDand RECIPEGR store the corresponding batch ID and recipe group number.

• Unless the unit instrument data item BATCHID contains a null character string (char-acter string of length 0), the unit instrument is executing a unit recipe. The data itemsBATCHID and RECIPEGR store the corresponding batch ID and recipe group num-ber.

• If the unit instrument data item BATCHID contains a null character string, the unit isnot executing a unit recipe.

The following example shows how a monitoring operation obtains the batch ID and recipegroup number from the unit instrument data items BATCHID and RECIPEGR and readUser Code 1 (USER1) and User Code 2 (USER2) from the system-fixed common blockSYSRCM:

integer grp_no ! variable that stores the recipe group number

char*16 batch_id ! variable that stores the batch ID

char*16 user1 ! variable that stores User Code 1

char*16 user1 ! variable that stores User Code 2

if (%%.BATCHID == " ") then

! processing when no unit recipe is being executed

......

else

grp_no = %%.RECIPEGR ! obtains the recipe group number

batch_id = %%.BATCHID ! obtains the batch ID

! "SYSRCM" is a system-fixed common block name

user1 = 1cmreadbid (grp_no,batch_id,"SYSRCM","USER1")

user2 = 1cmreadbid (grp_no,batch_id,"SYSRCM","USER2")

......

end if

......

10th Edition : Dec.18,2003-00

H1-173

IM 33S01B30-01E

<H1.6 Process Management>

■ Manipulating Unit Recipes (Batch ID Specification)Unit recipes can be manipulated using built-in functions with batch ID specification.

urassignbid() assigns a unit recipe to a unit instrument. The urassignbid() behaves in thesame manner as urassign() except that the batch ID and recipe group number are specifiedfor the former.

urloadbid() downloads a unit recipe already assigned to a unit instrument, from the HIS tothe control station. The urloadbid() behaves in the same manner as urload() except that thebatch ID and recipe group number are specified for the former.

urassignbid (<recipe group number>, <batch ID>, <unit recipe number>, <unit name>)urloadbid (<recipe group number>, <batch ID>, <unit recipe number>) <recipe group number> Specify the recipe group number using a variable or constant. <batch ID> Specify the batch ID using a character-string variable or character-string constant. Use uppercase letters for the batch ID. <unit recipe number> Specify the unit recipe number using a variable or constant. <unit name> Specify the unit instrument tag name using a character-string variable or character-string constant. Use uppercase letters for the unit name.

H010618E.EPS

Table Manipulating Unit Recipes

Function name Type Return value at normal execution

Return value aterror

urassignbid

Manipulating recipe

Dynamic assignment of units integer 0 -1

H010619E.EPS

urloadbid Download integer 0 -1

10th Edition : Dec.18,2003-00

H1-174

IM 33S01B30-01E

<H1.6 Process Management>

Executing urassignbid() or urloadbid() to manipulate a unit recipe and the built-in functionbeing completed without generating an error means the process management functionsacknowledged the manipulation directive. It does not mean the operation has been com-pleted. For example, urassignbid() and urloadbid() do not generate an error even when abatch ID that does not exist is specified.

• The dynamic assignment of units can be performed for a unit recipe usingurassignbid() only while the status of the unit recipe is either NOASSIGN, ASSIGNEDor READY.

• When the dynamic assignment of units is performed for a unit recipe usingurassignbid(), the request message for dynamic assignment of units shows a blankspace instead of the recipe name.

• A system error occurs when the dynamic assignment of units fails. The main causesof system alarms are shown below:

The specified batch ID does not exist.The status of the specified unit recipe is neither NOASSIGN, ASSIGNED norREADY.

• The downloading of units can be performed for a unit recipe using urloadbid() onlywhile the status of the unit recipe is ASSIGNED.

• When downloading of units is performed for a unit recipe using urloadbid(), the re-quest message for unit recipe download shows a blank space instead of the recipename.

• A system error occurs when the download fails. The main causes of system alarmsare shown below:

The specified batch ID does not exist.The status of the specified unit recipe is not ASSIGNED.A sufficient area to which the unit recipe is downloaded cannot be allocated in theFCS.

A unit recipe can be started, aborted, deleted or canceled by setting a corresponding statuschange directive with cmwritebid() in the common block data status of the system-fixedcommon block for each unit recipe. However, when cmwritebid() has been executedwithout generating an error, it means that the manipulation directive was acknowledged bythe process management functions; it does not mean the operation has been completed.

10th Edition : Dec.18,2003-00

H1-175

IM 33S01B30-01E

<H1.7 Subsystem Communication>

H1.7 Subsystem Communication▼ Subsystem Communication

Communication I/O data can be exchanged between FCS and subsystems such as aprogrammable controller.

In SEBOL, statements for reading and writing communication I/O data are availableto exchange communication I/O data between subsystems and the FCS.

■ Statements Used for Communication with SubsystemsThe system will communicate with subsystems by accessing the communication I/O dataarea within the FCS based on the contents defined via the communication I/O definitionbuilder. The subsystem data area and communication I/O data area within FCS are equal-ized to make periodical communications possible.

There are three statements that are used for communication with subsystems:

• Reading subsystem data (“ssread” statement)

• Writing subsystem data (“sswrite” statement)

• Writing subsystem data bit-field (“sswritebit” statement)

ssread, sswrite

Write in bits

Communication I/O data range

Subsystem

H010701E.EPS

sswritebit

Read/Write in words

Figure Accessing by “ssread,” “sswrite,” and “sswritebit”

The “ssread” statement can read multiple data from continuous communication I/O areaswith a single statement. Further, the “sswrite” and “sswritebit” statements can write multipledata to continuous communication I/O areas with a single statement.

The “ssread,” “sswrite” and “sswritebit” statements cannot access data that extend inmultiple, non-continuous communication I/O areas with a single statement.

The data position within a block is determined by “relative position.”

Definitions of communication I/O data (communication I/O terminal number) and correlationto each data for the block are set on the Communication I/O definition builder.

10th Edition : Dec.18,2003-00

H1-176

IM 33S01B30-01E

<H1.7 Subsystem Communication>

■ Data status of Subsystem DataData status is available for each subsystem data block. As for bit position, the most signifi-cant bit (left-most) is 1, and the least significant bit (right-most) is 32. All bits other than 1,20 through 22 are always 0.

Table Bit Configuration of Data Status to Be Obtained

Bit type Symbol Name

1 BAD Invalid data status

20 NRDY PI/O not ready

21 PFAL PI/O power failure

22 LPFL PI/O prolonged power failureH010702E.EPS

If data status of subsystem data block is NRDY, “ssread” cannot read subsystem data. The“sswrite” statement and “sswritebit” statement cannot write data, either.

Table Data Status Combinations and Card Statuses

Data statusCard status Data use

BAD NRDY PFAL LPFL

0 0 0 0 Both card and subsystem communication are normal. Possible

0 1 0 0Card is normal, and communication with subsystem has notbeen completed.

Impossible

1 1 1 1Card is abnormal or communication with subsystem is abnormal.

Impossible

H010703E.EPS

The data status obtained by an “ssread” statement can be checked by the built-in function“dscheck()”.

SEE ALSO

For the usage of “dscheck(),” see the following:

H1.5.8, “Checking Data Status”

The following example shows how to check whether or not the read data is usable. Todetermine whether the data read by an “ssread” statement is usable, check the data statusNRDY. In the example below, the data status returned to the local variable “ds” by “ssread”statement is checked by the built-in function “dscheck()”.

long ds

integer i1, i2, i3

ssread 1, 1, 10, 0; ds; i1:integer, i2:integer, i3:integer

if (dscheck(ds, "NRDY") <> 0) then

! processing when data status is NRDY.

! data read into i1, i2 and i3 cannot be used.

......

end if

......

10th Edition : Dec.18,2003-00

H1-177

IM 33S01B30-01E

<H1.7 Subsystem Communication>

H1.7.1 Reading Subsystem DataThe “ssread” statement reads subsystem data from the communication I/O dataarea in the FCS.

■ Format of “ssread” Statement

ssread <line number>, <card number>, <access number>, <relative position> [, <option>] ;<data status storage variable> ;<data storage variable> : <data type> [,<data storage variable> : <data type>...] [;<error variable>] [;error/errorsub<label>[,<error identifier>] ]

<line number> Always designate 1.

<card number> Always designate 1.

<access number> Always designate 1.

<relative position> Designate the %WW number for data to be read.

<option> Express with a 32-bit integer. If $00000001 is designated as the option, the "ssread" statement generates a run-time error when the data status is "data value invalid" (BAD). If an option is not designated, the "ssread" statement terminates normally even if the data status is invalid (BAD).

<data status storage variable> Designate a long integer type variable for storing data.

<data storage variable> Designate a local variable for storing data.Simple variables, array variables and arrays can be designated.

<data type> Designate a data type specified via the Communication I/O Builder.

<error variable> Designate a local variable to which the error code is stored when an error occurs.

<label> Designate the branching destination at the time an error occurs.

<error identifier> Designate a variable or a constant to identify where the error was generated in the error handling section.

H010704E.EPS

10th Edition : Dec.18,2003-00

H1-178

IM 33S01B30-01E

<H1.7 Subsystem Communication>

• The “ssread” statement retrieves data in the <data type> from the <relative position>and stores the data into its corresponding <data storage variable>. For <data storagevariable>:<data type>, a maximum of 32 combinations can be designated.

• If an <error variable> is designated, 0 will be set when operation is normal, and theerror code will be set when an error occurs.

• The branching destination when an error occurs can be designated by designating a<label>. Also, by adding an <error identifier>, the location where the error was gener-ated can be identified in the error handling section. In the error handling section, the<error identifier> value can be obtained using the built-in function.

SEE ALSO

For details of error handling, see the following:

H1.13, “Error Handling”

IMPORTANT

• When the “ssread” statement generates a subsystem communication execution error(error class code 500), data cannot be stored in any of the <data storage variables>.The <data storage variables> will remain the same value as before the execution ofthe “ssread” statement.

• When the data type in the read target is DI/DO, the data is read in a “no bit reversing”condition regardless of the bit reversing designation.

• For the error variable, designate one simple variable or array element. The entirearray cannot be designated. An error is not returned to the error variable in the“ssread” statement for each <data storage variable>:<data type> pair, but one errorcode is returned for each “ssread” statement.

Types of data to be read by “ssread” statement and shown as follows.

• integer: 16-bit integer data

• uinteger: 16-bit unsigned integer data

• long: 32-bit integer data

• ulong: 32-bit unsigned integer data

• float: 32-bit floating point data

• char4: 4 byte (2 word) character

• char8: 8 byte (4 word) character

• char16: 16 byte (8 word) character

• char32: 32 byte (16 word) character

10th Edition : Dec.18,2003-00

H1-179

IM 33S01B30-01E

<H1.7 Subsystem Communication>

H1.7.2 Writing Subsystem DataThe “sswrite” statement writes data in word units to a subsystem. The “sswrite”statement is terminated normally when write is performed properly with respect tothe I/O image of the subsystem in the FCS.

■ Format of a “sswrite” Statement

sswrite <line number>, <card number>, <access number>, <relative position> [,<option>] ; <variable> : <data type> [,<variable> : <data type> . . . ] [;<error variable>] [;error/errorsub <label> [,<error identifier>] ]

<line number> Always designate 1.

<card number> Always designate 1.

<access number> Always designate 1.

<relative position> Designate the %WW number for data to be written.

<option> Not used.

<variable> Designate a local variable for storing data. Simple variables, array variables and entire arrays can be designated.

<data type> Designate a data type specified via the Communication I/O Builder.

<error variable> Designate a local variable to which the error code is stored when an error occurs.

<label> Designate the branching destination at the time an error occurs.

<error identifier> Designate a variable or a constant to identify where the error was generated in the error handling section.

H010705E.EPS

• The “sswrite” statement converts a SEBOL <variable> to a <data type> and writes thisto communication I/O data determined by the <relative position>. For <data storagevariable>:<data type>, a maximum of 32 combinations can be designated.

• If an <error variable> is designated, 0 will be set when operation is normal, and theerror code will be set when an error occurs.

• The branching destination when an error occurs can be designated by designating a<label>. Also, by adding an <error identifier>, the location where the error was gener-ated can be identified in the error handling section. In the error handling section, the<error identifier> value can be obtained using the built-in function.

SEE ALSO

For details of error handling, see the following:

H1.13, “Error Handling”

10th Edition : Dec.18,2003-00

H1-180

IM 33S01B30-01E

<H1.7 Subsystem Communication>

IMPORTANT

• Data can only be written to a destination where the data type is DO or AO**. Datacannot be written to the data types DI or AI**.

• If the “sswrite” statement generates a communication I/O execution error (error classcode 500), no data at all can be written. The communication I/O data will retain thesame value as before the “sswrite” statement was executed.

• When the data type of the write destination is DO, the value of the <variable> will beset as is, regardless of whether there is a bit reversing designation.

• For the error variable, designate one simple variable or array element. The entirearray cannot be designated. An error is not returned to the error variable in the“ssread” statement for each <data storage variable>:<data type> pair, but one errorcode is returned for each “ssread” statement.

10th Edition : Dec.18,2003-00

H1-181

IM 33S01B30-01E

<H1.7 Subsystem Communication>

H1.7.3 Writing to a Subsystem Data Bit FieldThe “sswritebit” statement writes to a bit field. The “sswritebit” statement is termi-nated normally when write is performed properly with respect to the I/O image of thesubsystem in the FCS.

■ Format of the “sswritebit” Statement

sswritebit <line number>, <card number>, <access number>, <relative position> [,<option>] ;<bit position>, <number of bits>, <bit field data> [;<error variable>] [;error/errorsub <label> [,<error identifier>] ]

<line number> Always designate 1.

<card number> Always designate 1.

<access number> Always designate 1.

<relative position> Designate the %WW number for data to be read. Designate within the range of 0 to 127.

<option> Not used.

<bit position> Designate the position of the bit from the most significant bit using an integer-type constant or variable (1 to 16). The most significant bit (left-most) is 1 and the least significant bit (right-most) is 16.

<number of bits> Designate the number of bits to be written using an integer-type constant or variable.

<bit field data> Designate an integer-type constant or variable in which the data to be written is filled in from the right.

<error variable> Designate a local variable to which the error code is stored when an error occurs.

<label> Designate the branching destination at the time an error occurs.

<error identifier> Designate a variable or a constant to identify where the error was generated in the error handling section.

H010706E.EPS

10th Edition : Dec.18,2003-00

H1-182

IM 33S01B30-01E

<H1.7 Subsystem Communication>

• The “sswritebit” statement treats the communication I/O data determined by the<relative position> as 32-bit integer data and writes the data in the designated bit field.Only the number of <bit field data> specified in <number of bits> is written, startingfrom the <bit position> number counted from the most significant bit. Any portion otherthan the designated bit field retains the same value as before the “sswritebit” state-ment was executed.

1 32

MSB LSB

1 n

1 32

1 2 n

2

m m+n-1

H010707E.EPS

SEBOL <bit field data>

Data to be written in the subsystem ......

......

Figure Writing Bit Field Data

• If an <error variable> is designated, 0 will be set when operation is normal, and theerror code will be set when an error occurs.

• The branching destination when an error occurs can be designated by designating a<label>. Also, by adding an <error identifier>, the location where the error was gener-ated can be identified in the error handling section. In the error handling section, the<error identifier> value can be obtained using the built-in function.

SEE ALSO

For details of error handling, see the following:

H1.13, “Error Handling”

IMPORTANT

• Data can only be written when the data type of the write destination is DO or AO**.

• Designate an integer from 1 to 32 for <number of bits>. An error occurs if a valuelarger than 32 or a negative value is designated. If 0 is designated, an error does notoccur but data will not be written.

• Care should be taken when the data type of the write destination is DO, since thevalue of the <variable> will be written as is regardless of whether there is a bit revers-ing designation.

• For <relative position>, designate a multiple of 2 (4 byte boundary).

• An error occurs if the total of the <bit position> and <number of bits> greater than orequal to 33.

10th Edition : Dec.18,2003-00

H1-183

IM 33S01B30-01E

<H1.7 Subsystem Communication>

H1.7.4 Communication Examples with a SubsystemThis section gives an example of communication I/O configuration and SEBOLsample programs for accessing the communication I/O data.

■ An Example of Communication IOM Builder DefinitionAn Example of Communication IOM Builder definition is shown as follows

Table An Example of Communication IOM Builder Definition

Element Number Buffer Size Data Size Station

NumberDevice &Address Data Type

%WW0001 4 4 1 TI001 Analog Input (16-bit, Signed Integer)

%WW0002 * * * * *

%WW0003 * * * * *

%WW0004 * * * * *

%WW0033 8 4 1 D0001 Analog Input (32-bit, Signed Integer)

%WW0034 * * * * *

%WW0035 * * * * *

%WW0036 * * * * *

%WW0037 * 4 1 D0005 Analog Input (32-bit, Floating-point)

%WW0038 * * * * *

%WW0039 * * * * *

%WW0040 * * * * *

%WW0048 4 4 1 TS001 Analog Output (16-bit, Signed Integer)

%WW0049 * * * * *

%WW0050 * * * * *

%WW0051 * * * * *

%WW0052 * * * * *

H010708E.EPS

10th Edition : Dec.18,2003-00

H1-184

IM 33S01B30-01E

<H1.7 Subsystem Communication>

■ Sample Programs for Accessing Communication I/O DataSample programs for communication I/O data is shown as follows.

● Sample Program 1

A sample program to read 2 data start from relative address 1 (%WW0001)

! sample program 1

integer data1, data2

long dSts

ssread 1, 1, 1, 1 ; dSts ; data1:integer, data2:integer

......

end

● Sample Program 2

A sample program to read 4 data start from relative address 33 (%WW0033)

! sample program 2

long n1, n2

float f1, f2

long dSts

ssread 1, 1, 1, 33 ; dSts ; n1:long, n2:long, f1:float, f2:float

......

end

● Sample Program 3

A sample program to write 4 data start from relative address 48 (%WW0048) when the dataare 10, 20, 30 and 40 is shown as follows. When write to all array elements (data[*]) isspecified, the data can be written to all array elements.

! sample program 3

integer data[4]

data[1] = 10

data[2] = 20

data[3] = 30

data[4] = 40

sswrite 1, 1, 1, 48; data[*]:integer

......

end

10th Edition : Dec.18,2003-00

H1-185

IM 33S01B30-01E

<H1.8 Program Control Statements>

H1.8 Program Control Statements▼ Program Control Statements

SEBOL has control statements to control the order of execution for programs.

■ Program Control StatementsSEBOL includes nine control statements as shown below:

• if

• for

• while

• repeat

• wait until

• switch

• goto

• delay

• delaycycle

10th Edition : Dec.18,2003-00

H1-186

IM 33S01B30-01E

<H1.8 Program Control Statements>

H1.8.1 ifThe “if” statement controls execution of the program according to the condition ofthe expression in the statement.

■ Usage of “if” Statement

(1) if (<expression>) <statement>(2) if (<expression>) then ...... [else ......] end if(3) if (<expression>) then ...... else if (<expression>) then ...... [else ......] end if <expression> A numeric expression. (<>0)...True When calculation result of <expression> is other than 0. (=0) ...False When calculation result of <expression> is 0 .<statement> A statement that is executed when <expression> is true.

H010801E.EPS

■ Action of “if” StatementThe “if” statement controls execution of the program according to the condition of the<expression> in the statement.

In format (1), the <expression> is calculated first. If the result is true, the <statement> isexecuted.

In format (2), the <expression> is calculated first. If the result is true, the statements en-tered between “then” and “else” is executed. If the result is false, the “else” clause is ex-ecuted.

In format (3), the <expression>s are successively evaluated, and if the result of one of the<expression>s is true, the statements following the “then” for that expression before the“else” statement are executed. If none of the <expression>s are true, the “else” clause isexecuted if it is present.

TIP

Branching out of an “if ~ end if” structure can be instructed using a “goto” statement, but branching into an“if ~ end if” structure is not allowed.

10th Edition : Dec.18,2003-00

H1-187

IM 33S01B30-01E

<H1.8 Program Control Statements>

■ Description Example of “if” StatementDescription examples of “if” statement are shown below.

● Example of Determining Local Variable A

integer function FUNC(A,MSG)

integer A,B

......

B = 0

if (A == 0) then

MSG = "RUN"

else if (A == 1) then

MSG = "STOP"

else

MSG = "ERROR"

B = 1

end if

......

return B

......

● Example of Branching Actions According to the Process Variable (PV)

In the following example, when the process values (PV) of counter (CT001) are 1, 2 and 3,SC001’s SV values are set to low speed, mid speed and high speed, respectively. In thisexample, if the process values (PV) are other than 1, 2 and 3, an operator guide messageis output and the SC001 SV value will be set to low speed.

block CTCT001

block PID SC001

......

if(CT001.PV == 1) then

[SC001.MODE.SV = "AUT",10] ! low-speed control.

else if (CT001.PV == 2) then

[SC001.MODE.SV = "AUT",50] ! mid-speed control.

else if (CT001.PV == 3) then

[SC001.MODE.SV = "AUT",100] ! high-speed control.

else

opeguide "%aRPM {rotation} setting abnormal",1 ! operator guide(red)

[SC001.MODE.SV = "AUT",10] ! low-speed control {Control}.

end if

......

10th Edition : Dec.18,2003-00

H1-188

IM 33S01B30-01E

<H1.8 Program Control Statements>

H1.8.2 forThe “for” statement repeatedly performs a series of statements between the “for”statement and “next” statement.

■ Usage of “for” Statement

for <variable> = <initial value> to <final value> [step <increment>] ......next

or

for <variable> = <initial value> to <final value> [step <increment>] ......next@

<variable> A numeric variable. Only local variables can be used.<initial value> Numeric type expressions which designates initial value of <variable>.<final value> Numeric type expressions which designates final value of <variable>.<increment> Numeric type expressions which designates increment of <variable>. The <increment> is assumed to be 1 when omitted. A negative value can be used as an increment.

H010802E.EPS

The “for to next” structure can be nested. In this case, the “next” statement is associatedwith the nearest “for” preceding the “for”. Each “for” statement must be concluded with a“next” of its own.

10th Edition : Dec.18,2003-00

H1-189

IM 33S01B30-01E

<H1.8 Program Control Statements>

■ Action of a “for” StatementThe “for” statement repeats execution of a series of statements between the “for” and“next” statements, with a delay of one scan period imposed following each “for...next” loopprocessing.

The delay after the loop can be cancelled using “next@” instead of “next” at the end of the“for” loop. In this case, the loop is repeatedly executed without delay.

The <variable> in the “for” statement is first set to the <initial value>. Actions thereafter varyaccording to the relationship of <increment>, <initial value> and <final value>.

● When <increment> is Positive and <initial value> is Equal to or Less than<final value>, or <increment> is Negative and <initial value> is Equal to orGreater than <final value>

Statements from the “for” statement to “next” statement are executed, and the value of the<variable> increments or decrements by the amount specified by <increment>. Next, the<variable> and the <final value> are compared. If the sign of the difference remains un-changed since the last comparison, the control returns to the statement following the “for”statement to iterate the same operation.

The <final value> and <increment> are calculated only once before the start of iteration.The <final value> and <increment> thus calculated are used until the control exits from theloop, instead of being recalculated for each iteration.

If the data type of the <initial value>, <increment>, or <final value> is not the same as thatof the <variable>, the data type is converted to the data type of <variable> before calcula-tion.

● When <increment> is Positive and <initial value> is Greater than <finalvalue>, or <increment> is Negative and <initial value> is Less than <finalvalue>

Lines from the “for” statement to “next” statement are never executed.

TIP

• Branching out of an “for to next” structure can be instructed using a “goto” statement, but branchinginto a “for to next” structure is not allowed.

• If <increment> of “for” statement is a numeric value with a decimal point, <final value> might not becalculated due to the calculation error in real number.

10th Edition : Dec.18,2003-00

H1-190

IM 33S01B30-01E

<H1.8 Program Control Statements>

■ Description Example of “for” StatementA description examples of “for” statement are shown below:

● Example of a Function to Obtain SM by Repeating the Loop N-Times

integer function SUM(N)

integer N,I,SM

......

SM = 0

for I = 1 to N step 1

SM = SM + 1

next@

return SM

......

● Example of Clearing Data of Local Variable Buffer IBUFF

integer IBUFF[50]

integer i

......

for i =1 to 50 ! cleared in ascending order

IBUFF[i] = 0

next@

......

for i =50 to 1 step -1 ! cleared in descending order

IBUFF[i] = 0

next@

......

10th Edition : Dec.18,2003-00

H1-191

IM 33S01B30-01E

<H1.8 Program Control Statements>

H1.8.3 whileIf the evaluated result of <expression> in a “while” statement is true, the system willexecute the statements between “while” statement and “wend” statement one byone before returning to the “while” statement.

■ Usage of “while” Statement

while (<expression>)......wend

or

while (<expression>)......wend@

<expression> A numeric expression (<>0)... True When calculation result of <expression> is other than 0. (=0)... False When calculation result of <expression> is 0.

H010803E.EPS

The “while to wend” structure can be nested. In this case, each “wend” statement is associ-ated with the nearest “while” preceding the “wend”. Each “while” statement must be con-cluded with a “wend” of its own.

■ “while” Statement ActionIf the evaluation result of <expression> in a “while” statement is true, the system will ex-ecute the statements between “while” statement and “wend” statement one by one beforereturning to the “while” statement. A delay of one scan period is imposed after each loopprocessing. This delay process is repeated until <expression> evaluation becomes false.When <expression> becomes false, the control moves to the “wend” statement.

If “wend@” is used, the loop is executed without delay after completion of processingbetween “while” and “wend.”

The result of first evaluation of <expression> of a “while” statement is false, statementsbetween the “while” and “wend” statements are never executed.

TIP

Branching out of an “while ~ wend” loop can be instructed using a “goto” statement, but branching into an“while ~ wend” structure is not allowed.

10th Edition : Dec.18,2003-00

H1-192

IM 33S01B30-01E

<H1.8 Program Control Statements>

■ Description Example of “while” StatementA description examples of “while” statement are shown below:

● Example of a Function to Increment SM by 1 as long as N is Greater than 0

integer function SUM1(N)

integer N,SM

......

SM = 0

while (N>0)

SM = SM + 1

N = N - 1

wend@

return SM

......

● Example of Checking Flow Amount Until Totalization is Completed andStops Control When Flow Rate Becomes Abnormal

block BSETU-2 FC001

......

while (FC001.SUM < FC001.BSET)

if (FC001.ALRM "NR") then

[FC001.SW = 3]

%.BSTS = "STOP" ! % is the present block

end if

wend

......

10th Edition : Dec.18,2003-00

H1-193

IM 33S01B30-01E

<H1.8 Program Control Statements>

H1.8.4 repeatAs long as the condition of <expression> in a “repeat” statement is false, the systemwill repeat execution of statements between “repeat” statement and “until” state-ment.

■ Usage of “repeat” Statement

repeat......until (<expression>)

or

repeat......until@ (<expression>)

<expression> A numeric expression (<>0)... True When calculation result of <expression> is other than 0. (=0)... False When calculation result of <expression> is 0.

H010804E.EPS

The “repeat to until” structure can be nested. In this case, each “until” statement is associ-ated with the nearest “repeat” preceding the “until”. Each “repeat” statement must beconcluded with an “until” of its own.

■ Action of “repeat” StatementAs long as the condition of <expression> in a “repeat” statement is false, the system willrepeat execution of statements between the “repeat” statement and “until” statement.

A delay of one scan period is imposed after each loop processing. The line following the“until” statement is executed when <expression> condition becomes true. Since conditiondetermination to escape from loop is executed at the end of each loop, statements be-tween the “repeat” and “until” are executed at least once. If “until@” is used, the loop isexecuted without delay after condition judgment.

TIP

Branching out of an “repeat to until” loop can be instructed using a “goto” statement, but branching into an“repeat ~ until” structure is not allowed.

10th Edition : Dec.18,2003-00

H1-194

IM 33S01B30-01E

<H1.8 Program Control Statements>

■ Description Example of “repeat” StatementDescription examples of “repeat” statement are shown below:

integer function SUM2(N)

integer N,SM

......

SM = 0

repeat

SM = SM + 1

N = N - 1

until@ (N<=0)

return SM

......

10th Edition : Dec.18,2003-00

H1-195

IM 33S01B30-01E

<H1.8 Program Control Statements>

H1.8.5 wait untilThe “wait until” statement continues checking until the <expression> value be-comes true. The check is executed once during each scan period.

■ Usage of “wait until” Statement

wait until (<expression>) [; <error variable>]

[; time <wait time> [, error <label> [, <error identifier>] ] ] errorsub error <label> [, <error identifier> errorsub

<expression> A numeric expression representing a condition (<>0)... True When calculation result of <expression> is other than 0. (=0)... False When calculation result of <expression> is 0.<wait time> Designate the maximum duration for check in seconds using an integer-type constant or variable.<error variable> Designate an integer local variable to which an error code is stored when the condition expression is not satisfied or an error occurs. 0 is set when the condition is satisfied.<label> Designate the branching destination at the time an error occurs or the condition expression if not satisfied.<error identifier> Designate a variable or a constant to identify where the error was generated in the error handling section.

H010805E.EPS

“wait until” statement continues checking until the <expression> is evaluated as true. Thecheck is executed just once during each scan period. When the <expression> is evaluatedtrue, the line following the “wait until” statement will be executed.

• The time option <wait time> designates the maximum duration of time to continue thecheck (maximum duration of check). If the time designation <wait time> is omitted, thesystem continues checking until the condition becomes true.

• The <error label>, <label> and <error identifier> specify what action should be takenwhen the condition becomes false or when an error occur.

■ Restrictions on “wait until” StatementThe “wait until” statement can not be used in the functions called by “wait until” statement.Otherwise, an error will occur. Moreover, the functions called by “wait until” statements with“time” clause are subject to the following restrictions:

The “delay” statement, “delaycycle” statement and “drive” statement for the function blocksin other stations cannot be used.

The “dialog” statement with “time” clause and the “compare” statement with “time” clausecan not be used.

10th Edition : Dec.18,2003-00

H1-196

IM 33S01B30-01E

<H1.8 Program Control Statements>

■ Description Example of “wait until” StatementA description example of “wait until” statement is shown below:

● Waiting for 30 Seconds Until the TIC001 Process Variable Exceeds 50

block PID TIC001

......

TIC001. MODE = "AUT"

TIC001.SV = 60.0

......

wait until (TIC001.PV > 50); time 30, error LBL1

......

exit

LBL1

......

● Operating Mixer MX1 for 60 Seconds

block SIO-11 MX1

block TM TM001

#define START 2

#define STOP 0

......

drive [MX1 = START ];errorsub DRVERR

......

TM001.PH = 60

TM001.OP = 2 ! timer start.

wait until (TM001.ALRM == "CTUP")

TM001.OP = 1 ! timer stop.

......

drive [MX1 = STOP]; erorsub DEVERR

......

exit

......

DEVERR:

opeguide "Mixer operation abnormal."

% BSTS = "STOP" ! % is present block.

......

10th Edition : Dec.18,2003-00

H1-197

IM 33S01B30-01E

<H1.8 Program Control Statements>

H1.8.6 switchThe “switch” statement checks whether the designated <expression> matches oneof the <constants> in the “case” statement, then the control is branched accordingto the evaluation.

■ Usage of “switch” Statement

switch (<expression>)case <constant> [,<constant> ...: ......[case <constant> [,<constant>] ...:[otherwise: ......]]end switch

<expression> State the expression to be evaluated as an integer or character string.<constant> Designate an integer or character-string constant to be compared with the <expression>. The data type of <expression> in a "switch" statement must agree with the <constant> in the "case" statement.

H010806E.EPS

When “switch” statement is executed, the <expression> value is calculated first, then theresult is compared with <constants> of the “case” statement. The “switch” statementchecks whether the <expression> matches any of the constants stated in the “case” state-ment, then the control is branched according to the evaluation as shown below:

• If the <expression> value is equal one of the <constants>, the statement following the“case” statement is executed.

• If the result does not equal any of the constants, the “otherwise” statement is ex-ecuted.

• If “otherwise” statement is not present, none of the statements placed between the“switch” statement and “end switch” statement are executed.

When processing following a “case” statement or “otherwise” statement is completed, thecontrol escapes from the “switch” statement and is passed to the line following the “endswitch” statement.

TIP

Branching out of an “switch” to “end switch” structure can be instructed using a “goto” statement, butbranching into an “switch” to “end switch” structure is not permitted.

10th Edition : Dec.18,2003-00

H1-198

IM 33S01B30-01E

<H1.8 Program Control Statements>

■ Description Example for “switch” StatementA description example of “switch” statement is shown below:

● Example of Branching Processing According to the Value of LocalVariable A Being 0, 1 or Other Value

integer function FUNC1 (A, MSG)

integer A,B

char*10 MSG

......

B = 0

switch (A)

case 0:

MSG = "Run"

case 1:

MSG = "Stop"

B = 0

otherwise:

MSG = "ERROR"

B = 1

end switch

......

return B

......

10th Edition : Dec.18,2003-00

H1-199

IM 33S01B30-01E

<H1.8 Program Control Statements>

● Example of Operator Guide Message Output According to Error Variable of“drive” Statement

block SI0-11 NO1, PO1 MX1

#define OPEN 2

#define START 2

integer ERR

char*12 MSG

......

drive [VO1 = OPEN];errorsub DRVERR,1

......

drive [PO1 = START];errorsub DRVERR,2

......

drive [MX1 = START]; errorsub DRVERR,3

......

exit

......

DREVERR:

ERR = lerroid()

switch (ERR)

case1:

MSG = "Valve"

case2:

MSG = "Pump"

case3:

MSG = "Mixer"

otherwise:

MSG = "Switch instrument"

end switch

opeguide "%a%s not operable",1,MSG

ereturn

10th Edition : Dec.18,2003-00

H1-200

IM 33S01B30-01E

<H1.8 Program Control Statements>

H1.8.7 gotoThe “goto” statement executes unconditional branching to the line with the speci-fied <label>.

■ Usage of “goto” StatementThe format of “goto” statement is shown below:

goto <label>

<label> Label held by the branching destination.

H010807E.EPS

The “goto” statement executes unconditional branching to the line with the specified <la-bel>. A compile error is caused if the specified <label> is not present in the program.

10th Edition : Dec.18,2003-00

H1-201

IM 33S01B30-01E

<H1.8 Program Control Statements>

■ Description Example of “goto” StatementA description example of “goto” statement is shown below:

● Example of Branching to the Labels NML and RTNfunction SUB (A,MSG)

integer A,B

char*10 MSG

......

if (A == 1) then

MSG = “Run”

goto NML

else if (A == 1) then

MSG = “Stop”

goto NML

else

MSG = “ERROR”

end if

B = 1

goto RTN

......

NML:

B = 0

RTN:

return B

......

● Example of Branching to the Label LBL1 when Temperature ControllerTIC5 PV is Less than 50.0

block PID TIC5

block TM TM001

......

[TIC5.MODE.SV = "AUT", 60.0]

[TM001.PH.OP = 90,2]

wait until (TM001.ALRM == "CTUP")

TM001.OP = 1

......

if(TIC5.PV < 50.0) goto LBL1

......

exit

......

LBL1:

opeguide "%a low internal temperature", 3

% BSTS = "STOP" !% is the present block.

......

10th Edition : Dec.18,2003-00

H1-202

IM 33S01B30-01E

<H1.8 Program Control Statements>

H1.8.8 delayProgram execution delays as long as the <delay time> of a “delay” statement.

■ Usage of “delay” Statement

delay <delay time>

<delay time> Designate the period of delay in msecs using an integer-type real number or variable.

H010808E.EPS

The “delay” statement causes a delay in processing time of a program for a designatedperiod of time in msecs. The precision of the delayed time is dependent on the basic scanperiod.

■ Description Example of “delay” StatementA description example of “delay” statement is shown below:

● Example of Causing a Delay by 200 Seconds after Setting FIC001 SVblock PID FIC001

......

FIC001.SV = 10

delay 200000

......

● Example of Waiting for a Batch End after Starting the FIQC1 Batch DataSet Unit:

block BSETU-2 FIQC1

......

FIQC1.BSET = 100.0

[FIQC1.MODE.SV = "AUT",1]

delay 1000

wait until (FIQC1.ZONE == 7 or FIQC1.ZONE == 0)

......

10th Edition : Dec.18,2003-00

H1-203

IM 33S01B30-01E

<H1.8 Program Control Statements>

H1.8.9 delaycycleThe “delaycycle” statement causes a delay in program execution as much as desig-nated <number of cycles> x basic cycles.

■ Usage of “delaycycle” Statement

delaycycle [<number of cycles>]

<number of cycles> Designate the period of delay in msecs using an integer-type real-number or variable.

H010809E.EPS

The “delaycycle” statement causes a delay in program execution as much as designated<number of cycles> x basic cycles. If <number of cycles> is omitted, the program executiondelays as long as one basic cycle.

■ Description Example of “delaycycle” StatementDescription examples of the “delaycycle” statement are shown below:

● Example of Delaying for One Cycle After Setting FIC003 SV

block PID FIC003

......

FIC003.SV = 30.0

delaycycle

......

● Example of Waiting for a Batch End After Starting the FIQC1 Batch DataSet Unit

lock BSETU-2 FIQC1

......

FIQC1.BSET = 200.0

[FIQC1.MODE.SV = "AUT",1]

delaycycle

wait until (FIQC1.ZONE == 7 or FIQC1.ZONE == 0)

......

10th Edition : Dec.18,2003-00

H1-204

IM 33S01B30-01E

<H1.9 SEBOL Message Statements>

H1.9 SEBOL Message Statements▼ Message Statements

SEBOL has message statements to output each message for operation and monitor-ing functions and to interact with operator.

■ Message Statements ¡ £SEBOL has the following eight messages:

● “opeguide” Statement

This statement is used to print as an operator guide message an arbitrary character stringor the character string specified by operator guide message element number, and to store itin the historical file.

● “dialogue” Statement

This statement is used to exchange data with operator through the message windowdialogs of the HIS.

● “message” Statement

This statement is used to print as a message an arbitrary character string or the characterstring specified by print message element number, and to store it in the historical file.

● “history” Statement

This message is used to store as a message an arbitrary character string or the characterstring specified by print message element number, and to store it in the historical file.

● “request” Statement

This statement is used to output a message by specifying the element number.

● “sysalarm” Statement

This statement is used to generate a system alarm using an arbitrary character, or torecover from the status in which a system alarm has occurred.

● “prcsalarm” Statement

This statement is used to generate a process alarm in a SFC block, or to recover from thestatus in which a process alarm has occurred.

● “unit prcsalarm” Statement

This statement is used to generate a unit process alarm, or to recover from the status inwhich a unit process alarm has occurred.

10th Edition : Dec.18,2003-00

H1-205

IM 33S01B30-01E

<H1.9 SEBOL Message Statements>

The following table shows the sizes and display colors for each message statement:

Table Message Statements

Messagestatement

Specification SizeDefault

color (*1)

%a colorspecification (*2)

Line feed ("\n") (*3)

Window Print out Window Print out

opeguideArbitrary character string (*10) 128 bytes max (*4) White Valid (*9) Valid Valid

Element number Fixed (*6) White ··· ··· ··· ···

dialogueArbitrary character string (*10) 192 bytes max (*5) White Valid (*9) Valid Valid

Element number Fixed (*6) White ··· ··· ··· ···

messageArbitrary character string (*10) 128 bytes max (Not

displayed)··· (*9) ··· Valid

Element number Fixed (*6) ··· ··· ··· ···

historyArbitrary character string (*10) 128 bytes max (Not

displayed)

··· (Notprinted)

··· (Notprinted)Element number Fixed (*6) ··· ···

request Element number Fixed (*6)(Notdisplayed)

··· ··· ··· ···

sysalarm Arbitrary character string (*10) 128 bytes max (*7) White Valid (*9) Valid Valid

prcsalarm Character string (*8) 8 bytes max WhiteInvalid(*8) (*9) ··· ···

unit prcsalarm Character string (*8) 8 bytes max WhiteInvalid(*8) (*9)

··· ···

H010901E.EPS

*1: The default color of the message character strings that appear on the screen.*2: Specify with a format character string.*3: Specify with a format character string. If “\n” (line feed code) is used, a line feed is inserted to the format character

string for window display and printout.*4: When specifying color for “%a”, six bytes per color and one byte per line feed are used. The total byte length of these

and the formatted character string is limited to 128 bytes. Up to 70 bytes can be displayed in one line on a window(excluding the number of bytes for “%a” escape sequence).

*5: Up to 70 bytes can be displayed in one line on the window, and up to seven lines can be displayed in a dialog windowdisplay. For the “%a” color, six bytes per color and one byte per line feed are used. The total byte length of these andthe formatted character string is limited to 192 bytes.

*6: Element number*7: When specifying the “%a” color, six bytes per color and one byte per line feed are used. The total byte length of these

and the formatted character string is limited to 128 bytes. Up to 76 bytes can be displayed in one line on a window(excluding the number of bytes for “%a” escape sequence). Up to 58 bytes can be displayed in a message window.

*8: Process alarm character string defined via the builder.*9: Whether the designation of “%a” is enabled or not depends on the individual printer.*10: The horizontal tab character (\t) cannot be used.

10th Edition : Dec.18,2003-00

H1-206

IM 33S01B30-01E

<H1.9 SEBOL Message Statements>

Table Range of Element Numbers ¡

Message statement Symbol Range of element number

“opeguide” statement“dialogue” statement

OG 0001 to 0100 (%OGnnnn for nnnn)

“message” statement“history” statement

PR 0001 to 0100 (%PRnnnn for nnnn)

“request” statement

VM

PQ

0001 to 0100 (%VMnnnn for nnnn)

0001 to 0100 (%PQnnnn for nnnn)

CP

M3

0001 to 9999 (%CPnnnn for nnnn)

0001 to 9999 (%M3nnnn for nnnn)H010902E.EPS

Table Range of Element Numbers £

Message statement Symbol Range of element number

“opeguide” statement“dialogue” statement

OG0001 to 0200 (%OGnnnn for nnnn) (*1)0001 to 0500 (%OGnnnn for nnnn) (*2)

“message” statement“history” statement

PR0001 to 0200 (%PRnnnn for nnnn) (*3)0001 to 0400 (%PRnnnn for nnnn) (*4)0001 to 1000 (%PRnnnn for nnnn) (*2)

“request” statement

VM

PQ

0001 to 0100 (%VMnnnn for nnnn)

0001 to 0200 (%PQnnnn for nnnn)

CP

M3

0001 to 9999 (%CPnnnn for nnnn)

0001 to 9999 (%M3nnnn for nnnn)H010903E.EPS

*1: Range for CS 3000 KFCS, LFCS, SFCS*2: Range for CS 3000 KFCS2, FFCS, LFCS2*3: Range for CS 3000 SFCS*4: Range for CS 3000 KFCS, LFCS

■ Addition of Tag Name to a MessageIf an operation started by a unit instrument executes a message statement, the tag nameadded to the message will be the name of the unit instrument.

If the SFC block is started individually, the tag name of the SFC block is added to themessage. The message is transferred to all HISs. However, the message will not be dis-played on the HIS to which a user with no operation and monitoring authority against theoriginating FCS is logged in.

11th Edition : Oct.28,2004-00

H1-207

IM 33S01B30-01E

<H1.9 SEBOL Message Statements>

H1.9.1 opeguideAn “opeguide” statement is the message statement that prints out an arbitrarycharacter string, or the character string designated by an operator guide messageelement number, as an operator guide message. The character string is stored in thehistorical file.

■ Usage of “opeguide” Statement ¡ £

opeguide <formatting string> [, <output data>...] OG, <element number>

<format string> Define the format character string.<output value> The output value is designated as a numeric type expression or as a character string. A maximum of eight values can be designated.<element number> The operator guide message element number (nnnn of %OGnnnn) is an integer number (*1).

H010904E.EPS

*1: ¡ For CS 1000, it ranges between 0001 and 0100.£ For CS 3000 KFCS, LFCS, SFCS it ranges between 0001 and 0200.£ For CS 3000 KFCS2, FFCS, LFCS2, it ranges between 0001 and 0500.

SEE ALSO

For details on format character string, see the following:

H1.9.9, “Character String Format”

The following points need to be noted when using “opeguide” statement.

• When displaying an arbitrary character string, the color can be changed using the %adesignation of the format character string. The default color is white.

• Up to 70 bytes can be displayed per line in an operator guide window. If there aremore than 70 bytes, they will be displayed in two lines. Character strings that can beprinted or stored in a historical file can contain up to 128 bytes.

• When designating the color for %a, six bytes are used per color. The six bytes forcolor designation are not included in the 70 bytes that can be displayed in one line, butthey are included in the 128 bytes that are printed or stored in a historic file.

• The message is transferred to all HISs. However, the message will not be displayedon the HIS to which a user with no operation and monitoring authority against theoriginating FCS is logged in.

11th Edition : Oct.28,2004-00

H1-208

IM 33S01B30-01E

<H1.9 SEBOL Message Statements>

■ Description Example of “opeguide” StatementDescription examples of an “opeguide” statement are shown below:

● Description Example for Displaying an Arbitrary Character String as an“opeguide” Message

#define WHITE 7

#define GREEN 2

integer temp ! local variable retaining the temperature

......

* Only the temperature section shows a green message, all others show a white

message.

opeguide "current temperature is %a%d%a degrees" ,GREEN, temp, WHITE

......

● Description Example for Displaying the Present FCS “opeguide”Message %OG0001

......

opeguide OG,1

......

10th Edition : Dec.18,2003-00

H1-209

IM 33S01B30-01E

<H1.9 SEBOL Message Statements>

H1.9.2 dialogue StatementThe dialogue statement is a message statement for exchanging data between theprogram and the operator through the dialogue message window in the HIS. Thereare three types of “dialogue” statements as below:

• Data entry dialogue messages

• Acknowledgment dialogue messages

• Reentry dialogue messages

■ Usage of “dialogue” Statement (Data Entry Dialogue Message) ¡ £

dialogue [<dialogue name>] ; <formatting string> [,<output value>] ...] OG, <element number>

; <prompt string>, <input variable> [;<error variable>]

[;time <wait time> [, error <label> [,<error identifier>] ] ] errorsub error <label> [;<error identifier> errorsub

<dialogue name> The dialogue name is designated with a character-type constant or variable (maximum 8 bytes). If the name is omitted, this becomes eight asterisks (********).

<formatting string> Define the format character string.

<output value> The output value is designated as a numeric type expression or as a character string. A maximum of eight values can be designated.

<element number> The operator guide message element number (nnnn of %OGnnnn) is an integer number (*1).

<prompt string> Designate the input prompt message with a character-type constant or variable (maximum 32 bytes).

<wait time> Designate the maximum operation wait time (in seconds) with an integer-type constant or local variable.

<error variable> Designate the local variable to which the error code is set. If no error occurs, this is set to 0.

<label> Designate the branching destination at the time an error occurs.

<error identifier> Designate a local variable or a constant to identify where the error was generated in the error handling section.

H010905E.EPS

*1: ¡ For CS 1000, it ranges between 0001 and 0100.£ For CS 3000 KFCS, LFCS, SFCS it ranges between 0001 and 0200.£ For CS 3000 KFCS2, FFCS, LFCS2, it ranges between 0001 and 0500.

SEE ALSO

For the details on format character string, see the following:

H1.9.9, “Character String Format”

11th Edition : Oct.28,2004-00

H1-210

IM 33S01B30-01E

<H1.9 SEBOL Message Statements>

The following points need to be noted when using “dialogue” statement (with dialog mes-sage for data entry.)

• A data entry dialogue message calls up the dialogue message window, and theoperator can enter data by pressing the dialogue button. The target SFC block staysin a wait state at the “dialogue” statement until the operator inputs data. When theoperator inputs data, this data is stored in the input variable designated in the subject“dialogue” statement, and execution of the SFC block resumes from the line followingthe “dialogue” statement.

• For a data entry dialogue or an acknowledgment dialogue message, the desiredcharacter string to be displayed or the operator guide message is displayed in thedialogue message window. The desired character string can contain a maximum of 70bytes per line. The dialogue window displays up to seven lines. The desired characterstring is limited to a total of 192 bytes. The prompt character is not stored in the histori-cal file and will not be printed.

• The dialogue name is displayed in windows such as the tuning window of the subjectSFC block.

• The maximum input wait time can be specified in seconds by designating the <waittime>. If the maximum input wait time is exceeded, a timer count up run-time erroroccurs. If in a situation where the PC is not operating as an HIS must be taken intoconsideration, then specify infinite wait by not designating a wait time or use a suffi-ciently long wait time specification (it must be at least longer than the time it takes forHIS to start up).

• The branching destination when a run-time error occurs can be specified by designat-ing a <label>. Also, when an <error identifier> is specified, an inquiry can be made onthe value of the error identifier from the error handling section by using the built-infunctions, lerrorid(), derrorid() or cerrorid(). The function lerrorid() is used for referenc-ing an integer-type error identifier, derrorid() for a real-type error identifier andcerrorid() for a character-type error identifier.

• A dialogue message output from an operation using a “dialogue” statement becomesthe dialogue message with respect to the unit instrument that started the operation,and displays a dialogue in the unit instrument tuning window, etc., to prompt theoperator to perform an entry or acknowledgment operation.

• If a dialog type message output from the SFC block is deleted before SFC block runsa dialog statement for reentering the dialog type message, the message is fixed as“dialog retry message.” The previous message can not be retrieved.This phenomenon also occurs when the data entry message is deleted or confirma-tion message is deleted from operator guide message confirmation window.

SEE ALSO

For the details of error handling, see the following:

H1.13, “Error Handling”

10th Edition : Dec.18,2003-00

H1-211

IM 33S01B30-01E

<H1.9 SEBOL Message Statements>

■ Usage of “dialogue” Statement (Acknowledgment Dialogue Message)¡ £

<dialogue name> The dialogue name is designated with a character-type constant or variable (maximum 8 bytes). If the name is omitted, this becomes eight asterisks (********).

<format string> Define the format character string.

<output value> The output value is designated as a numeric type expression or as a character string. A maximum of eight values can be designated.

<element number> The operator guide message element number (nnnn of %OGnnnn) is an integer number (*1).

<wait time> Designate the maximum operation wait time (in seconds) with an integer-type constant or local variable.

<error variable> Designate the local variable to which the error code is set. If no error occurs, this is set to 0.

<label> Designate the branching destination at the time an error occurs.

<error identifier> Designate a local variable or a constant to identify where the error was generated in the error handling section.

H010906E.EPS

dialogue [<dialogue name>] ; <formatting string> [,<output value>] ...] OG, <element number>

;confirm [;<error variable>]

[;time <wait time> [, error <label> [,<error identifier>] ] ] errorsub error <label> [;<error identifier> errorsub

*1: ¡ For CS 1000, it ranges between 0001 and 0100.£ For CS 3000 KFCS, LFCS, SFCS it ranges between 0001 and 0200.£ For CS 3000 KFCS2, FFCS, LFCS2, it ranges between 0001 and 0500.

SEE ALSO

For details on format character string, see the following:

H1.9.9, “Character String Format”

11th Edition : Oct.28,2004-00

H1-212

IM 33S01B30-01E

<H1.9 SEBOL Message Statements>

The following points need to be noted when using “dialogue” statement (with confirmationaction for operation).

• For an acknowledgment dialogue message, the operator performs the acknowledg-ment operation with the confirm button.

• For a data entry dialogue or an acknowledgment dialogue message, the desiredcharacter string to be displayed or the operator guide message is displayed in thedialogue message window. The desired character string can contain a maximum of 70bytes per line. The dialogue window displays up to seven lines. The desired characterstring is limited to a total of 192 bytes. The prompt character is not stored in the histori-cal file and will not be printed.

• The dialogue name is displayed in windows such as the tuning window of an SFCblock or an operation.

• The maximum input wait time can be specified in seconds by designating the <waittime>. If the maximum input wait time is exceeded, a timer count up run-time erroroccurs. If in a situation where the PC is not operating as an HIS must be taken intoconsideration, then specify infinite wait by not designating a wait time or use a suffi-ciently long wait time specification (it must be at least longer than the time it takes forHIS to start up).

• The branching destination when a run-time error occurs can be specified by designat-ing a <label>. Also, when an <error identifier> is specified, an inquiry can be made onthe value of the error identifier from the error handling section by using the built-infunctions, lerrorid(), derrorid() or cerrorid(). The function lerrorid() is used for referenc-ing an integer-type error identifier, derrorid() for a real-type error identifier andcerrorid() for a character-type error identifier.

• A dialogue message output from an operation using a “dialogue” statement becomesthe dialogue message with respect to the unit instrument that started the operation,and displays a dialogue in the unit instrument tuning window, etc., to prompt theoperator to perform an entry or acknowledgment operation.

SEE ALSO

For the details of error handling, see the following:

H1.13, “Error Handling”

10th Edition : Dec.18,2003-00

H1-213

IM 33S01B30-01E

<H1.9 SEBOL Message Statements>

■ Usage of “dialogue” Statement (Reentry Dialogue Message)

<retry character string> Designates the reentry prompt message with a character type constant or variable (maximum 32 bytes).

<input variable> Designates the local variable where data input by the operator is stored. Either a numeric type or character string type can be used for the input variable, but when the input variable is a character string type, the string that can be input has a maximum of 32 bytes.

<wait time> Designate the maximum operation wait time (in seconds) with an integer-type constant or local variable.

<error variable> Designate the local variable to which the error code is set. If no error occurs, this is set to 0.

<label> Designate the branching destination at the time an error occurs.

<error identifier> Designate a local variable or a constant to identify where the error was generated in the error handling section.

H010907E.EPS

dialogue <retry character string> ;retry <input variable> [,<error variable>]...] [;time <wait time> [, error <label> [,<error identifier>] ] ] errorsub error <label> [;<error identifier> errorsub

• In the case of a reentry dialogue message, the dialogue message that the SFC blockoutput immediately before becomes effective once again in the operator guide win-dow. Even if it is a reentry, the message is printed and is also stored in the historicalfile.

• When the dialogue message which is the target of the reentry dialogue message is adata entry type, if the input variable of the data entry type “dialogue” statement ex-ecuted immediately before is a numeric value, then also use a numeric value for theinput variable of the reentry type “dialogue” statement. Likewise, if the input variable ofthe data entry type “dialogue” statement executed immediately before is a characterstring, then use a character string for the input variable of the reentry type “dialogue”statement. If the input variable types do not match, a run-time error occurs in thereentry dialogue statement.

• The maximum input wait time can be specified in seconds by designating the <waittime>. If the maximum input wait time is exceeded, a timer count up run-time erroroccurs. If in a situation where the PC is not operating as an HIS must be taken intoconsideration, then specify infinite wait by not designating a wait time or use a suffi-ciently long wait time specification (it must be at least longer than the time it takes forHIS to start up).

10th Edition : Dec.18,2003-00

H1-214

IM 33S01B30-01E

<H1.9 SEBOL Message Statements>

• The branching destination when a run-time error occurs can be specified by designat-ing a <label>. Also, when an <error identifier> is specified, an inquiry can be made onthe value of the error identifier from the error handling section by using the built-infunctions, lerrorid(), derrorid() or cerrorid(). The function lerrorid() is used for referenc-ing an integer-type error identifier, derrorid() for a real-type error identifier andcerrorid() for a character-type error identifier.

• The message is transferred to all HISs. However, the message will not be displayedon the HIS to which a user with no operation and monitoring authority against theoriginating FCS is logged in.

• A dialogue message output from an operation using a “dialogue” statement becomesthe dialogue message with respect to the unit instrument that started the operation,and displays a dialogue in the unit instrument tuning window, etc., to prompt theoperator to perform an entry or acknowledgment operation.

SEE ALSO

For the details of error handling, see the following:

H1.13, “Error Handling”

10th Edition : Dec.18,2003-00

H1-215

IM 33S01B30-01E

<H1.9 SEBOL Message Statements>

■ Description of “dialogue” StatementExamples of “dialogue” statement usage are shown below:

● Description of a Data Entry Dialogue Message or ReentryDialogue Message

block PID FIC001

long setvalue

......

dialogue "MSG001";"Enter setpoint value."\ ";"value? ",setvalue

;time 120,error LBL2

while (setvalue < 50 or setvalue > 100)

dialogue "Input range error, reentry."\

;retry setvalue;time 120,error LBL2

wend

......

FIC001.SV=setvalue ! set the value input by the operator (setvalue) in

! the SV value

......

exit

......

LBL2:

* Write error handling for the case operator did not perform dialogue input.

In this example, the program is written so that the message “Enter setpoint value”. isdisplayed in the dialogue message screen or dialogue message window. The programchecks to see if the data input from the dialogue message window is a value within therange (50 to 100), and if it is out of range, the reentry dialogue message “Input range error,reentry”. is displayed.

● Description of an Acknowledgment Dialogue Message

......

dialogue "MSG002";"Catalyst charge complete?";confirm;time 120,error LBL2

......

exit

......

LBL2:

* Write error handling for the case operator did not perform dialogue acknowledg-

ment.

In this example, the program is written so that the message “Catalyst charge complete?” isdisplayed and the program waits until acknowledgment is given with the confirm key.

10th Edition : Dec.18,2003-00

H1-216

IM 33S01B30-01E

<H1.9 SEBOL Message Statements>

H1.9.3 messageThe “message” statement is used for printing out the desired character string or thecharacter string designated by the printout message element number, as a se-quence message. The character string is stored in the historical file.

■ Usage of “message” Statement ¡ £

message <format character string> [, <output value>...] PR, <element number> [, <parameter> ]

<format character string> Define the format character string.

<output value> The output value is designated as a numeric type expression or as a character string. A maximum of eight values can be designated.

<element number> Designate the print message number (nnnn of %PRnnnn) with an integer number (*1).

<parameter> Designate the parameter value with an integer-type expression (0 to 65535).

H010908E.EPS

*1: ¡ For CS 1000, it ranges between 0001 and 0100.£ For CS 3000 SFCS, it ranges between 0001 and 0200.£ For CS 3000 KFCS, LFCS, SFCS it ranges between 0001 and 0400.£ For CS 3000 KFCS2, FFCS, LFCS2, it ranges between 0001 and 1000.

SEE ALSO

For details on format character string, see the following:

H1.9.9, “Character String Format”

The following points need to be noted when using “message” statement.

• In the case of a desired character string, the length of the character string that can beprinted or stored in the historical file is up to 128 bytes.

• When there is an element number designation, a maximum of three process datadesignated via the Print Message Builder are added to the message.

• When there is an element number designation, a <parameter> can be designated. Ofthe three process data that are added to the message to be printed out, if the first datais not designated by the Print Message Builder, then the value of the designated<parameter> is printed out as the first data value. If the first data is designated by thePrint Message Builder, then the designated data is printed out and the <parameter>designated in the “message” statement is not output. If neither the first data is desig-nated by the Print Message Builder nor a <parameter> designated, the data valuebecomes 0. If the <parameter> value falls outside the range of 0 to 65535, a run-timeerror occurs.

• The message is transferred to all HISs. However, the message will not be displayedon the HIS to which a user with no operation and monitoring authority against theoriginating FCS is logged in.

• The tag name of the unit instrument that started the operation is added to the mes-sage output by the operation using the “message” statement.

11th Edition : Oct.28,2004-00

H1-217

IM 33S01B30-01E

<H1.9 SEBOL Message Statements>

■ Description Example of “message” StatementDescription examples of “message” statement are shown below:

● Description Example of Printing the Desired Character String as aMessage

......

message "Valve abnormal"

......

With the above message statement, the message [valve malfunction] is printed out.

● Description Example of Printing the Printout Message %PR0003 of thePresent FCS

......

message PR,3

......

10th Edition : Dec.18,2003-00

H1-218

IM 33S01B30-01E

<H1.9 SEBOL Message Statements>

H1.9.4 historyThe “history” statement is a message statement for storing the desired characterstring or the character string designated by the printout message element number,as a message in the historical file. The message that is output by a “history” state-ment will not be printed. Except for the fact that the message is not printed, the“history” statement has the same action as the “message” statement.

■ Usage of “history” Statement ¡ £The format of “history” statement is shown below:

history <format character string> [, <output value>...] PR, <element number> [, <parameter> ]

<format character string> Define the format character string.

<output value> The output value is designated as a numeric type expression or as a character string. A maximum of eight values can be designated.

<element number> Designate the print message number (nnnn of %PRnnnn) with an integer number (*1).

<parameter> Designate the parameter value with an integer-type expression (0 to 65535).

H010909E.EPS

*1: ¡ For CS 1000, it ranges between 0001 and 0100.£ For CS 3000 SFCS, it ranges between 0001 and 0200.£ For CS 3000 KFCS, LFCS, it ranges between 0001 and 0400.£ For CS 3000 KFCS2, FFCS, LFCS2, it ranges between 0001 and 1000.

SEE ALSO

For details on format character string, see the following:

H1.9.9, “Character String Format”

11th Edition : Oct.28,2004-00

H1-219

IM 33S01B30-01E

<H1.9 SEBOL Message Statements>

■ Action of “history” Statement• In the case of a desired character string, the length of the string stored in the historical

file is up to 128 bytes.

• When there is an element number designation, a maximum of three process datadesignated via the Sequence Message Request Builder are added to the message.

• When there is an element number designation, a <parameter> can be designated. Ofthe three process data that are added to the message to be printed out, if the first datais not designated by the Print Message Builder, then the value of the designated<parameter> is printed out as the first data value. If the first data is designated by thePrint Message Builder, then the designated data is printed out and the <parameter>designated in the “message” statement is not output. If neither the first data is desig-nated by the Print Message Builder nor a <parameter> designated, the data valuebecomes 0. If the <parameter> value falls outside the range of 0 to 65535, a run-timeerror occurs.

• The message is transferred to all HISs. However, the message will not be displayedon the HIS to which a user with no operation and monitoring authority against theoriginating FCS is logged in.

• The tag name of the unit instrument that started the operation is added to the mes-sage output by the operation using the “history” statement.

■ Description Example of “history” StatementDescription examples of “history” statement are shown below:

● Description for Logging Character String as a Message to Historical LogFile

......

history "Pump abnormal"

......

With the above history statement, the message [pump malfunction] will be stored in ahistorical file.

● Description Example of Logging Printout Message %PR0003 of thePresent FCS to Historical Log File

......

history PR,3

......

10th Edition : Dec.18,2003-00

H1-220

IM 33S01B30-01E

<H1.9 SEBOL Message Statements>

H1.9.5 requestThe “request” statement is a message statement that outputs various messages bydesignating the message type and element number.

■ Usage of “request” Statement ¡ £

request <message type>, <element number>

<message type> Designate the type of message to be output.

<element number> Designate the element of the message to be output with an integer number.

H010910E.EPS

Message types and message element numbers are shown as follows.

Table Message types and message element numbers

Symbol

VM

RQ

CP

M3

Multimedia start message

Sequence Message Request

Supervisory Computer event message 0001 to 9999 (nnnn in %CPnnnn)

0001 to 9999 (nnnn in %M3nnnn)

H010911E.EPS

Supervisory Computer event message for PICOT

Description Range of Element Number

0001 to 0100 (nnnn in %VMnnnn)

0001 to 0100 (nnnn in %RQnnnn) (*1)0001 to 0200 (nnnn in %RQnnnn) (*2)

*1: ¡ Range for CS 1000*2: £ Range for CS 3000

■ Action of request Statement• The destination of the message transfer conforms to the operation group definition.

• The tag name of the unit instrument that started the operation is added to the mes-sage output by the operation using the “request” statement.

■ Description Example of “request” StatementA description example of outputting the number 3 sequence message request is shownbelow:

......

request RQ,3

......

13th Edition : Dec.26,2005-00

H1-221

IM 33S01B30-01E

<H1.9 SEBOL Message Statements>

H1.9.6 sysalarmThe “sysalarm” statement is a message statement that generates a system alarmusing the desired character string. Normal status can be restored from a state wherea system alarm has been generated.

■ Usage of “sysalarm” Statement

• Alarm occurrence sysalarm <format character string> [,<output value>...]

• Alarm recovery sysalarm recover <format character string> [,<output value>...]

<format character string> Define the format character string.

<output value> The output value is designated as a numeric type expression or as a character string. A maximum of eight values can be designated.

H010912E.EPS

SEE ALSO

For details on format character string, see the following:

H1.9.9, “Character String Format”

The following points need to be noted when using “sysalarm” statement.

• Generates a system alarm of the current FCS using the desired character stringcreated by following the format character string, and recovers from the alarm state.When the alarm is generated, the message mark in the system alarm messagewindow turns red, and it turns green after recovery.

• The length of the character string that can be stored in the historical file or printed is128 bytes.

• The message is transferred to all HISs. However, the message will not be displayedon the HIS to which a user with no operation and monitoring authority against theoriginating FCS is logged in.

10th Edition : Dec.18,2003-00

H1-222

IM 33S01B30-01E

<H1.9 SEBOL Message Statements>

● Description Example of Generating a System Alarm Message andRecovering from the Alarm State

block PVI T100

......

if (T100.ALRM == "IOP") then

sysalarm "Thermometer T100 failure"

end if

......

if (T100.ALRM <> "IOP") then

sysalarm recover "Thermometer T100 recovered"

end if

......

With the above “sysalarm” statement, the message “Thermometer T100 failure” is outputwhen the alarm status of T100 becomes IOP, and the message “Thermometer T100recovered” is output when the status returns to normal.

10th Edition : Dec.18,2003-00

H1-223

IM 33S01B30-01E

<H1.9 SEBOL Message Statements>

H1.9.7 prcsalarmThe “prcsalarm” statement is a message statement that generates a process alarmin the SFC block where the “prcsalarm” statement has been executed.

An operation can initiate an alarm or recovery message using “unit prcsalarm”statement or “unit prcsalarm recovery” statement.

SEE ALSO

For more information about “unit prcsalarm” statement or “unit prcsalarm recovery” statement, see thefollowing:

H1.9.8, “unit prcsalarm”

■ Usage of “prcsalarm” Statement

• Alarm occurrence prcsalarm <alarm status character string>

• Alarm recovery prcsalarm recover [ <alarm status character string> ]

<alarm status character string> Designate the character string for the alarm status to generate or recover, as a constant or variable. The alarm status character string can contain a maximum of 8 bytes.

H010913E.EPS

• By using the “prcsalarm” statement, a process alarm occurrence message can beoutput using the designated character string. If the corresponding alarm has alreadyoccurred, the process alarm message is not output.

• The alarm status strings are using the strings defined on User-Defined Status Charac-ter String Builder for alarms. In one set of alarm status strings, 23 strings can bedefined. The user-defined strings and a NR string (string for normal status) comprise aset of user-defined status character strings. What set of the stings to be applied canbe specified for each SFC block, the default set of strings for SFC blocks is USER10.When prcsalarm statement using an undefined string as its parameter, an error willoccur when running this statement.

• A “recover” designation in the “prcsalarm” statement will output a process alarmrecovery message using the designated process alarm character string. The status(data item ALRM) of the corresponding alarm becomes the alarm recovery status. Ifthe corresponding alarm has not occurred, the process alarm recovery message is notoutput. If an alarm status character string is not designated, all alarms occurring in thesubject SFC block will recover and a process alarm recovery message will be outputfor each alarm that has recovered. If a “prcsalarm” statement is executed with the“recover” designation in and all alarms in the subject SFC block are recovered, aprocess alarm recovery message for normal alarm status (NR) is output.

• In the SFC block, the data item STEPNO at the point the message occurred is addedas data to the process alarm occurrence and recovery messages.

• One SFC block can output one process alarm message during each basic scanperiod. If an attempt is made to output two process alarms in one period, that SFCblock delays for one period. The second “prcsalarm” statement will be executedduring the next basic scan period.

10th Edition : Dec.18,2003-00

H1-224

IM 33S01B30-01E

<H1.9 SEBOL Message Statements>

• Each time the SFC block is started, the alarm status (ALRM) is initialized to a normalstate (NR). In other words, if the SFC block is terminated while the process alarmsgenerated during the previous execution still exist, those process alarms are recov-ered by the system when the SFC block starts up and a process alarm recoverymessage is output.

• The builder can designate to output a repeating alarm when the SFC block continuesto be executed for more than the fixed time, without having the process alarm gener-ated by a “prcsalarm” statement recover using the “prcsalarm recover” statement.Only the SFC block that is currently running (block status is RUN or PAUS) will besubject to the repeating alarm. Even if the SFC block terminates execution with theprocess alarm still generated, (block status changes to STOP or ABRT), a repeatingalarm is not output. Except for the fact that the currently running SFC block is the onlysubject to the repeating alarm, it is the same as other function blocks.

• There are two data items in an SFC block: alarm detect specification (AF) and alarmmasking specification (AOFS). The process alarm message output by the “prcsalarm”statement conforms to the designation of these data items.

SEE ALSO

• The SFC block has the “alarm flashing status” data item (AFLS). The relationship between the alarm flash-ing status and the alarm flashing action of the SFC block in the operation and monitoring function con-forms to the general function blocks. For the explanation of alarm processing, see the following:

C5.15.1, “Alarm Display Flashing Actions”

• For data items related to SFC block alarms, see the following:

D5.6.9, “SFC Block Alarm Processing”

10th Edition : Dec.18,2003-00

H1-225

IM 33S01B30-01E

<H1.9 SEBOL Message Statements>

The following flowchart shows process alarm occurrence actions for an SFC block:

H010914E.EPS

Start

End

Alarm detect ion group bypass is enabled

Alarm group suppression is enabled

Suppress the alarm flashing action

The corresponding alarm is already generated

Generate a process alarm

Yes

No

Yes

No

No

Yes

Execute prcsalarm <alarm status character string>

Figure Actions of Process Alarm Occurrence in an SFC Block

10th Edition : Dec.18,2003-00

H1-226

IM 33S01B30-01E

<H1.9 SEBOL Message Statements>

The following flowchart shows the recovery actions from an SFC block process alarm.

H010915E.EPS

Start

End

Execute prcsalarm recover <alarm status character string>

Alarm detection groupbypass is enabled

Alarm group suppressionis enabled

Suppress the alarm flashing action

Recover from process alarm

Process alarm beinggenerated is cleared.

Output NR process alarm recovery message

The corresponding alarmis already generated

Yes

No

No

No

Yes

Yes

No

Yes

Figure Actions of Process Alarm Occurrence in an SFC Block

10th Edition : Dec.18,2003-00

H1-227

IM 33S01B30-01E

<H1.9 SEBOL Message Statements>

■ Description Example of “prcsalarm” StatementDescription Example of Outputting the Process Alarm HIGH are shown below:

......

* At this point, the alarm has not been generated.

prcsalarm "HIGH" ! The message, alarm "HIGH" occurrence, is output.

......

prcsalarm recover "HIGH" ! The two messages, alarm "HIGH" recovery and

...... ! normal state (NR) are output.

10th Edition : Dec.18,2003-00

H1-228

IM 33S01B30-01E

<H1.9 SEBOL Message Statements>

H1.9.8 unit prcsalarmA process alarm of a unit instrument is referred to as a unit process alarm.

The “unit prcsalarm” statement is a message statement that generates a unit pro-cess alarm. It also recovers to the normal state before the unit process alarm wasgenerated.

■ Usage of “unit prcsalarm” Statement

• Alarm occurrence unit prcsalarm <alarm status character string>• Alarm recovery unit prcsalarm recover [ <alarm status character string> ]

<alarm status character string> Designate the character string for the alarm status to generate or recover, as a constant or variable. The alarm status character string can contain a maximum of 8 bytes.

H010916E.EPS

• By using the “unit prcsalarm” statement, a process alarm occurrence message can beoutput using the designated process alarm character string. The status (unit instru-ment data ALRM) of the corresponding alarm becomes the alarm occurrence status. Ifthe corresponding alarm has already occurred, the process alarm message is not output.

• The alarm status strings are using the strings defined on User-Defined Status Charac-ter String Builder for alarms. In one set of alarm status strings, 23 strings can bedefined. The user-defined strings and a NR string (string for normal status) whichcomprises a set of user-defined status character strings. What set of the strings to beapplied can be specified for each unit instrument, the default set of strings for unitinstruments is USER11. When prcsalarm statement using an undefined string as itsparameter, an error will occur when running this statement.

• A “recover” clause in the “unit prcsalarm” statement will output a process alarm recov-ery message using the designated process alarm character string. The status (unitinstrument data ALRM) of the corresponding alarm becomes the alarm recoverystatus. If the corresponding alarm has not occurred, the process alarm recoverymessage is not output. If an alarm status character string is not designated, all alarmsoccurring in the unit instrument will recover and a unit alarm recovery message will beoutput for each alarm that has recovered. If a “unit prcsalarm” statement is executedwith the “recover” designation and all alarms in the unit instrument are recovered, aunit alarm recovery message for normal alarm status (NR) is output.

• The value for the unit instrument data STEPNO at the time a “unit prcsalarm” state-ment or “unit prcsalarm recover” statement is executed, is added to the unit processalarm occurrence and recovery messages.

• The operations that are started up from the same unit instrument can output only oneunit alarm message during each basic scan period. If an attempt is made to output twounit alarms in one period, that operation delays for one period (even if another opera-tion started up by the same unit instrument is outputting a unit process alarm, thedelay occurs). The second “unit prcsalarm” statement (or “unit prcsalarm recover”statement) is executed during the next basic scan period.

• Each time the unit instrument is started up, the unit instrument data ALRM is initializedto a normal state (NR). In other words, if the unit instrument is terminated while theunit alarms generated during the previous execution still exist, those unit processalarms are recovered by the system when the unit instrument starts up and a unitprocess alarm recovery message is output.

10th Edition : Dec.18,2003-00

H1-229

IM 33S01B30-01E

<H1.9 SEBOL Message Statements>

H1.9.9 Character String FormatThe character string format is the designation to edit output messages.

■ Usage of Character String FormatBy using the format character string, messages can be edited by format designations suchas flag characters and field minimum width for output. A format character string roughly hasthe following two elements:

• Regular character strings, which are output as is.

• Conversion specification, which converts the character according to the designatedformat and then outputs it. The conversion specification starts with a % and ends witha conversion character, as shown below. If ‘%’ is to be output, use %%.

%[<flag character>] [<field minimum width>] [.<accuracy>] <conversion character>

H010917E.EPS

● Flag Character (can be Omitted)

- ··· shifts the conversion result to the left.

+ ··· attaches a sign to a numeric value.

● Field Minimum Width (can be Omitted)

This is a decimal string that designates the field minimum width. When the converted valuebecomes a character string narrower than the this value, fillers are added on the left side. Ifthe field minimum width designation does not begin with a 0, a space will be used as thefiller, and if it begins with 0, 0 is used.

● Accuracy (can be Omitted)

Designates the maximum number of characters that can be output for a character string, orthe digits below the decimal point that can be output for a float or double value.

10th Edition : Dec.18,2003-00

H1-230

IM 33S01B30-01E

<H1.9 SEBOL Message Statements>

● Conversion Character

• aThe output value is received as a color code and changes the display color thereafter.In this format (a-format), the color code is converted to a character string called“escape sequence”. This character string is embedded into the output character stringand is converted to a color designation at the time of display. The color codes andcorresponding colors are indicated below:

0 black 8 steel blue

1 red 9 pink

2 green 10 blue-green

3 yellow 11 gold yellow

4 blue 12 moss green

5 magenta 13 purple

6 cyan 14 cyan blue

7 white 15 gray

• dThe output value is converted to a decimal number. The smallest digit to be output isdesignated in the accuracy. The default accuracy is 1.

• eThe output value is received as float or double, and converted to a decimal number inthe format, [-]m.nnnnnnE[±]xx. In this expression, there is one digit before the decimalpoint and the number of digits designated in the accuracy exists after the decimalpoint. The default accuracy is 6.

• fThe output value is received as float or double, and converted to a decimal number inthe format, [-]mmm.nnnn. The default accuracy is 6.

• gThis is output in either the e-format or f- format. The number of digits designated in theaccuracy becomes the number of significant digits. The e-format is used when theexponent obtained by the conversion of an e-format is smaller than -4 or when it islarger than the designated accuracy. A decimal point is added only when there is anumber that follows it. A zero at the left that has no significance is not output.

• oConverts the output value to an octal number. Designates the smallest digit to beoutput as the accuracy. The default accuracy is 1.

• sReceives the output value as a character string, and outputs all characters in thecharacter string or outputs the number of characters designated in the accuracy.

• xConverts the output value to a hexadecimal number without a lower case sign ($ is notplaced at the top). The smallest digit to be output is designated in the accuracy. Thisdefault accuracy is 1.

• XConverts the output value to upper-case hexadecimal numbers. Besides that, thischaracter is the same as x.

10th Edition : Dec.18,2003-00

H1-231

IM 33S01B30-01E

<H1.9 SEBOL Message Statements>

■ Conversion of the Character String “YOKOGAWA SEBOL”(14 characters) Using %s

Each output range is enclosed in colons to make it more recognizable. Output ranges varydepending on the specification for %s.

:%s: :YOKOGAWA SEBOL:

:%10s: :YOKOGAWA SEBOL:

:%.10s: :YOKOGAWA S:

:%-10s: :YOKOGAWA SEBOL:

:%20s: :YOKOGAWA SEBOL:

:%.20s: :YOKOGAWA SEBOL:

:%-20s: :YOKOGAWA SEBOL:

:%20.10s: :YOKOGAWA S:

:%-20.10s: :YOKOGAWA S:

10th Edition : Dec.18,2003-00

H1-232

IM 33S01B30-01E

<H1.9 SEBOL Message Statements>

■ format StatementThe “format” statement is an instruction statement to format the character string and store itin a character-string variable.

format <format character string> [,<data>...] ;<character string storage variable>

<format character string> Define the format character string.

<data> Designate data to be formatted with a numerical expression or character string (maximum of eight data).

<character string storage variable> Designate a local character-string variable that stores the format character string.

H010918E.EPS

SEE ALSO

For details on format character string, see the following in this subsection:

H1.9.9, “Character String Format”

● Example of Editing Time with a “format” Statement

integer year,mon,day

integer hour,min,sec

char*80 str

......

getdate(year,mon,day) ! getdate is the built-in function for acquiring

! the year, month, day

gettime(hour,min,sec) ! gettime is the built-in function for acquiring

! the hour, minute, second

......

format " '%2dyear:%2dmonth:%2dday(%2dhour:%2dminute:%2dsecond)",\

year,mon,day,hour,min,sec;str

......

end

When the above program is executed, the character string [’98year: 3month:14day(08hour:12minute:07second)] is set in the character string variable “str”.

Since the year, month and day conversion specification is %2d, for one-digit data as in 3, aspace is added to make it two digits as in [ 3month] (one space is placed before the 3).

Since the hour, minute and second conversion specification is %02d, for one-digit data asin 8, a zero is used to make it two digits, as in [08hour].

10th Edition : Dec.18,2003-00

H1-233

IM 33S01B30-01E

<H1.9 SEBOL Message Statements>

H1.9.10 Limitations on Message OutputThe number of messages that can be output with a message statement are subjectto the following limitations:

• The maximum number of messages that an SFC block can output during eachbasic cycle is 3.

• The maximum number of messages that all the SFC blocks within the samecontrol station can output is 30.

■ SFC Block Actions When the Number of Messages Reaches the OutputLimit

When the total number of messages output via a message statement such as the“opeguide” statement and SEBOL error messages reaches the limit during one cycle, theSFC block that attempted to execute the message statements (the message statement willbe executed in the next cycle) and the SFC block (SEBOL error messages are output in therelevant cycle) that output the SEBOL error messages (errors that can continue the opera-tion) are delayed for one cycle.

■ Messages Subject to the LimitationsThe table below lists the messages that are subject to the limitations as well as the SFCblock operations when the SFC block has attempted to output a message in excess of thenumber limitation.

Table Messages Subject to the Limitations

Output method Operation

opeguide statement

When an SFC block attempts to output a message in excess of thenumber limit, that SFC block delays one cycle, and the messagestatement is executed during the next cycle.

dialogue statement

message statement

history statement

request statement

sysalarm statement

sysalarm recover statement

prcsalarm statement (*1)

prcsalarm recover statement (*1)

unit prcsalarm statement (*3)

unit prcsalarm recover statement (*3)

SEBOL error message

The error message is output during the basic cycle in which the errorwas detected. In the case of an error that can continue the operation(*2), if the number of messages exceeds the limit, the relevant SFCblock delays one cycle and execution is resumed from the next cycle.

H010919E.EPS

*1: In addition to this limitation, another limitation is applied that only one process alarm can be generated during eachcycle.

*2: If it is not an error that can continue the operation, the relevant SFC block is forcefully terminated.*3: In addition to this limitation, another limitation is applied that only one unit process alarm can be generated during each

cycle.

10th Edition : Dec.18,2003-00

H1-234

IM 33S01B30-01E

<H1.9 SEBOL Message Statements>

■ Limitations when CPU Time is MonopolizedThe following explains the limitations when CPU time is monopolized by a “nopreempt”statement, etc. There are three instances when CPU time is monopolized:

• Between “nopreempt begin” and “nopreempt end”

• SEBOL one-shot execution step in an SFC block

• Pre-status change processing of an SFC block

The following limitations apply to messages that can be output during a monopoly on CPUtime:

● (A) Total Number of Statement Messages that can be Executed is Three orLess

The total number of messages that can be output by an “opeguide” statement, “message”statement, “history” statement, “request” statement, “sysalarm” statement and “sysalarmrecover” statement must be three or less. If an attempt is made to output the fourth mes-sage, a run-time error occurs. Error handling is not performed and a SEBOL error messageis output. If the CPU time was monopolized by a “nopreempt” statement or a SEBOL one-shot execution step, the fourth message is output during the next cycle. If the operation ispre-status change processing, the fourth message is discarded.

● (B) A “dialogue” Statement cannot be Executed

If a “dialogue” statement is executed, a run-time error occurs. Error handling is not per-formed and a SEBOL error message is output. If CPU time was monopolized by a“nopreempt” statement or a SEBOL one-shot execution step, the “dialogue” statement isexecuted the next time CPU time is allocated. If the operation is pre-status change pro-cessing, the dialogue message is discarded.

● (C) The Number of Messages that can be Output with a prcsalarmStatement or prcsalarm recover Statement is One

While CPU time is being monopolized by a “nopreempt” statement or a SEBOL one-shotexecution step, the number of messages that can be output by a “prcsalarm” statement or“prcsalarm recover” statement is one. If an attempt is made to output the second message,a run-time error occurs. Error handling is not performed and a SEBOL error message isoutput. The second message is output during the next cycle.

10th Edition : Dec.18,2003-00

H1-235

IM 33S01B30-01E

<H1.9 SEBOL Message Statements>

● (D) A “prcsalarm” Statement and “prcsalarm recover” Statement cannotbe Executed

In pre-status change processing, a “prcsalarm” statement and “prcsalarm recover” state-ment cannot be executed. If they are, a run-time error occurs and the message is dis-carded.

The number of messages that can be output from message statements is subject to thefollowing limitations:

• Limitation (1)The maximum number of messages that can be output from one SFC block duringone basic period is 3.

• Limitation (2)The maximum number of messages that can be output from all of the SFC blocks inone control station during one basic period is 30.

When CPU time is not monopolized, the following relationships exist between limitation (A)and limitations (1) and (2) explained above:

• The three messages that can be output during the monopolization on CPU time do notinclude the messages that have already been output during the same cycle prior tothe monopoly on CPU time occurred. However, the messages output during the CPUtime monopolization are included in the number of messages for (1) and (2).

• At the time when the monopolization on CPU time by a “nopreempt” statement orSEBOL one-shot execution step is canceled, if the total number of output messages(including those output prior to the monopoly on CPU time) exceeds the limits in (1) or(2), that SFC block delays one cycle. After the pre-status change processing, there willbe no delay even if the number of messages exceeds the limits in (1) or (2).

The following explains the one cycle delay that accompanies the limits in (C): when begin-ning an execution that will monopolize CPU time, in other words, when beginning to ex-ecute a “nopreempt” statement or a SEBOL one-shot execution step, if that SFC block hasalready executed a “prcsalarm” statement or “prcsalarm recover” statement during thatcycle, the SFC block delays one cycle. The processing that monopolizes CPU time will beexecuted in the next cycle.

10th Edition : Dec.18,2003-00

H1-236

IM 33S01B30-01E

<H1.10 Allocating CPU Time Using nopreempt Statements>

H1.10 Allocating CPU Time Using nopreemptStatements

▼ Allocating CPU Time

With the FCS, multiple SFC blocks can be executed simultaneously. CPU time isallocated to each SFC block, which is then executed.

■ Allocating CPU Time in SEBOLWhen multiple SFC blocks are simultaneously executed, if only the data in the FCS towhich the SFC blocks belong is to be accessed, usually the CPU is allocated to each SFCblock so that the SEBOL program in each SFC block will execute 20 lines at a time. How-ever, if other FCS data is accessed while these 20 lines are being processed, or if a state-ment that performs communication and waits for completion of that communication — suchas the “dialogue” statement — is executed, that SFC block enters the wait state and theCPU is allocated to the next SFC block.

In SEBOL, normally 20 lines are treated as a single block and executed at the same time.However, it cannot be determined where to delimit processing in the lines that are executedat the same time.

For example, when an interrupt signal or status change command is received, the interruptprocessing will be executed. Thus it cannot be guaranteed that multiple lines will be ex-ecuted with the same timing. This is because depending on the interrupt processing, thestatements prior to and after the interrupt will not necessarily be executed at the same time.

In this case like this, use the “nopreempt” statement in SEBOL to allocate CPU time solelyto one SFC block.

nopreempt begin

<In this section, write the statement that should continue to be executed>

nopreempt end

H011001E.EPS

10th Edition : Dec.18,2003-00

H1-237

IM 33S01B30-01E

<H1.10 Allocating CPU Time Using nopreempt Statements>

■ Rules for Governing the Allocating of CPU TimeThe following explains the rules governing the allocation of CPU time.

• The SFC block between the “nopreempt begin” and “nopreempt end” statements willmonopolize CPU time and continue to be executed. Even if an interrupt signal or astatus change command is received, interrupt processing will not be performed untilthe “nopreempt end” statement is executed. Thus, statements occurring in this sectionare guaranteed to be executed using the same timing.

• If the “nopreempt begin” statement is executed between the “nopreempt begin” and“nopreempt end” statements, a run-time error occurs and the monopolization of CPUtime will be canceled. If the “nopreempt end” statement is executed without executingthe “nopreempt begin” statement, it will be ignored and no error will occur.

• A SEBOL one-shot execution step in the SFC block will monopolize CPU time whenexecuted in exactly the same way as a statement placed between the “nopreemptbegin” and “nopreempt end” statements.

• If a “nopreempt begin” statement is executed during an SFC block interrupt programand interrupt processing is completed with a “return” statement without executing the“nopreempt end” statement, the CPU time monopoly will be canceled.

• When the function is terminated by“return” statement, the CPU time monopoly will stillexist cannot be canceled.

• If the execution of step actions is terminated with a “quit” statement in an SFC block,the CPU time monopoly will be canceled.

● Limitations in the Section between the “nopreempt begin” and“nopreempt end” Statements

The SFC block monopolizing CPU time continues to execute processing, and if a wait stateoccurs, CPU time cannot be allocated to other SFC blocks in the FCS. Because of this,statements that can be described between the “nopreempt begin” and “nopreempt end”statements are subject to the limitations given below. If these limitations are disregarded, arun-time error occurs.

• The statements between the “nopreempt begin” and “nopreempt end” statementsmust be described within 20 lines. The “nopreempt begin” and “nopreempt end”statements are not included in these 20 lines. The 21st line and those after are ex-ecuted when CPU time is allocated for the next time, without monopolizing CPU time.If there is an error or errorsub indication in the 21st line, even if there is common errorhandling, it will not branch into error handling and a SEBOL error message will alwaysbe output.

• The data of other FCS cannot be accessed. If an attempt to access data is made, arun-time error occurs and data cannot be read or written.

• When a condition is not satisfied at one time in a “compare” statement, the statementacts the same way as when the time designation counts up.

• A “drive” statement cannot be used.

• “drive vpmon” statement and “drive vpmoff” statement cannot be used.

SEE ALSO

• For the “drive vpmon” statement, see the following:

D7.8.2, “drive vpmon Statement”

• For the “drive vpmoff” statement, see the following:

D7.8.3, “drive vpmoff Statement”

10th Edition : Dec.18,2003-00

H1-238

IM 33S01B30-01E

<H1.10 Allocating CPU Time Using nopreempt Statements>

• The drivewait designation cannot be used in “seqtable” statement and “logicchart ”statement.

• “while to wend,” “repeat to until” and “for to next” cannot be used, since they create aone-cycle delay each time processing is repeated. On the other hand, “while towend@,” “repeat to until@” and “for to next@” do not create a delay each time pro-cessing is repeated, and therefore can be used.

• A “wait until” statement cannot be used.

• A “delay” statement and “delaycycle” statement cannot be used.

• A signal cannot be sent to another FCS.

• A “qsigcancel” statement and “qsigmove” statement cannot be used in an SFC blockin another FCS.

• A “dialogue” statement cannot be used.

• A “nopreempt begin” statement cannot be used.

• A “semlock wait” statement cannot be used. However, a “semlock” statement withouta wait designation can be used.

• A “wait for qsignal” statement cannot be used.

• An “ssdtwrite” statement and “ssdtwritebit” statement cannot be used.

If an on-demand run-time error occurs between a “nopreempt begin” and a “nopreemptend” statement, the monopolization of CPU time will be canceled.

Even if an error variable is designated, if an error is detected during execution, the mo-nopolization of CPU time will be canceled. Also, even if an error or errorsub is designatedor the control branches into common error handling, the monopolization of CPU time will becanceled.

10th Edition : Dec.18,2003-00

H1-239

IM 33S01B30-01E

<H1.10 Allocating CPU Time Using nopreempt Statements>

● Limitations on CPU Time Monopolization

Table Limitations on CPU Time Monopolization

Statement Limitations Action when an error occurs

Expression, assignment statement,built-in function Cannot access data in other stations Action 1

drive Cannot use Action 2

compare Compares only once Action 1

seqtable Cannot designate drivewait Action 2

for to next Error when a delay occurs Action 3

while to wend Error when a delay occurs Action 3

repeat to until Error when a delay occurs Action 3

wait until Cannot use Action 2

delay Cannot use Action 2

delaycycle Cannot use Action 2

dialogue Cannot use Action 2

signal Send destination cannot be another station Action 1

qsigcancel SFC block of operation target cannot be another station Action 1

qsigmove SFC block of operation target cannot be another station Action 1

semlock wait Cannot use Action 2

nopreempt begin Cannot use Action 2

wait for qsignal Cannot use Action 2H011002E.EPS

logicchart Cannot designate drivewait Action 2

Actions when an error occurs when limitations are disregarded during execution are di-vided into the following three types:

● Action 1

Branching occurs if a branch destination is designated with the “error” or “errorsub” state-ment, or if there is common error handling. If the control branches into error handling, aSEBOL error message will not be output. When CPU time is allocated to that SFC block forthe next time, execution continues from the next line after the line in which the error oc-curred (if there is error handling, then error handling).

● Action 2

The control does not branch into error handling, even if a branch destination is designatedwith the error or “errorsub” statement, or if there is common error handling. The SEBOLerror message is always output. When CPU time is allocated to that SFC block for the nexttime, the line in which the error occurred is executed once again. In other words, executioncontinues from the line in which the error occurred.

● Action 3

Branching occurs if there is common error handling. If the control branches into the errorhandling processing, a SEBOL error message will not be output. When CPU time is allo-cated to that block for the next time, execution continues from the line after the “next,”“wend” or “until” statement (if there is error handling, then the error handling).

10th Edition : Dec.18,2003-00

H1-240

IM 33S01B30-01E

<H1.10 Allocating CPU Time Using nopreempt Statements>

SEE ALSO

Actions at the time of an error are the same as usual, except that CPU time monopolization is canceled.

For the details of error handling, see the following:

H1.13, “Error Handling”

■ Example of a “nopreempt” StatementThe following describes an usage example of the “nopreempt” statement:

● Example of Processing when an Interrupt Signal is Received

Even if an interrupt signal is received between the “nopreempt begin” and “nopreempt end”statements, processing for signal receive will not be processed until the “nopreempt end”statement is executed.

Also, even if a status change command is received, the status change will not be pro-cessed until the “nopreempt end” statement is executed. Pre-status change processingand status change will be executed after the “nopreempt end” statement is executed.

If the SFC block performing the process between the “nopreempt begin” and “nopreemptend” statements receives an interrupt signal, interrupt processing will be executed after the“nopreempt end” statement is executed.

......

nopreempt begin

......

signal "SG1" ! The SFC block performing the processing sends an interrupt

! signal to itself

opeguide OG, 2

......

nopreempt end

In this example, after [signal “SG1”] is executed, the lines following [opeguide OG ,2] willmonopolize CPU time as before and continue to be executed. At the point where the“nopreempt end” statement is completed, the SG1 interrupt signal will be processed.

TIP

• When execution of the program resumes after an error occurs, it will not monopolize CPU time untilthe “nopreempt” statement is executed once again.

• Interrupt signals or status change commands from another FCS are received while a “nopreempt”statement is being used. Because that SFC block is monopolizing CPU time, other SFC blocks withinthe same FCS do not execute “signal” statements, etc.

• The action is the same as for a sequence table is having an one-shot execution by a “seqtable”statement from an SFC block when it sends an interrupt signal to that SFC block via a %EV.

• The action is the same as for a logic chart is having an one-shot execution by a “logicchart” state-ment from an SFC block when it sends an interrupt signal to that SFC block via a %EV.

10th Edition : Dec.18,2003-00

H1-241

IM 33S01B30-01E

<H1.10 Allocating CPU Time Using nopreempt Statements>

● Example of Processing when Block Status is Changed to STOP

Even if the block status of the SFC block performing the processing is changed to STOPbetween the “nopreempt begin” and “nopreempt end” statements, that block continues tobe executed retaining its monopoly on CPU time until the “nopreempt end” statement.

However, the block status will be changed using the timing at which [%.BSTS=”STOP”] isexecuted.

......

nopreempt begin

......

%.BSTS = "STOP" ! % indicates the SFC block performing the processing

......

nopreempt end

In a SEBOL one-shot execution step or between a nopreempt begin and “nopreempt end”statement, even if the block status of the current SFC block is changed to STOP, it willretain its monopoly on CPU time and continue to be executed until the “nopreempt end”statement. However, if there is processing prior to the status change, then that processingis executed using the timing at which [%.BSTS=”STOP”] is executed, and the block statusis changed. If there is processing after the status change when the “nopreempt end” state-ment is reached, that processing is executed and monopolization on CPU time is canceled.When the post-status change processing is complete, execution of that SFC block iscomplete. If there is no post-status change processing, execution of the SFC block isterminated when the “nopreempt end” statement is reached.

TIP

• The action is the same for sequence table executed in one-shot with a “seqtable” statement when theblock status of that SFC block has been changed.

• The action is the same for sequence table executed in one-shot with a “logicchart” statement whenthe block status of that SFC block has been changed.

10th Edition : Dec.18,2003-00

H1-242

IM 33S01B30-01E

<H1.10 Allocating CPU Time Using nopreempt Statements>

● Example of Processing when Block Status is Changed to PAUS

In a SEBOL one-shot execution step or between the “nopreempt begin” and “nopreemptend” statements, even if the block status of the current SFC block is changed to PAUS, itwill retain its monopoly on CPU time and continue to be executed until the “nopreempt end”statement. However, if there is pre-status change processing, then that processing isexecuted using the same timing as [%.BSTS=“PAUS”], and the block status is changed. Ifthere is post-status change processing when the “nopreempt end” statement is reached,that processing is executed and monopolization on CPU time is canceled. When post-status change processing is complete, the execution of that SFC block is paused. If there isno post-status change processing, the execution of the SFC block pauses when the“nopreempt end” statement is reached.

......

nopreempt begin

......

%.BSTS = "PAUS" ! % indicates the SFC block performing the processing

......

nopreempt end

● Counting the Number of Execution Lines in CPU Time Allocation

In the “nopreempt” statement, the number of lines that can be executed while retaining amonopoly on CPU time is 20. The following reasoning is used in determining the number oflines:

• The execution lines are not lines from the source file, but lines to be executed.

• When lines are continued using // or \, they are counted as one line.

• When using “while” to ”wend@,” “repeat” to ”until@” or “for” to ”next@,” the executedlines are added up each time loop processing is repeated. With while, “wend@,”“until@” and “next@” statements, they are counted as one line even when loopprocessing is repeated. With the “for” statement, only the first of the repetitions arecounted; in other words, the initial value, final value and increments of the “for” state-ment are added only once at the beginning of the repetitions.

• “if,” “else if,” “switch” and “goto” statements are counted as one line.

• “end if,” “else,” “repeat,” “case” and “otherwise” statements are not counted as execu-tion lines. This is because these statements are only used to determine the branchingdestination of control statements.

• The “nopreempt begin” and “nopreempt end” statements are not counted as executionlines.

10th Edition : Dec.18,2003-00

H1-243

IM 33S01B30-01E

<H1.11 Managing Shared Resources Using semlock and ...>

H1.11 Managing Shared Resources Using semlockand semunlock Statement

▼ Managing Shared Resources

With the FCS, multiple SFC blocks are executed simultaneously, while shared re-sources after that use semaphores.

■ Shared Resources Based on SemaphoresWith the FCS, multiple SFC blocks are executed simultaneously. SEBOL uses a controlmethod called logical semaphores (or binary semaphores) to synchronize multiple SFCblocks within the same FCS.

When multiple SFC blocks are using a single resource, the use of the same resource bySFC blocks other than the one currently using the resource can be restricted by employingsemaphores.

• In a semaphore, the user assigns a name with a character string of 8 bytes or less.This name is called the “semaphore name”.

• When multiple SFC blocks within the same FCS perform a semaphore operation withrespect to the same semaphore name, they can be synchronized. The number ofsemaphores that can be used simultaneously within a single FCS is 10. If the numberof semaphores that can be used in a FCS is exceeded, a run-time error will occur.

• Only SFC blocks within the same FCS can be synchronized with semaphores.

• Semaphores cannot be used across different FCS for synchronization.

• If semaphores of the same name are used in multiple FCS, they are treated as sepa-rate semaphores.

10th Edition : Dec.18,2003-00

H1-244

IM 33S01B30-01E

<H1.11 Managing Shared Resources Using semlock and ...>

The following example shows how the semaphore [SEM0] is operated in two SEBOLprograms, prog1 and prog2:

prog1

Lock SEM0 Unlock SEM0

prog 2

Waiting to lock SEM0 Waiting for SEM0 is canceledand execution restarts

H011103E.EPS

Time

Figure Program Action Using Semaphore Management

10th Edition : Dec.18,2003-00

H1-245

IM 33S01B30-01E

<H1.11 Managing Shared Resources Using semlock and ...>

■ “semlock” Statement and “semunlock” StatementA semaphore is locked using a “semlock” statement, and the lock is released using a“semunlock” statement. If there is a wait designation in the “semlock” statement and thesemaphore is already locked, that SFC block will wait until the semaphore lock is released.If there is no wait designation in the “semlock” statement and the semaphore is alreadylocked, an error will occur immediately.

semlock [wait] <semaphore name> [;<error variable>] [; error <label> [, <error identifier>]] errorsub

semunlock <semaphore name> [; <error variable>] [; error <label> [, <error identifier>]] errorsub

<semaphore name> The semaphore name is designated with a character-string variable or character-string constant. If the character-string contains more than 9 bytes, those after the eighth byte are disregarded.

<error variable> This designates the local variable that sets the error code. This is set to 0 when no error occurs.

<label> Designates the branching destination for an error occurrence.

<error identifier> This designates the constant or local variable to identify the location in which the error occurred in error handling.

H011104E.EPS

• A run-time error occurs when a single SFC block tries to duplicate a lock to the samesemaphore. An error will still occur even if there is a wait designation.

• If an attempt is made to unlock a semaphore that is not locked, an error will occurwhen that SFC block is executed.

• When a “semlock wait” statement is executed and the program enters a wait status forsemaphore unlock, program execution stops until the semaphore is unlocked. How-ever, if an interrupt signal is received during this condition, processing to receive theinterrupt signal is executed. Also, a status change command can be received evenwhen the program is in waiting status for semaphore unlock status.

• Pre- and post-status change processing are executed at the time the status changecommand is received, and if a status change is executable, the block status ischanged. A “semlock wait” statement cannot be used in interrupt signal processing,post-status change processing or common error handling. A “semlock” statementwithout wait designation and a “semunlock” statement can be used. Also, a “semlock”statement, “semlock wait” statement and “semunlock” statement cannot be used inpre-status change processing.

• If there is an SFC block waiting for the release of a lock at the time a semaphore isunlocked using a “semunlock” statement, the wait status is canceled and executionresumes. If there are multiple SFC blocks in lock-waiting status, the locks are can-celed in the order that they assumed the status of waiting for semaphore unlock.

• When the SFC block locking a semaphore is complete (block status of the SFC blockchanges to STOP or ABRT), the semaphore is unlocked.

10th Edition : Dec.18,2003-00

H1-246

IM 33S01B30-01E

<H1.11 Managing Shared Resources Using semlock and ...>

• Even if an SFC block that is locking a semaphore pauses (block status of the SFCblock changes to PAUS), the semaphore lock is not canceled. If the SFC block pauseswhile keeping locks of semaphores, the SFC block waiting for the release of thosesemaphore locks will remain in the waiting status for unlock. Release the lock asnecessary using the “semunlock” statement in the post-status change processing ofthe PAUS command. An example of this application is given below:

Pauseprocessing

1

Initialization

Phase 1

1

2

Phase 2

Pause

3

H011105E.EPS

semlock wait "SEM1"

integer err . . . . .

semlock "SEM01" ; err

Main program

Processing after the PAUS status change

Release the lock with the status changeprocessing, since SEM1 should not remain ina locked condition if there is a pause duringthis interval.

semlock "SEM01"

The lock on semaphore SEM01 is releasedunconditionally. Since the error variable "err" isdesignated, even if semaphore SEM01 is notlocked, the SEBOL error message is not outputjust by setting the error code to "err."

Figure Releasing the Semaphore Lock During a Pause

• There is a system fixed data item, SEMA, in SFC blocks. The semaphore name that islocked with a semlock or “semlock wait” statement is set in the SEMA. When a singleSFC block has locked multiple semaphores, the semaphore name that was lockedfirst is set in SEMA. If, by releasing a semaphore lock with the “semunlock” statement,the status changes to where there are no locked semaphores, the SEMA becomes acharacter string of length 0.

10th Edition : Dec.18,2003-00

H1-247

IM 33S01B30-01E

<H1.11 Managing Shared Resources Using semlock and ...>

■ Deadlock and How to Prevent ItIf multiple SFC blocks attempt to lock two or more semaphores simultaneously, it is pos-sible that the semaphores already locked in each of these SFC blocks may enter the waitstatus for lock release with respect to each other. This condition is referred to as “dead-lock”. When a single SFC block locks two or more semaphores at the same time, certainconsiderations are necessary so that deadlock does not occur.

● What is Deadlock?

As an example, suppose two SEBOL programs, sebol1 and sebol2, lock two semaphores,SEM1 and SEM2. As shown below, if sebol1 executes a “semlock” statement with waitdesignation for SEM1, then SEM2 and sebol2 executes the same statement for SEM2,then SEM1. Both programs may enter a wait status for semaphore unlock, depending onthe timing. This condition is called deadlock.

sebol1 sebol2

semlock wait SEM1Locks SEM1

semlock wait SEM2Locks SEM2

semlock wait SEM2Waits for SEM2 to unlock

semlock wait SEM1Waits for SEM1 to unlockTime

Deadlock

H011106E.EPS

Figure Deadlock

● Preventing Deadlocks

Adopt the following procedures when using semaphores to prevent deadlock:

• A single SFC block should use only one semaphore.

• If a single SFC block uses multiple semaphores simultaneously, avoid using waitdesignations as much as possible.

• If multiple semaphores must be used simultaneously with a wait designation, have allSFC blocks lock semaphores in the same order.

● Releasing a Deadlock

The only way to release a deadlock is to forcibly terminate one or other of the SEBOLprograms. When either of the SEBOL programs is forcibly terminated, the semaphorelocked by that program is released and the semaphore wait status of the other program iscanceled.

10th Edition : Dec.18,2003-00

H1-248

IM 33S01B30-01E

<H1.12 Signal Processing>

H1.12 Signal Processing▼ Signal Processing

Signal processing in SEBOL includes signal transmission processing and signalreception processing. In this chapter, signal processing in SEBOL is explained.

■ Signal Processing in SEBOLThere are the following two types of signal processing in SEBOL:

● Signal Transmission Processing

In the SEBOL program, this processing transmits signals using the “signal” statement. Thetransmitted signals are treated as queue signals or interrupt signals depending on thedescription in the SFC block on the reception side.

● Signal Reception Processing

Signal reception processing consists of queue signal processing and interrupt signalprocessing.

• Queue signal processing:In the SEBOL program, the processing that retrieves a signal arbitrarily from signalqueue and executes the signal is called queue signal processing.

• Interrupt signal processing:The processing executed when it interrupts the SEBOL program using the timing atwhich an interrupt program is received is called interrupt signal processing.

SEE ALSO

• For the queue signal processing, see the following:

D5.6.1, “Queue Signal Processing”

• For the interrupt signal processing, see the following:

D5.6.3, “Interrupt Signal Processing”

10th Edition : Dec.18,2003-00

H1-249

IM 33S01B30-01E

<H1.12 Signal Processing>

■ Signals Available in Signal Processing

● Signal Names

A signal name received by SEBOL program is a character string of eight bytes or less.

● Signal Parameter

Up to eight signal parameters can be added to a signal. The integer, long, float, double, andcharacter-string types can be used for signal parameters. Up to 16 bytes can be used for acharacter-string type signal parameter.

● Queue Signal and Interrupt Signal

Whether the signal is treated as a queue signal or an interrupt signal depends on theSEBOL description in the SFC block that will receive the signal. Signal type is not specifiedwhen the signal is transmitted.

At the initial step in the SFC block at signal reception, if the signal name has been specifiedin the “queue signal” statement, that signal will become a queue signal.

If the signal name is described at the beginning of an interrupt signal processing, that signalwill become an interrupt signal.

10th Edition : Dec.18,2003-00

H1-250

IM 33S01B30-01E

<H1.12 Signal Processing>

H1.12.1 Signal Transmission ProcessingTo send a signal to SFC block, “signal” statement can be used. To send a Queuesignal or to send an Interrupt signal depends on the scripts in the SEBOL program.

■ The “signal” Statement: Signal TransmissionUse the “signal” statement to transmit a queue signal or an interrupt signal to the SFCblock.

A signal can be transmitted to a unit using the “signal” statement.

SEE ALSO

For the signal transmission to a unit, see the following:

“■ Transmitting Signals to Units” in D5.7, “Manipulating Unit Instrument from SFC Block”

■ Signal Transmission to Present SFC BlockThe “signal” statement in the type of “signal transmission to the present SFC block” willtransmit the signal to the SFC block the “signal” statement has been executed. If the SFCblock of the signal transmission destination cannot receive the signal, a run-time erroroccurs.

signal <signal name> [,<signal parameter>···] [; <error variable>] [; error <label> [, <error identifier>] ] errorsub

<signal name> Designate the signal name using a character-string constant or a character-string variable not exceeding 8 bytes.

<signal parameter> Designate a signal parameter using a numeric expression or a character string. The integer, long, float, double, and character-string types can be used for a signal parameter. If the character string exceeds16 bytes, only the first 16 bytes are valid. Up to eight signal parameters can be designated.

<error variable> Designate the local variable to which the error code is set. If no error occurs, this is set to 0.

<label> Designate the branching destination at the time an error occurs.

<error identifier> Designate a local variable or a constant to identify where the error was generated in the error handling section.

H011201E.EPS

10th Edition : Dec.18,2003-00

H1-251

IM 33S01B30-01E

<H1.12 Signal Processing>

■ Signal Transmission to Other SFC BlocksThe “signal” statement in the type of “signal transmission to other SFC blocks” can transmitthe signal to the SFC blocks that exist in FCS other than the one to which the SFC blockexecuting the “signal” statement belongs. If the SFC block of the signal transmissiondestination cannot receive the signal, a run-time error occurs.

signal <signal name> [,<signal parameter>···] to <destination tag name> [return <return signal name>] [; <error variable>] [; error <label> [, <error identifier>] ] errorsub

<signal name> Designate the signal name using a character-string constant or a character-string variable not exceeding 8 bytes.

<signal parameter> Designate a signal parameter using a numeric expression or a character string. The integer, long, float, double, and character-string types can be used for a signal parameter. If the character string exceeds16 bytes, only the first 16 bytes are valid. Up to eight signal parameters can be designated.

<destination Designate the tag name of the SFC block at the signal tag name> transmission destination. Tag names declared in a "block" statement, local generic name declared in a "genname" statement or dummy argument function blocks declared in a "argblock" statement can be designated.

<return signal name> The signal name returned by the SFC block that received the queue signal when the signal processing is started.

<error variable> Designate the local variable to which the error code is set. If no error occurs, this is set to 0.

<label> Designate the branching destination at the time an error occurs.

<error identifier> Designate a local variable or a constant to identify where the error was generated in the error handling section.

H011202E.EPS

10th Edition : Dec.18,2003-00

H1-252

IM 33S01B30-01E

<H1.12 Signal Processing>

■ Tag Name Change at Signal Transmission DestinationBy using the “signal” statement in the type of “signal transmission to other SFC blocks” andthe local generic name simultaneously, the tag name at the signal transmission destinationcan be changed freely.

An example of tag name change for signal transmission destination is shown below:

Assume that the return signal name is designated for the first parameter of the receivedsignal, and the tag name string character for the second parameter of the SFC block towhich the signal will be returned. In the SFC block that received the signal, the signal nameand the recipient tag name are retrieved using the “creadpara” built-in function. Then, theretrieved tag name of the opponent is corresponded to the local generic name “gen001”using an “assign” statement and a signal is returned.

.....

genname SFC gen001

char*16 signame,tagname

.....

signame = creadpara(1)

tagname = creadpara(2)

assign tagname to gen001

signal signame to gen001

.....

SEE ALSO

For “creadpara,” see the following:

“■ Fetching Signal Parameters” in D5.6.1, “Queue Signal Processing”

10th Edition : Dec.18,2003-00

H1-253

IM 33S01B30-01E

<H1.12 Signal Processing>

■ Returning the SignalIf the “return”<return signal name> is specified when a queue signal is transmitted toanother SFC block, the signal with <return signal name> is returned to the SFC block thatexecuted the “signal” statement when the SFC block that received the queue signal startsthe signal processing. The signal processing is started using the timing at which, to bestrict, the signal recipient SFC block escapes from the “wait for qsignal” statement to start asignal processing.

The first parameter for the return signal will be a long type, as shown below:

• 0 : Signal processing started

• 1 : Canceled. When the signal is canceled by the SFC block that sent the signal,there will be no return message.

• 2 : SFC block aborted before the signal processing start. Or the block is stoppedwhen the message returned. When the SFC block is stopped by a fatal error or byABRT command, block status may become ABRT and the message can not bereturned.

• 3 : Error is detected when retrieving a queue signal.

In the following cases, the “signal” statement with the “return” designation will cause anerror:

• The SFC block that executed the “signal” statement does not have an interrupt signalprocessing for the <return signal name> and the <return signal name> has not beendeclared in the “queue signal” statement.

• The corresponding signal name has not been declared in the “queue signal” state-ment in the signal recipient SFC block.

Since the signal transmitted by a “signal” statement with the “return” designation is a queuesignal, an error would result if the signal has been defined as an interrupt signal in thesignal recipient SFC block, and the signal will be ignored.

If the SFC block that has sent a signal using the “signal” statement with “return” designationcannot receive the return signal, a SEBOL error message of the SFC block that attemptedto send the return signal will be output. In this case, the SFC block that attempted to sendthe return message is not affected in the execution, and no branching will occur even if acommon error handling exists.

TIP

• The system may not be able to receive the return signal if it has already received maximum numberof queue signals.

• The system will transmit a return signal when a queue signal is canceled or the SFC block thatreceived the queue signal is stopped. If this transmission results in an error, the line number and stepnumber in the resultant SEBOL error message indicate the position of the “wait for qsignal” state-ment.

10th Edition : Dec.18,2003-00

H1-254

IM 33S01B30-01E

<H1.12 Signal Processing>

H1.12.2 Processing of Queue SignalUsing the “qsigcancel” statement and “qsigmove” statement, the queue signals ofthe present SFC block or other SFC blocks can be manipulated. However, interruptsignals cannot be manipulated.

The “qsigcancel” statement cancels the signal waiting for processing from thequeue.

The “qsigmove” statement moves a specified signal to the top of the queue.

■ “qsigcancel” Statement: Canceling a Signal from the QueueThe “qsigcancel” statement cancels the signal waiting for processing from the queue.

Only the signals in the queue can be manipulated by the “qsigcancel” statement. Evenwhen a “qsigcancel” statement is executed to a signal which has been set to a “signal inprocess” state using a “wait for qsignal,” that signal is not affected. To cancel the signalqueue of the present SFC block, execute a “qsigcancel” statement without tag namedesignation. To cancel the signal queue of other SFC block, execute the “qsigcancel”statement with tag name designation.

● Canceling All Signals in the Queue

Executing a “qsigcancel” statement with no designation will cancel all signals in the queuein the SFC block in which the “qsigcancel” statement was executed.

qsigcancel [to <tag name> ] result <number of signals canceled> [; <error variable>] [; error <label> [, <error identifier>] ] errorsub

<tag name> Designate the tag name of the subject SFC block when manipulating the signal queue of other SFC block. Tag names declared in the "block" statement, local generic name declared in the "genname" statement or dummy argument function block declared in the "argblock" statement can be designated. This can be omitted if the signal queue of the present SFC block is manipulated.

<number of signals canceled> Designate an integer-type local variable name to return the number of signals canceled from the queue.

<error variable> Designate the local variable to which the error code is set. If no error occurs, this is set to 0.

<label> Designate the branching destination at the time an error occurs.

<error identifier> Designate a local variable or a constant to identify where the error was generated in the error handling section.

H011203E.EPS

10th Edition : Dec.18,2003-00

H1-255

IM 33S01B30-01E

<H1.12 Signal Processing>

● Canceling by Specifying a Specific Signal

If a <signal name> is designated in the “qsigcancel” statement, all the signals having the<signal name> will be canceled.

qsigcancel <signal name> [,<signal parameter number>, <signal parameter>] [to <tag name>] result <number of signals canceled> [; <error variable>] [; error <label> [, <error identifier>] ] errorsub

<signal name> Designate the queue signal name using a character-string constant or a character-string variable not exceeding 8 bytes.

<signal parameter number> Designate a signal parameter number using a numeric expression.

<signal parameter> Designate a signal parameter using a numeric expression or a character string. The signals whose signal parameter for the <signal parameter number> is the same as the <signal parameter> will be the target of control.

<tag name> Designate the tag name of the subject SFC block when manipulating the signal queue of other SFC block. Tag names declared in the "block" statement, local generic name declared in the "genname" statement or dummy argument function block declared in the "argblock" statement can be designated. This can be omitted if the signal queue of the present SFC block is manipulated.

<number of signals canceled> Designate an integer-type local variable name to return the number of signals canceled from the queue.

<error variable> Designate the local variable to which the error code is set. If no error occurs, this is set to 0.

<label> Designate the branching destination at the time an error occurs.

<error identifier> Designate a local variable or a constant to identify where the error was generated in the error handling section.

H011204E.EPS

The number of signals canceled from the queue is returned to the <number of signalscanceled>. 0 is returned if none has been canceled, and the “qsigcancel” statement termi-nates normally. If the specified <signal name> had not been declared as the “queue signal”in the initial step of the SFC block that is to be manipulated, the “qsigcancel” statementresults in a run-time error. The scope of manipulated signals can be further narrowed byspecifying <signal parameter number> and <signal parameter>.

10th Edition : Dec.18,2003-00

H1-256

IM 33S01B30-01E

<H1.12 Signal Processing>

The following explains the specification method to cancel the signal “SIG 1,” whose firstparameter value is “HI,” and return the number of signals canceled to the variable“ncancel”.

qsigcancel "SIG1", 1, "HI" result ncancel

The following explains the specification method to cancel the signal “SIG 2,” whose thesecond parameter value is 5.

qsigcancel "SIG2", 2,5 result ncancel

If a numeric signal parameter is used to narrow the scope of signals that are manipulated,use the integer type (integer or long). If the signal parameter is a real number (float ordouble), the data might be evaluated as “disagreed” due to the discrepancy. Because realnumber data has a finite precision, in most cases, a negligible error occurs during typeconversion from double or float, or calculation is performed. If the value containing sucherror is compared, the result will not match.

● Execution Example of “qsigcancel” Statement

Signal queue

SG2

5

SG1

3

SG1

7

SG3

0

SG1

3

Signal queue

SG2

5

SG1

7

SG3

0

Execute qsigcnacel “SG1”, 1, 3 result ncancel

H011205E.EPS

Figure Execution Example of “qsigcancel” Statement

10th Edition : Dec.18,2003-00

H1-257

IM 33S01B30-01E

<H1.12 Signal Processing>

■ “qsigmove” Statement: Moving the Arbitrary Signal to Top of QueueThe “qsigmove” statement moves the specified signal to the top of the queue. By using the“qsigmove” statement, the user can instruct the following signal processing.

Only the signals in the queue can be moved by the “qsigmove” statement. Even when a“qsigmove” statement is executed to a signal which has been set to a “signal in process”state using a “wait for qsignal,” that signal is not affected.

The “qsigmove” statement moves a signal to the top of the queue. A “qsigmove” statementcan manipulate only one signal at a time. Even if multiple signals that are target of manipu-lation exist, only the signal that comes first in the processing order will be moved.

To move the signal queue of the present SFC block, execute a “qsigmove” statementwithout tag name designation. To move the signal queue of other SFC block, execute the“qsigmove” statement with tag name designation.

qsigmove <signal name> [, <signal parameter number>, <signal parameter>] [to <tag name> ] result <move result> [; <error variable>] [; error <label> [, <error identifier>] ] errorsub

<signal name> Designate the queue signal name using a character-string constant or a character-string variable not exceeding 8 bytes.

<signal parameter number> Designate a signal parameter number using a numeric expression.

<signal parameter> Designate a signal parameter using a numeric expression or a character string. The signals whose signal parameter for the <signal parameter number> is the same as the <signal parameter> will be the target of control.

<tag name> Designate the tag name of the subject SFC block when manipulating the signal queue of other SFC block. Tag names declared in the "block" statement, local generic name declared in the "genname" statement or dummy argument function block declared in the "argblock" statement can be designated. This can be omitted if the signal queue of the present SFC block is manipulated.

<move result> Designates the name of an integer-type local variable to return the move result. 1 is returned if the specified signal is placed at the top of the queue, and 0 if the specified signal does not exist in the queue.

<error variable> Designate the local variable to which the error code is set. If no error occurs, this is set to 0.

<label> Designate the branching destination at the time an error occurs.

<error identifier> Designate a local variable or a constant to identify where the error was generated in the error handling section.

H011206E.EPS

10th Edition : Dec.18,2003-00

H1-258

IM 33S01B30-01E

<H1.12 Signal Processing>

If a numeric signal parameter is used to narrow the scope of signals that are manipulated,use the integer type (integer or long). If the signal parameter is a real number (float ordouble), the data might be evaluated as “disagreed” due to the discrepancy. Because realnumber data has a finite precision, in most cases, a negligible error occurs during typeconversion from double or float, or calculation is performed. If the value containing sucherror is compared, the result will not match.

● Execution Example of “qsigmove” Statement

Signal queue

SG2

5

SG1

3

SG1

7

SG3

0

SG1

3

Execute qsigmove "SG1," 1, 3 result nmove

Signal queue

SG2

5

SG1

7

SG3

0

SG1

3

SG1

3

H011207E.EPS

Figure Execution Example of “qsigmove” Statement

10th Edition : Dec.18,2003-00

H1-259

IM 33S01B30-01E

<H1.12 Signal Processing>

H1.12.3 Masking the Interrupt SignalInterrupt signal can be masked using the “isigmask” statement, and be unmaskedusing the “isigunmask” statement.

■ “isigmask” Statement: Masking the Interrupt SignalInterrupt signal processing against SFC blocks can be temporarily avoided (masked).

To mask the interrupt signal, the “isigmask” statement is used.

To cancel the masking of the interrupt signal, the “isigunmask” statement is used.

The “isigmask” statement and “isigunmask” statement are valid for all interrupt signals inthe SFC blocks that receive the signal. Interrupt signals cannot be masked individually bynames. Interrupt signals are not masked by the default setting.

If an interrupt signal is received while interrupt signals are masked, the interrupt signaldoes not interrupt the execution. Interrupt signals that are received while interrupt signalsare masked are queued, and they will be activated when the interrupt signal masking iscanceled.

Execution of the “isigmask” statement or “isigunmask” statement does not affect the inter-rupt signal that is activating.

10th Edition : Dec.18,2003-00

H1-260

IM 33S01B30-01E

<H1.13 Error Handling>

H1.13 Error Handling▼ Error Handling

This chapter explains the action of a SEBOL program when an error is causedduring execution and the description of error handling.

■ Error Handling in SEBOLEven when program with no compile errors is executed, run-time errors might occur. Forexample, if there is an error in the logic of an application program, errors such as calcula-tion overflow, calculation error caused by zero division and array subscript out-of-rangeerror might occur.

Also, if the power to FCS is not supplied or CPU is stopped, data access to other FCSresult in error.

■ Types of Error Handling in SEBOLThere are two types of error handling methods:

• Describe error handling for each statement that accompanies input/output or commu-nication, such as “drive” and “dialogue” statements.

• Define common error handling and describe processing for error occurrences such asa calculation overflow.

If an error is caused when there is no common error handling or when error handling foreach statement is not or cannot be designated, an SEBOL error message is output as asystem alarm. In this case, the execution of the SEBOL program is continued or aborteddepending on the nature of the error.

10th Edition : Dec.18,2003-00

H1-261

IM 33S01B30-01E

<H1.13 Error Handling>

H1.13.1 Error Handling for Statements with I/O orCommunicationFor statements that accompany input/output or communication such as “drive”statement or “dialogue” statement, error handling can be described for each state-ment.

■ Types of Error Handling for Statements with I/O or CommunicationDescription methods for error handling for the statements with I/O and communicationinclude the following two types:

• Check the error variable

• Specify a branching destination to jump to at error occurrences

If error handling contents vary for each executed line, describe error handling to check theerror variable. When the same error handling is executed for multiple execution lines, it isrecommended to specify a branching destination to jump to at error occurrences.

Statements for which error handling can be described individually are as follows:

• [ ]: Group assignment statement

• drive: Changes the output status of motor blocks and switch instruments.

• compare: Group comparison statement

• seqtable: Operates sequence tables.

• logicchart: Operates logic charts.

• wait until: Holds operation until condition is satisfied.

• dialogue: Exchanges with operator on HMI

• signal: Outputs signals.

• qsigcancel: Cancels queuing signals.

• qsigmove: Shift queuing signals.

• semlock: Locks semaphores.

• semunlock: Unlocks semaphores.

• wait for qsignal: Waits for reception of a queued signal.

10th Edition : Dec.18,2003-00

H1-262

IM 33S01B30-01E

<H1.13 Error Handling>

■ Error Variable CheckWhen an error variable is described, 0 is set to the error variable if the statement is termi-nated normally. An error code is set if an error occurs. When the detail error code is 0, anerror class code is set in the error variable. If the detail error code is not 0, a detail errorcode is set in the error variable.

SEE ALSO

• For error class codes, see the following:

H1.13.3, “Error Class Codes”

• For detail error codes, see the following:

H1.13.4, “Detail Error Codes”

If an error variable is described, no error message is output even if an error occurs duringexecution. (Message is output if the error is fatal.) However, error message is output if anerror, such as array-subscript out-of-range error, occurs while setting an error code to theerror variable.

Error handling syntax in the statements with I/O and communication is shown below. Thesemicolon (;) is not added at the beginning of an error variable for group substitution andcomparison statements.

[; <error variable>] [; error <label> [, <error identifier>] ] errorsub

H011301E.EPS

• Only integer-type or long-type local variables can be set as error variables. Thefunction block data cannot be set.

• Only constants or local variables can be set to error identifier.

10th Edition : Dec.18,2003-00

H1-263

IM 33S01B30-01E

<H1.13 Error Handling>

■ Setting Branching Destination for Error OccurrenceWhen a common error-handing instruction is applicable to multiple lines, a branchingdestination can be specified so that the processing branches out to the same destinationwhen errors occur.

[; <error variable>] [; error <label> [, <error identifier>] ] errorsub

<error variable> Designate an integer-type local variable to which the error code is returned when an error is caused. If no error occurs, this is set to 0.

<label> Designate the branching destination at the time an error occurs.

<error identifier> Designate an integer, real or character-string type constant or local variable to identify where the error was generated in the error handling section. In the case of a character string, the first 16 bytes are valid and the remaining bytes are ignored.

H011302E.EPS

• Specify the branching destination for an error occurrence using “error” or “errorsub”.

• If an error occurs in the line where the branching destination is specified, error mes-sage is not output, and the control branches out to the specified destination.

• If branching destination is designated for “error,” only a branching-out action is takenwhen an error occurs.

• If branching destination is designated for “errorsub,” a branching-out action is takenwhen an error occurs, and the program execution can be continued from the linefollowing the line where the error occurred using an “ereturn” statement, after the errorhandling is completed.

<label>:

<error handling at branched destination for errorsub>

ereturn

H011303E.EPS

Even when branching destination is specified, 0 is set to the error variable for normalcompletion and an error code is set when an error occurs.

At the branching destination of “error” and “errorsub,” the value of error identifier specifiedfor the error occurrence line can be obtained by the built-in functions “cerrorid,” “lerrorid”and “derrorid”.

cerrorid()lerrorid()derrorid()

H011304E.EPS

Since the “cerrorid,” “lerrorid” and “derrorid” are the character-string type (char*16), longtype and double type, respectively, they can be selectively used according to the type of thespecified error identifier.

10th Edition : Dec.18,2003-00

H1-264

IM 33S01B30-01E

<H1.13 Error Handling>

■ Description Example of Error HandlingDescription examples of error handling are shown in this section.

● Example of Operating a Switch Instrument Using “drive” Statement andPerforming Error Handling if an Error Occurs

Examples of “error” and “errorsub” designations are shown below:

Branching by “error” is used when SFC block is terminated without any action after theerror handling is complete.

If it is within a function, the program will return using a “return” statement without any actionafter the error handling. As for the branching by “error” designation of a “drive” statement,the error information is output as a message, and SEBOL is terminated by an “exit” state-ment.

As for branching by “errorsub,” the control returns to the line following the line where theerror occurred after the error handling. Hence, this method is used when continuousexecution of SFC blocks is required.

10th Edition : Dec.18,2003-00

H1-265

IM 33S01B30-01E

<H1.13 Error Handling>

If an error variable is specified as in the first “drive” statement in the following example, 0 isset to the error variable if the “drive” statement ends normally, and an error code is set tothe error variable if an error occurs during execution. Hence, by inspecting whether or notthe error variable is 0 in a condition expression using an “if” statement, the error handlingwhich is executed only when an error occurs can be described.

#define OPEN 2

block SIO-22 SWITCH01,SWITCH02,SWITCH03

integer errval

......

drive [SWITCH01 = OPEN] errval ! error variable example

if (errval 0) then

! — state error handling here —-

endif

......

drive [SWITCH02 = OPEN];error ERR000,2 ! example of branching at error

! occurrence

......

drive [SWITCH03 = OPEN];errorsub ERR010,3 ! example of branching at error

! occurrence

......

exit

......

ERR000:

! — branching destination of

! "error" designation —-

message "drive error:line=%d %d-%x ID=%d\n",\

errl(), errc(), errce(), lerrorid()

exit -1

......

ERR010:

! — branching destination of

! "errorsub" designation —-

message "drive error:line=%d %d-%x ID=%d\n",\

errl(), errc(), errce(), lerrorid()

ereturn

10th Edition : Dec.18,2003-00

H1-266

IM 33S01B30-01E

<H1.13 Error Handling>

● Example of Ignoring Errors

The error variable can be used to ignore errors. Errors are ignored if the error variable isnot checked after the statement that specified the error variable. It is not desirable to ignoreerrors in normal situations; however, the error-ignoring method may be useful when it isused to unlock a semaphore in the “semunlock” statement. For example, in a program thatmanipulates a semaphore, this method is effective when the semaphore must be in un-locked status.

integer junk

...... * Lock the "SEMNAME" depending on the condition.

.....

semunlock "SEMNAME" junk * Unlock the “SEMNAME” unconditionally, and do not

* check the error variable.

.....

■ Error Handling for Group StatementsMultiple data can be simultaneously accessed by using a group assignment statement,“drive” statement and “compare” statement. In this case, specify a local variable array asthe error variable. Because checking the error variable in an array is a time-consumingprocess, it is recommended that the error handling is described by specifying the branchingdestination using “error” or “errorsub” when accessing multiple data by using a groupstatement.

Since the error handling method varies depending on the line, prepare the following user-defined function to perform error handling by checking the error variable.

*** 0 is returned if the array elements of the error variable are all 0.

*** Otherwise, the first element number in which error was detected is returned.

integer function errcheck(val,v)

integer val[*] ! error variable array

integer n ! number of array elements

integer i

for i = 1 to n

if (val [i] 0) then

return i

end if

next@

return 0

10th Edition : Dec.18,2003-00

H1-267

IM 33S01B30-01E

<H1.13 Error Handling>

Use the user-defined function “errcheck” following a group statement, as shown below:

#define NUMBLOCK 3

block SIO-22 SWITCH01,SWITCH02,SWITCH03

integer errval[NUMBLOCK]

integer errcheck() ! user-defined function defined

! above.

......

drive [SWITCH01,SWITCH02,SWITCH03 = 2,2,2] errval[*]

if (errcheck(errval,NUMBLOCK) 0) then

!— Write error handling here—-

endif

......

10th Edition : Dec.18,2003-00

H1-268

IM 33S01B30-01E

<H1.13 Error Handling>

H1.13.2 Comparison of Actions by Error Class Code when anError OccursThe run-time error codes in SEBOL program consists of the error class codes anddetail error codes.

■ Actions when an Error OccursThe error class codes include the following three types, the details for each type and codeare shown as follows.

• Errors that can continue program execution: 1 through 19999

• Fatal errors: 20000 through 32767

• Insufficient area or internal errors: -100 through -32767

Actions taken when an error occurs vary depending on the classification of error classcodes.

● Errors that can Continue Program Execution

When an error that can continue program execution occurs, the control is branched out ifcommon error handling or branching destination designation by “entry” or “errorsub” exists.If an error handling or error variable is not specified, a SEBOL error message is output, andthe execution continues starting with the line that is following the erred line.

If an error occurs within a common error handling section or between an “errorsub” and“ereturn,” the control does not branch to the error handling even if there is a common errorhandling, or if there is “error” or “errorsub” designation. In this case, the program outputs aSEBOL error message and resumes execution starting with the line that is following theerred line. This is to avoid entering an infinite loop by repeating branching to error handling.

Also, even if an error occurs within the common error handling section or between an“errorsub” and “ereturn,” if an error variable is specified for the statement that allows indi-vidual error handling and if “error” and “errorsub” are not specified, error codes are set inthe error variable and no error messages are output.

SEBOL error message output does not sent an audible alarm.

● Fatal Errors

When a fatal error occurs, a SEBOL error message is unconditionally output and theexecution of the SFC block in which the fatal error occurred will be terminated. A fatal erroris an unrecoverable error, and occurs when an “ereturn” statement is executed with noreturn-destination, when function-call nests are specified exceeding three layers, etc.

● Insufficient Area or Internal Errors

When an insufficient area or an internal error occurs, a SEBOL error message is uncondi-tionally output and the execution of the SFC block in which insufficient area or internal erroroccurred will be terminated.

SEBOL error message output does not sent an audible alarm.

10th Edition : Dec.18,2003-00

H1-269

IM 33S01B30-01E

<H1.13 Error Handling>

H1.13.3 Error Class CodesThe following are the error class codes and their descriptions. Error class codes thathave detail error codes are indicated in the note column.

■ Calculation Error Codes

Table Calculation Error Code List

Decimal Hexadecimal Detail Description

1 $0001 Overflow by calculation

2 $0002 Type-conversion overflow

3 $0003 Zero division

4 $0004 Underflow (reserved)

5 $0005 Invalid calculation

6 $0006 Overflow by calculation in array-subscript calculation

10 $000A Out of array subscript range

11 $000B Assigning to a constant was attempted.

12 $000C Character-string array is designated where only numeric type is accepted.

13 $000D Numeric type is designated where only character-string type is accepted.

14 $000E Numeric and character-string types are mixed.

20020 $4E34 Calculation stuck/overflow.

20021 $4E35 Character-string range used for calculation is exceeded.

30 $001E Out of array subscript range of error variable.

31 $001F Type conversion overflow in error variable setting.

32 $0020 Error occurred in error variable setting.H011305E.EPS

10th Edition : Dec.18,2003-00

H1-270

IM 33S01B30-01E

<H1.13 Error Handling>

■ Function Block-Related Error Codes

Table Function Block Related Error Code List

Decimal Hexadecimal Detail Description

100 $0064 � Function block data access error

101 $0065 Function block data type is abnormal.

102 $0066 "compare" statement produced inconsistent results.

103 $0067 Character string of brand name has length 0.

104 $0068 Number of data on LH and RH sides do not agree.

105 $0069 Number of data on LH side is smaller than RH side data.

106 $006A Number of data on LH side is greater than RH side data.

107 $006B Number of elements for error-array is smaller than number of data.

108 $006C Number of data exceeded 32.

109 $006D Number of data exceeded 16.

118 $0076 Setting for the function block data is nonstandard floating point.

119 $0077 Setting for the function block data is infinite floating point.H011306E.EPS

�: Details of the error code is provided.

SEE ALSO

For the classified error codes that described in the detail error code list, see the following:

H1.13.4, “Detail Error Codes”

■ Error Codes Unique to the “drive” Statement

Table Error Codes Unique to the “drive” Statement

Decimal Hexadecimal Detail Description

120 $0078 The function-block with block-type name which cannot be used in “drive”statement was designated.

121 $0079 The block mode in which setting is prohibited in “drive” statement.

122 $007A Setting value for “drive” statement is other than 0, 1 or 2.

123 $007B Block mode has been changed during execution of “drive” statement.

124 $007C MV value has been changed during execution of “drive” statement.

125 $007D MV value has been changed after answerback check had been completed.

126 $007E ANS- alarm occurred during execution of “drive” statement.

127 $007F ANS+ alarm occurred during execution of “drive” statement.

128 $0080 PERR alarm occurred during execution of “drive” statement.H011307E.EPS

10th Edition : Dec.18,2003-00

H1-271

IM 33S01B30-01E

<H1.13 Error Handling>

■ Error Codes Related to Generic Names

Table Generic Name Related Error Code List

Decimal Hexadecimal Description

141 $008D Unassigned generic name is used.

142 $008E

Detail

“assign” statement error (*1)

148 $0094 Character-string tag name is “0.”

149 $0095 Generic name marked with an asterisk (*) was used (No error messageappears.)

150 $0096 Actual argument is not generic name (%,%%, or “block” declared tagname, etc.

H011308E.EPS

�: Details of the error code is provided.*1: This is an error class code when an error occurs in an operation that is being executed in the same unit instrument as

the operation that issued the “assign” statement is being executed.

SEE ALSO

For the classified error codes that described in the detail error code list, see the following:

H1.13.4, “Detail Error Codes”

■ Error Codes Related to “seqtable”, “logicchart” and “oneshot”Statement

Table “seqtable” and “logicchart” Statement with “oneshot” Statement Related Error Code List

Decimal Hexadecimal Description

160 $00A0

Detail

Execution errors in "seqtable" statement and "oneshot" statement.

161 $00A1 Function block of other control stations has been designated.

162 $00A2 Function block other than a sequence table has been designated.

163 $06A3 Function block other than a logic chart is designated.

164 $00A4 Function block which allows no periodic executions has been designated.

165 $00A5 Function block which allows no one-shot execution has been designated.

20166 $4EC6 SFC block was aborted due to an error detected in a sequence table step.

167 $00A7 "oneshot" statement cannot start a sequence table.H011309E.EPS

�: Details of the error code is provided.

SEE ALSO

For the classified error codes that described in the detail error code list, see the following:

H1.13.4, “Detail Error Codes”

10th Edition : Dec.18,2003-00

H1-272

IM 33S01B30-01E

<H1.13 Error Handling>

■ Error Codes Related to Process Management

Table Process Management Related Error Code List

Decimal Hexadecimal Detail Description

180 $00B4 � Common block data access error

20181 $4ED5 Batch ID not specified

182 $00B6 � urload or urassign execution error

183 $00B7 Invalid unit recipe number

184 $00B8 � rpreserve() execution error

185 $00B9 Recipe group number error

186 $00BA Null batch ID character-stringH011310E.EPS

�: Details of the error code is provided.

SEE ALSO

For the classified error codes that described in the detail error code list, see the following:

H1.13.4, “Detail Error Codes”

■ Error Codes Related to “time” Designation

Table “time” Designation Related Error Code List

Decimal Hexadecimal Detail Description

220 $00DC “time” designation counts up.

221 $00DDSpecified value for "delay" statement and “delaycycle” statement isnegative.

H011311E.EPS

■ Error Codes Related to “dialogue” Statement

Table “dialogue” Statement Related Error Code List

Decimal Hexadecimal Description

250 $00FA

Detail

Dialogue execution error.

251 $00FB“retry” designation of “dialogue” was executed while “dialogue” statementwas not executed.

252 $00FCHigh limit of the number of “dialogue” statements that are simultaneouslyexecutable at the station is exceeded.

253 $00FDHigh limit of statements that the SFC block can simultaneously execute isexceeded.

255 $00FFType of input variable in reentry-type “dialogue” statement are notcompatible with the input variable type in the data-entry type.

H011312E.EPS

�: Details of the error code is provided.

SEE ALSO

For the classified error codes that described in the detail error code list, see the following:

H1.13.4, “Detail Error Codes”

10th Edition : Dec.18,2003-00

H1-273

IM 33S01B30-01E

<H1.13 Error Handling>

■ Error Codes Related to Messages

Table Message Related Error Code List

Decimal Hexadecimal Description

270 $010E “snapshot” execution error

271 $010F No output value for formatting string-character conversion

272 $0110 Nonstandard floating point data (nan) has been designated.

280 $0118

Detail

Message output failure

281 $0119 Message number is out of the range of “1 to 9999.”

282 $011A Parameter value is out of the range of “0 to 65535.”

291 $0123 NR has been specified in the process alarm character string.

292 $0124 Process alarm character string has not been defined in the builder.

293 $0126 Length of the process alarm character string is “0.”

295 $0127 Outputting more than three messages are attempted while the CPU timewas monopolized.

296 $0128 Outputting more than one process alarm was attempted while the CPUtime was monopolized

H011313E.EPS

�: Details of the error code is provided.

SEE ALSO

For the classified error codes that described in the detail error code list, see the following:

H1.13.4, “Detail Error Codes”

10th Edition : Dec.18,2003-00

H1-274

IM 33S01B30-01E

<H1.13 Error Handling>

■ Error Codes Related to Signals

Table Signal Related Error Code List

Decimal Hexadecimal Description

300 $012C

Detail

Execution error in “signal” statement, “qsigcancel” statement or“qsigmove” statement. (Transferred to another station.)

301 $012D �

Execution error in “signal” statement, “qsigcancel” statement or“qsigmove” statement. (Transferred within the present station.)

302 $012E Function block with a code beyond manipulation range is specified.

303 $012F“signal” statement with “return” designation in SEBOL program isattempted.

304 #0130Signal reception process with a return signal name does not exist in theSFC block the “signal” statement was executed.

305 $0131 %EV signal transmission error

306 $0132Executions of “qsigcancel”/“qsigmove” statements whose tag name is notspecified in SEBOL program are attempted.

307 $0133 Signal parameter number is out of range.

308 $0134 Return signal transmission error (transferred to another station.)

309 $0135 Return signal transmission error (transferred within the present station.)

310 $0136 “wait for qsignal” statement execution error

311 $0137Execution of “wait for qsignal” statement in SEBOL program wasattempted.

312 $0138 Error was detected while canceling a queued signal in error handling.

313 $0139 “signal” statement execution error (signaled to the HIS.)

314 $013A Character string of the program name has length 0.

315 $013B Invalid station number

316 $013C Invalid domain number

317 $013D Signal reception error from HIS.

H011314E.EPS

�: Details of the error code is provided.

SEE ALSO

For the classified error codes that described in the detail error code list, see the following:

H1.13.4, “Detail Error Codes”

10th Edition : Dec.18,2003-00

H1-275

IM 33S01B30-01E

<H1.13 Error Handling>

■ Error Codes Related to SFC Block Control

Table SFC Block Control Related Error Code List (1/2)

Decimal Hexadecimal Detail Description

331 $014B Block mode cannot be changed to O/S because the block status is RUN.

332 $014C Block status cannot be changed to STOP because the block status is ABRT.

333 $014D Block status cannot be changed to RUN because the block status is ABRT.

334 $014E Status change command RSET cannot be received because the block status is RUN.

335 $014F Block status cannot be changed to ABRT because the block status is STOP.

336 $0150 Block status cannot be changed because the block mode is O/S.

337 $0151 � Error was detected while changing BSTS or STEPNO.

338 $0152 Status change command RSET cannot be received because the block status is PAUS.

339 $0153 Block status cannot be changed to PAUS because the block status is ABRT.

341 $0155 Block mode cannot be changed to SEMI due to the setting of SEMI mode action.

342 $0156 Block status cannot be changed because the pre-processing of status change is in execution.

343 $0157 Block status cannot be changed because the post-processing of status change is in execution.

344 $0158 Block status cannot be changed because the terminating process of the SFC block is inexecution.

345 $0159 SFC block cannot be started up because function type definition is under online maintenance.

346 $015ASFC block cannot be started up because the main program in SFC sequence or SEBOL isunder online maintenance.

H011315E.EPS

�: Details of the error code is provided.

SEE ALSO

For the classified error codes that described in the detail error code list, see the following:

H1.13.4, “Detail Error Codes”

10th Edition : Dec.18,2003-00

H1-276

IM 33S01B30-01E

<H1.13 Error Handling>

Table SFC Block Control Related Error Code List (2/2)

Decimal Hexadecimal Detail Description

20347 $4F7B Database corresponding to the specified SFC sequence name is not found.

20348 $4F7C Main program of SFC sequence or SEBOL block does not exist.

20349 $4F7D Data base common to the SEBOL stations do not exist.

350 $015E Status change was judged invalid in the pre-status change processing.

351 $015F Error was detected in the pre-status change processing.

352 $0160 Pre-status change processing exceeded the maximum number of execution lines.

353 $0161 Block mode cannot be changed because the pre-status change processing is in progress.

354 $0162 Block mode cannot be changed because the post-status change processing is in progress.

355 $0163 Block mode cannot be changed because the SFC block termination processing is in progress.

356 $0164 Online maintenance of the SFC sequence or SEBOL block main program is incomplete.

20357 $4F85 SEBOL area database does not exist.

358 $0166 The SFC block cannot be started up because it is under online maintenance.

360 $0168 Step number of interrupt processing was specified.

361 $0169 Non-existing step number was specified.

362 $016A STEPNO cannot be changed because the block status is PAUS.

363 $016B STEPNO cannot be changed because pre-status change processing is in progress.

364 $016C STEPNO cannot be changed because post-status change processing is in progress.

H011316E.EPS

■ Error Codes Related to Operation

Table Operation Related Error Code List

Decimal Hexadecimal Detail Description

380 $017C Block status of a monitoring operation with “independent” statement cannot be changed.

381 $017D Operation cannot be started from other than an unit instrument.

382 $017E “independent” statement is used in an SFC block that is not an operation.H011317E.EPS

10th Edition : Dec.18,2003-00

H1-277

IM 33S01B30-01E

<H1.13 Error Handling>

■ Error Codes Related to SEBOL Execution Control

Table SEBOL Execution Control Related Error Code List

Decimal Hexadecimal Detail Description

20411 $4FBB Reached common error handling directly.

20412 $4FBC Reached interrupt signal handling directly.

20413 $4FBD Reached pre-processing of status change directly.

20414 $4FBE Reached post-processing of status change directly.

20420 $4FC4 Execution of statement that main program cannot execute is attempted.

20421 $4FC5Execution of statement that is non-executable in an interrupt processingwas attempted.

20423 $4FC7Execution of statement that is non-executable in the pre-processing ofstatus change command was attempted.

20425 $4FC9 Execution of statement that is non-executable with function was attempted.

20430 $4FCE Execution of unsupported statement was attempted.

20431 $4FCF Execution of unsupported built-in function was attempted.

20432 $4FD0 Access to unsupported variable was attempted.

20433 $4FD1 Use of unsupported operator was attempted.

440 $01B8Execution of delay statement was attempted using a function called in thecondition expression of “wait until” statement.

450 $01C2Execution of non-executable statement was attempted while the CPU timewas monopolized.

451 $01C3Maximum number of execution lines during the CPU time wasmonopolized was attempted.

452 $01C4 Delay was attempted while the CPU time was monopolized.H011318E.EPS

■ Error Codes Related to Subsystem Communication

Table Subsystem Communication Related Error Code List

Decimal Hexadecimal Description

500 $01F4

Detail

Subsystem communication execution error

501 $01F5 Total data size exceeded 128 words.

502 $01F6 Floating-point data read from the subsystem is out of standards.

503 $01F7 Floating-point data read from the subsystem is overflowed.

504 $01F8 Total data size exceeded 1024 words.

505 $01F9 Total data size exceeded 64 words.

506 $01FAExceeded the high limit of “ssdtwrite” statement and “ssdtwritebit”statement that can be executed simultaneously at the station.

507 $01FB Address characters exceeded 8 bits.H011319E.EPS

�: Details of the error code is provided.

SEE ALSO

For the classified error codes that described in the detail error code list, see the following:

H1.13.4, “Detail Error Codes”

10th Edition : Dec.18,2003-00

H1-278

IM 33S01B30-01E

<H1.13 Error Handling>

■ Error Codes Related to User-Defined Function

Table User-defined Function Related Error Code List (1/2)

Decimal Hexadecimal Description

20600 $5078 User function calls nested at more than six levels.

20601 $5079 Attempt to execute an “ereturn” statement without a return address.

20602 $507A Function not existing in the database.

20603 $507B Function not builder-defined.

604 $025C Return value not received.

20605 $507D Accessed function-block data exceeds 32767.

20606 $507EForcibly terminating SFC/SEBOL block because online maintenance of function is not terminated.

20607 $507F Forcibly terminating SFC/SEBOL block because online function loading is not terminated.

608 $0260 Waiting for completion of online maintenance of function (*1).

609 $0261 Waiting for completion of online function loading (*1).

20610 $5082Overflow or zero-division detected in calculation of actual argument array subscript expression.

20620 $508C Numbers of formal and actual arguments not in agreement.

20621 $508DFormal argument is a simple local variable, disallowing assignment of entire local variable array to actual argument.

20622 $508EFormal argument is a simple local variable, disallowing assignment of function block to actual argument.

20623 $508FFormal argument is an entire local variable array, disallowing assignment of simple local variable or constant to actual argument.

20624 $5090Formal argument is an entire local variable array, disallowing assignment of local variable array element to actual argument.

20625 $5091

Detail

(*2)

(*2)

(*2)

(*2)

(*2)Formal argument is an entire local variable array, disallowing assignment of function block to actual argument.

H011320E.EPS

*1: If online maintenance is completed before fatal error 20606 or 20607 is caused, the SFC/SEBOL block properly callsfunctions to continue operation even when error 608 or 609 has been caused.

*2: Detailed error codes use the numbers of arguments, counting 1, 2, 3, and so on from the left.

10th Edition : Dec.18,2003-00

H1-279

IM 33S01B30-01E

<H1.13 Error Handling>

Table User-defined Function Related Error Code List (2/2)

Decimal Hexadecimal Detail Description

20626 $5092 (*1) Formal argument is a simple function block, disallowing assignment of entire function-block array to actual argument.

20627 $5093 (*1) Formal argument is a simple function block, disallowing assignment of local variable or constant to actual argument.

20628 $5094 (*1) Formal argument is an entire function-block array, disallowing assignment of simple function block to actual argument.

20629 $5095 (*1) Formal argument is an entire function-block array, disallowing assignment of function-block array element to actual argument.

20630 $5096 (*1) Formal argument is an entire function-block array, disallowing assignment of local variable or constant to actual argument.

20631 $5097 (*1) Formal argument is a character-string local variable, disallowing assignment of numeric local variable or constant to actual argument.

20632 $5098 (*1) Formal argument is a numeric local variable, disallowing assignment of character-string local variable or constant to actual argument.

20633 $5099 (*1) Formal argument is a character-string local variable array, disallowing numeric local variable array to actual argument.

20634 $509A (*1) Formal argument is a local variable array, disallowing assignment of character-string local variable array to actual argument.

20635 $509B (*1) Formal and actual arguments are both numeric local arrays but data types are different.

H011321E.EPS

*1: Detailed error codes use the numbers of arguments, counting 1, 2, 3, and so on from the left.

■ Error Codes Related to Semaphore

Table Semaphore Related Error Code List

Decimal Hexadecimal Description

701 $02BD Number of semaphores exceeded the number of semaphores defined atbuilder.

702 $02BE Semaphore has already been locked by another SFC block.

703 $02BF The specified semaphore has already been locked by the correspondingSFC block.

704 $02C0 The corresponding SFC block is waiting for unlocking of the specifiedsemaphore.

705 $02C1 The corresponding SFC block has not locked the specified semaphore.

706 $02C2 Character-string length of the semaphore name is 0.

707 $02C3 The number of semaphores of the builder-specified control station isnegative or exceeding 64.

708 $02C4

Detail

Semaphore execution errorH011322E.EPS

�: Details of the error code is provided.

SEE ALSO

For the classified error codes that described in the detail error code list, see the following:

H1.13.4, “Detail Error Codes”

10th Edition : Dec.18,2003-00

H1-280

IM 33S01B30-01E

<H1.13 Error Handling>

■ Error Codes Related to Valve Pattern Monitor

Table Valve Pattern Monitor Related Error Code List

Decimal Hexadecimal Detail Description

730 $02BA Valve pattern monitor execution error.

731 $02BB Generic name with * specification specified in vpmstart statement.

732 $02BC Parameter out of range.

733 $02BD Time specification value out of range.

734 $02BEData is not registered in valve pattern monitor because an error was detected in other data on the same line.

735 $02BFData is not deleted from valve pattern monitor because an error was detected in other data on the same line.

736 $02C0 Data is not registered in valve pattern monitor because output value of drive vpmon statement is 1. (The drive statement works.)

20740 $5104 Signal transmission error (from valve pattern monitor to unit) (This error message is output by valve pattern monitor.)

H011323E.EPS

�: Details of the error code is provided.

SEE ALSO

For the classified error codes that described in the detail error code list, see the following:

H1.13.4, “Detail Error Codes”

10th Edition : Dec.18,2003-00

H1-281

IM 33S01B30-01E

<H1.13 Error Handling>

■ Error Codes Related to Built-In Functions

Table Built-In Functions Related Error Code List

Decimal Hexadecimal Detail Description

800 $0320 Calculation overflow was detected within the built-in function.

801 $0321 Zero division was detected in the calculation within the built-in function.

802 $0322 Square-root calculation of negative value was attempted within the built-infunction.

803 $0323 Errors in “power()” or “log()” argument.

804 $0324 Absolute value of the argument for trigonometric function is too large tocalculate.

805 $0325 Calculation error occurred in the arithmetic built-in function.

806 $0326 Invalid character-string length or character position (left/right/mid built-infunction).

807 $0327 Low-limit value is larger than the high-limit value.

810 $032A Invalid number of arguments in the built-in function.

811 $032B Invalid argument type in the built-in function.

830 $033E Unset error identifier is referred.

831 $033F Error identifier cannot be referred because of an error committed during itssetting.

850 $0352 Signal parameter number is out of limits.

851 $0353 Signal parameter type does not match the function type.

852 $0354 “creadpara,” “Ireadpara,” or “dreadpara” was executed in a common errorhandling.

853 $0355 Signal parameter cannot be obtained because queued signal in process does not exist.

870 $0366 Non-existing data status is specified.H011324E.EPS

■ Error Codes Related to SEBOL and Others

Table SEBOL and Others Related Error Code List

Decimal Hexadecimal Detail Description

20901 $51A5 SFC block cannot be started due to insufficient dynamic reservation area.

20903 $51A7 Function cannot be called due to insufficient dynamic reservation area.

905 $0389 Unsupported foreign language was used.

910 $038E (*1) Remaining of the dynamic reservation becomes less than 10 %. (Messageappears when SFC/SEBOL is started up.) (*2)

911 $038F (*1) Remaining of the dynamic reservation area becomes less than 10 %.(Message appears when the function is called.) (*3)

H011325E.EPS

*1: Detail error code indicates the control station number.*2: The tag number added to this message indicates that the remaining area available for dynamic allocation has fallen

below 10 % upon start up of the block.*3: The function name added to this message indicates that the remaining area available for dynamic allocation has fallen

below 10 % upon calling of the function.

10th Edition : Dec.18,2003-00

H1-282

IM 33S01B30-01E

<H1.13 Error Handling>

H1.13.4 Detail Error CodesDetail error codes and their descriptions are shown below:

Table Detail Error Code List (1/15)

Decimal Hexadecimal Description

16 $0010 FCS or control bus at destination failed.

19 $0013 Time out (no response from FCS at destination)

8194 $2002 Setting the data other than the character string ACK was attempted in the data item named AFLS.

8244 $2034 Invalid connection destination information on an instrument such as a batch data set unit

8245 $2035 Required data items do not exist in the connection destination function block for the instrument such as a batch data set unit.

8247 $2037 Failed station with the tag to be referred or set up.

8261 $2045 Setup error due to a non-existing status name.

8262 $2046 Setup validity check error due to a non-existing status name.

8273 $2051 Validity check for setting up the data item name without status or batch data.

8704 $2200 Setting was attempted to the data item name which is not allowed for setting.

8706 $2202 Attempts setting CAL to a function block of CFCD series station, where the CAL status does not exist.

8707 $2203 Attempts setting NCL to a function block of CFCD series station, where the CAL status does not exist.

8708 $2204 Attempts setting a START or STOP command to a TM, CT function block of CFCD series station, where the START and STOP are not supported.

8709 $2205 Attempts setting a non-existing status to a TM function block of CFCD series station.

8725 $2215 Setup validity check was made for a non-status data item.

8718 $220E Attempts setting a function block of CFCD series station, whose tag name can not be found.

8720 $2210 Attempts changing a function block of CFCD series station to a status at the time the status change is not allowed.

8776 $2248 Setup data is out of limits.

Decimal Hexadecimal Description

H011326E.EPS

8196 $2004 Equalization of the tag information on the old FCS to be referenced or set up yet to be compeleted.

8226 $2022 Tag name to be referenced or set up not existing in the BCV.

8246 $2036 More than eight frames specified for transmission to HF.

8249 $2039 Communication between the RCV and old FCS aborted.

8705 $2201 Attempt to set up CAL in a function block that does not support the status name CAL in a CENTUM-XL instrument.

8710 $2206 Attempt to set up CMP in the loop of a CENTUM-XL instrument without a CMP mark.

8713 $2209 Attempt to set up SPC or DDC in the loop of a CFCD instrument without aCMP mark.

8714 $220A Status change to a CFCD instrument attempted while status changes were not permitted.

8715 $220B Status name not existing in the current function block set up in a CENTUM-XL instrument.

8770 $2242 Data type of the setup data not supported by BCV.

8771 $2243 Data type of the setup data not supported by BCV.

8772 $2244 Data type of the setup data not supported by BCV.

8773 $2245 Data type of the setup data not supported by BCV.

8774 $2246 Data type of the setup data not supported by BCV.

8775 $2247 Data type of the setup data not supported by BCV.

10th Edition : Dec.18,2003-00

H1-283

IM 33S01B30-01E

<H1.13 Error Handling>

Table Detail Error Code List (2/15)

Decimal Hexadecimal Description

9732 $2604 Timeout (no response from the destination station)

9760 $2620 Mail daemon is inactive at the destination station.

9761 $2621 Receive buffer is full at the destination station.

33026 $8102 Access is currently prohibited for the corresponding area.

33039 $810F System element requested for data access is not supported at present.

Decimal Hexadecimal Description

H011327E.EPS

8781 $224D Setup data is out of limits.

8782 $224E Setup data is out of limits.

8783 $224F Setup data is out of limits.

9216 $2400 The data item name does not exist in the instrument with the tag name being setup or referred.

9472 $2500 Setup for the data items named ASET, RSV, or RMV was attempted when thestatus did not allow setting.

9473 $2501 SV (or MV) less than the current SV (or MV) was set up in the data items namedASET, RSV, or RMV when the status was CLP-.

9474 $2502 SV (or MV) greater than the current SV (or MV) was set up in the data itemsnamed ASET,RSV, or RMV while the status was CLP+.

9475 $2503 SV (or MV) less than the current SV (or MV) was set up in the data items namedASET, RSV, or RMV while the status was CLP-.

9476 $2504 SV (or MV) greater than the current SV (or MV) was set up in the data itemsnamed ASET,RSV, or RMV while the status was CLP+.

9477 $2505 SV (or MV) less than the current SV (or MV) was set up in the data items namedASET, RSV, or RMV while the status was CLP-.

9478 $2506 SV (or MV) greater than the current SV (or MV) was set up in the data itemsnamed ASET,RSV, or RMV while the status was CLP+.

9479 $2507 SV (or MV) less than the current SV (or MV) was set up in the data items namedASET, RSV, or RMV while the status was CLP-.

9480 $2508 SV (or MV) greater than the current SV (or MV) was set up in the data itemsnamed ASET,RSV, or RMV while the status was CLP+.

9481 $2509 Setup for the data items named ASET, RSV, or RMV was attempted when thestatus did not allow setting.

8784 $2250 Data type of the setup data not supported by BCV.

8785 $2251 Data type of the setup data not supported by BCV.

8786 $2252 Data type of the setup data not supported by BCV.

8787 $2253 Data type of the setup data not supported by BCV.

8788 $2254 Data type of the setup data not supported by BCV.

8789 $2255 Data type of the setup data not supported by BCV.

8790 $2256 Data type of the setup data not supported by BCV.

8791 $2257 Data type of the setup data not supported by BCV.

8778 $224A Setup data is out of limits.

8780 $224C Setup data is out of limits.

8777 $2249 Data type of the setup data not supported by BCV.

8779 $224B Data type of the setup data not supported by BCV.

10th Edition : Dec.18,2003-00

H1-284

IM 33S01B30-01E

<H1.13 Error Handling>

Table Detail Error Code List (3/15)

Decimal Hexadecimal DescriptionH011328E.EPS

Decimal Hexadecimal Description

33211 $81BB Unconvertible data type is specified.

33215 $81BF Invalid data type of a setpoint value upon data setting request.

33216 $81C0 A setting was requested for the data that cannot be set up.

33217 $81C1 Setting validity check judged the setting invalid (e.g., Data out of the scale rangewas specified.)

33295 $820F System element requested for data access is not supported at present.

33310 $821E Setpoint value out of scale range was specified.

33311 $821F Invalid data type upon status change request.

33312 $8220 Invalid data size upon status change request.

33313 $8221 Invalid status change command.

33314 $8222 The corresponding instrument does not accept the status change command.

33380 $8264 Header for the block that was a data setting was requested was undefined.

33390 $826E Invalid data type upon data setup request.

33461 $82B5 Address for the data item name upon data access request is undefined.

33553 $8311 Non-existing area number was specified.

33556 $8314 The database requested for data access is now under online maintenance.

33646 $836E Invalid data type upon data setup request.

33648 $8370 The global switch number exceeds the limit for maximum.

33649 $8371 The global switch station number exceeds the limit for maximum.

33712 $83B0 The global switch is not defined.

33714 $83B2 The global switch data of other station is specified.

33726 $83BE The global switch data of other station cannot be set with the specified access code.

33904 $8470 Invalid common switch number.

34065 $8511 Non-existing area number was specified.

34078 $851E Setpoint value out of the scale range was specified.

34160 $8570 Invalid annunciator switch number

34321 $8611 Non-existing area number was specified.

34330 $861A Accessed to a function block in O/S mode.

33041 $8111 Non-existing area number is specified.

33044 $8114 Database requested for data access is now under online maintenance.

33124 $8164 Header of the block requested for data access is undefined.

33127 $8167 Block number is higher than the maximum limit upon data access request.

33137 $8171 Invalid station umber upon data access request.

33201 $81B1 Invalid system element name upon data access request.

33207 $81B7 Data type conversion is disabled (exceeding the maximum).

33208 $81B8 Data type conversion is disabled (falling below the minimum).

33209 $81B9 Nonnumeric type is specified for data type conversion.

10th Edition : Dec.18,2003-00

H1-285

IM 33S01B30-01E

<H1.13 Error Handling>

Table Detail Error Code List (4/15)

Decimal Hexadecimal Description

Decimal Hexadecimal Description

34587 $871B Accessed to function block in O/S compound mode.

34595 $8723 The corresponding block does not accept the requested status change command.

34596 $8724 Change is prohibited to the data status requesting the change.

34670 $876E Invalid data type upon data setup request.

35352 $8A18 Switch instrument block switch is in OFF state (single-point side).

35438 $8A6E Invalid data type upon data setup request.

35608 $8B18 Switch instrument block switch is in OFF state.

35694 $8B6E Invalid data type upon data setup request.

35760 $8BB0 Switch instrument block switch is in OFF state (multi-point side).

36280 $8DB8 Data access request communication exceeded the maximum amount.

36353 $8E01 Access for the FCS database is prohibited.

34331 $861B Accessed to a function block in complex O/S mode.

34404 $8664 Header for the block requested for data access is undefined.

34577 $8711 Non-existing area number was specified.

34586 $871A Accessed to a function block in O/S mode.

36354 $8E02 Access for the corresponding area is prohibited at present.

36367 $8E0F System element requested for data access is not supported at present.

36369 $8E11 The designated area number does not exist.

36371 $8E13 Invalid data item modifier upon data access request.

36389 $8E25 Array elements specified upon data access request is out of defined limits.

36390 $8E26 When a data access is requested, array elements are specified to a scalar type data.

36536 $8EB8 Access was request to the data having no entity in memory.

36537 $8EB9 Data that does not permit 0 to 100 % conversion on the scale.

36538 $8EBB Access to other station is prohibited. (Tag number not existing in the present station is specified.)

36540 $8EBC Destination FCS or control bus is down.

36541 $8EBD The tag name does not exist in the plant.

36542 $8EBE Security check by access ID prohibited the access.

36549 $8EC5 Invalid tag name upon data access request.

36550 $8EC6 Invalid data item name upon data access request.

36551 $8EC7 Only single-precision floating point type is acceptable for the data setting in the range of 0 to 100 %.

36599 $8EF7 Data access request communication exceeded the maximum amount. (High-speed data accessfunction)

37126 $9106 Acceptable request per dialogue control station exceeded the maximum 32.

37130 $910A Retry was requested while there is no dialog request.

37131 $910B Dialog’s cancellation request was not transmitted to the HIS.

37132 $910C Dialog’s retry request was not transmitted to the HIS.

37133 $910D Dialog’s confirmation request was not transmitted to the HIS.

37134 $910E Dialog’s entry request was not transmitted to the HIS.

36370 $8E12 Number of parameters requested for data access is negative or exceeding the maximum number.

H011329E.EPS

10th Edition : Dec.18,2003-00

H1-286

IM 33S01B30-01E

<H1.13 Error Handling>

Table Detail Error Code List (5/15)

Decimal Hexadecimal Description

Decimal Hexadecimal DescriptionH011330E.EPS

40215 $9D17 Undefined ACM I/O communication module database (No DI definition)

40221 $9D1D Out of the range of ACM I/O communication module unit numbers (1 to 8)

40222 $9D1E Out of the range of ACM I/O communication module slot numbers (1 to 4)

40223 $9D1F Out of the range of ACM I/O communication module terminal numbers (1 to 64)

40225 $9D21 No communication definition for the specified point.

40226 $9D22 ACM I/O communication module database error

40227 $9D23 ACM I/O communication module database error

40228 $9D24 ACM I/O communication module database error

40220 $9D1C Node number out of limits.

37138 $9112 Dialog’s "time" specification is timeout.

37142 $9116 User C task name cannot be obtained in the dialog transmission process.

38161 $9511 The designated area number does not exist.

38320 $95B0 Switch position in a switch instrument block different from that of the last access.

40193 $9D01 Access is disabled because I/O change is in progress on the online maintenance.

40194 $9D02 Writing to input (DI) is disabled while I/O is not disconnected.

38929 $9811 The designated area number does not exist.

40209 $9D11 Undefined ACM I/O communication module database

40210 $9D12 Undefined ACM I/O communication module database (No DI definition)

40211 $9D13 Undefined ACM I/O communication module database

40212 $9D14 Undefined ACM I/O communication module database

40213 $9D15 Undefined ACM I/O communication module database (No DI definition)

40214 $9D16 Undefined ACM I/O communication module database (No DI/DO definition)

40229 $9D25 I/O data type does not agree with the specified data type.

40230 $9D26 ACM I/O communication module database error

40231 $9D27 Write width is greater than 16 bit.

40235 $9D2B Even-numbered terminal access for 32-bit data is not available.

40247 $9D37 Database error

40248 $9D38 Database error

40249 $9D39 Database error

40250 $9D3A Database error

40251 $9D3B Database error

40252 $9D3C Database error

40253 $9D3D Database error

40254 $9D3E Database error

40255 $9D3F Database error

40256 $9D40 Database error

40257 $9D41 Database error

40272 $9D50 System count is out of defined range

40246 $9D36 Non-existing area number specified.

10th Edition : Dec.18,2003-00

H1-287

IM 33S01B30-01E

<H1.13 Error Handling>

Table Detail Error Code List (6/15)

Decimal Hexadecimal Description

Decimal Hexadecimal DescriptionH011331E.EPS

40273 $9D51 The specified system is not defined.

40278 $9D56 No I/O definition

40280 $9D58 Unit number is out of range.

40281 $9D59 Slot number is out of range.

40282 $9D5A Terminal number is out of range.

40284 $9D5C

40285 $9D5D

40279 $9D57 Node number out of limits.

40283 $9D5B Node not defined.

40286 $9D5E Card or action mode of the point that have been specified is not defined.

40287 $9D5F Database error

40288 $9D60 Database error

40289 $9D61 Database error

40290 $9D62 Database error

40291 $9D63 Database error

40292 $9D64 Database error

40293 $9D65 Specified data item name does not exist.

40294 $9D66 Database error

40295 $9D67 Database error

40296 $9D68 Database error

40297 $9D69 Database error

40298 $9D6A Specified data type does not agree with the data type of I/O.

40299 $9D6B Specified data size is different from that of the data type of I/O.

40300 $9D6C Size of %Zxxxxxx is larger than eight characters.

40302 $9D6E Nonnumeric character string is specified for the node number of the element number.

40303 $9D6F Nonnumeric character string is specified for the unit number of the element number.

40304 $9D70 Nonnumeric character string is specified for the slot number of the element number.

40305 $9D71 Nonnumeric character string is specified for the terminal number of the element number.

40306 $9D72 The kind of element is other than %Z.

40301 $9D6D System other than %Z/%Y.

40307 $9D73 Accesses to analog I/O, pulse width output, and time-proportioning ON/OFF output are invalid.

40308 $9D74 "Terminal number+size" exceeds the limit of card points. (PV16)

40309 $9D75 All the specified 16 points are undefined. (PV16)

40310 $9D76 Cannot read pulse width output from even-numbered terminal.

40311 $9D77 Dual analog destination is specified as single.

40312 $9D78 Database error

40316 $9D7C Cannot specify the read width

No unit definition

No card definition

10th Edition : Dec.18,2003-00

H1-288

IM 33S01B30-01E

<H1.13 Error Handling>

Table Detail Error Code List (7/15)

Decimal Hexadecimal Description

Decimal Hexadecimal DescriptionH011332E.EPS

40317 $9D7D Cannot specify the read width

40318 $9D7E Cannot specify the read width

40319 $9D7F Cannot specify the read width

40320 $9D80 Specified read size does not agree with the I/O data type.

40321 $9D81 Specified read data type does not agree with the I/O data type.

40322 $9D82 Database error

40323 $9D83 Card or action mode of the point that have been specified is not defined.

40324 $9D84 Dual-redundant database error

40325 $9D85 Database error

40326 $9D86 Database error

40327 $9D87 Database error

40328 $9D88 Terminal number exceeds the number of installation points of the card.

40329 $9D89 Database error

40330 $9D8A Database error

40331 $9D8B Cannot specify the reading width for pushbutton counter values.

40332 $9D8C Excessive data read width

40333 $9D8D "Terminal number+size" exceeds the limit of card points. (PV16)

40334 $9D8E All the specified 16 points are undefined. (PV16)

40335 $9D8F Read error (Internal error)

40336 $9D90 Cannot write because of a data status error

40337 $9D91 Database error

40338 $9D92 Database error

40339 $9D93 Database error

40340 $9D94 Database error

40341 $9D95 Cannot specify the write width

40342 $9D96 Excessive write size

40343 $9D97 Excessive write size

40344 $9D98 Flashing output is disabled.

40345 $9D99 Cannot specify the flashing output width

40346 $9D9A Write size is specified exceeding the limits of I/O module.

40347 $9D9B Intermixed operation modes (SO/PO) or no points are defined for writing.

40348 $9D9C Database error

40349 $9D9D Database error

40350 $9D9E Cannot specify the pulse width output width.

40351 $9D9F Excessive pulse width output time setpoint value

40352 $9DA0 Negative time setting for time-proportioning ON/OFF output.

40369 $9DB1 Internal error

40722 $9F12 Connection destination function block is under online maintenance.

10th Edition : Dec.18,2003-00

H1-289

IM 33S01B30-01E

<H1.13 Error Handling>

Table Detail Error Code List (8/15)

Decimal Hexadecimal Description

Decimal Hexadecimal DescriptionH011333E.EPS

40723 $9F13 Block mode of the connection destination function block is in O/S mode.

40725 $9F15 Connection destination function block is not allowed one-shot execution.

40726 $9F16 Nesting structure when a calling is made within the function blocks exceeds thedefinition.

40834 $9F82 Parameter error in "oneshot" statement or configuration error

40930 $9FE2 Execution step name specified in the sequence table to be started up does not exist.

41808 $A350 Internal error

41809 $A351 ACM I/O communication module number is out of limits.

41810 $A352 Definition number is out of limits.

41811 $A353 No communication definition for the specified point.

41812 $A354 Relative position (offset) is out of limits.

41813 $A355 Accessed to outside of the range for subsystem definition.

41814 $A356 Cannot write to input

41815 $A357 Odd-number is specified for relative position (offset).

41816 $A358 Bit position is out of limits.

41817 $A359 Bit count is out of limits.

41018 $A35A "Bit position+bit count error" is out of data limits.

41819 $A35B Cannot write to data status error data.

41825 $A361 The size exceeds the FIFO.

41826 $A362 Power failure or other abnormality occurred during a write request.

41827 $A363 Abnormal card or node, or extended power failure

41828 $A364 Excessive number of write requests

41829 $A365 Internal error

41830 $A366 Setting value size error for monitoring time during a wait for transmission completion.

41831 $A367 Setting value for monitoring time during a wait for transmission completion is out of range.

41832 $A368 Write transmission wait time is over.

41833 $A369 Write transmission completion wait time is over.

41841 $A371 SEBOL specification is not set. (zero UPFIFO size)

41842 $A372 SEBOL specification is not set. (zero DOWNFFO size)

41843 $A373 Subsystem SEBOL type is not supported.

41873 $A391 RS communication error (Communication driver is "busy.")

41874 $A392 RS communication error (Communication line is "busy.")

41875 $A393 RS communication error (Communication line is "not ready.")

41876 $A394 RS communication error (Excessively large transmission size)

41877 $A395 RS communication error (Communication port specification is not declared.)

41879 $A397 RS communication error (Underline error occurred.)

41880 $A398 RS communication error (Reception inter-character time is over.)

41881 $A399 RS communication error (Reception buffer overflow)

10th Edition : Dec.18,2003-00

H1-290

IM 33S01B30-01E

<H1.13 Error Handling>

Table Detail Error Code List (9/15)

Decimal Hexadecimal Description

Decimal Hexadecimal DescriptionH011334E.EPS

41882 $A39A RS communication error (Reception data parity error)

41883 $A39B RS communication error (Reception overrun error)

41884 $A39C RS communication error (Reception framing error)

41885 $A39D RS communication error (The number of reception characters is out of specification.)

41887 $A39F RS communication error (Miscellaneous)

41904to 41983

$A3B0to $A3FF

RS communication error(Refer to the function specification of the subsystem connected.)

42001 $A411 Non-existing area number is specified.

42010 $A41A Accessed to a function block in O/S mode.

42011 $A41B Accessed to a function block in complex O/S mode.

42019 $A423 Status change request is unacceptable to the current block.

42020 $A424 Change is prohibited to the data status that a change was requested.

42094 $A46E Invalid data type upon data setup request

43521 $AA01 Undefined CP213 communication function option

43522 $AA02 Writing to the input data is disabled while I/O is not disconnected.

43577 $AA39 Read width is out of limits.

43578 $AA3A Write width is out of limits.

43579 $AA3B Write width is out of the write range.

43580 $AA3C Writing is not permitted to this data.

43581 $AA3D Error in the kind of element.

43582 $AA3E Error in the name of element.

43583 $AA3F Register number is out of limits.

43584 $AA40 Invalid bit position

43585 $AA41 Element number is out of limits.

43586 $AA42 Specified data item name does not exist.

43587 $AA43 Error in the specified data type.

43588 $AA44 Specified register number is not assigned.

43793 $AB11 Non-existing area number is specified.

44211 $ACB3 System element of the present station is specified, even though other plant hasbeen specified.

44305 $AD11 State transition is disabled.

44306 $AD12 Initialization operation is in progress.

44307 $AD13 Invalid data item name

44308 $AD14 Interrupt processing is running.

44309 $AD15 Non-existing generic name is used, or non-existing operation generic name is used.

44310 $AD16 Invalid tag name specified in an operation name.

44311 $AD17 Unmatched left- and right-side data types in a transition condition.

44312 $AD18 Cannot change the block status in O/S block mode.

44313 $AD19 Constant is used on the left side member of a transition condition.

10th Edition : Dec.18,2003-00

H1-291

IM 33S01B30-01E

<H1.13 Error Handling>

Table Detail Error Code List (10/15)

Decimal Hexadecimal Description

Decimal Hexadecimal DescriptionH011335E.EPS

44314 $AD1A Invalid tag name used as a step transition condition.

44315 $AD1B Invalid tag name used as a parallel transition condition.

44317 $AD1D Cannot run a unit instrument because it is under online maintenance.

44338 $AD32 Cannot run an operation.

44339 $AD33 Cannot execute pre-status change processing for an operation.

44340 $AD34 Cannot execute post-status change processing for an operation.

44341 $AD35 Cannot send a signal to an operation.

44343 $AD37 Cannot convert an operation generic name to a tag name.

44344 $AD38 Simultaneous step start ups exceed the limits.

44345 $AD39 Simultaneous parallel execution exceed the limits.

44346 $AD3A The number of parallel maximum steps is exceeded within the parallel.

44347 $AD3B Cannot obtain the dynamic management area.

44348 $AD3C Cannot obtain a state transition matrix, or transition destination is not defined.

44349 $AD3D Cannot obtain a unit procedure

44354 $AD42 EXECERR action is not defined for a state transition matrix.

44357 $AD45 Unit recipe start up was requested for a fixed procedure unit instrument.

44418 $AD82 State transition matrix does not exist.

44421 $AD85 Unit instrument status name is not defined in the builder.

44423 $AD87 Status change command name is not defined in the builder.

44426 $AD8A Target status name is not defined in the builder.

44427 $AD8B The corresponding state transition is prohibited in the state transition matrix.

44430 $AD8E Unit procedure is under online maintenance.

44431 $AD8F Unit procedure does not exist.

44434 $AD92 Unit procedure is not specified.

44435 $AD93Unit instrument’s allocation dynamic area is not allocated. (Average number of parallel execution units defined by station or the number of unit instruments is "0.")

44437 $AD95 Available unit instrument’s dynamic work area falls below 5 %.

44438 $AD96 No unit instrument’s dynamic work area is available.

44451 $ADA3 Unit instrument is already active.

44452 $ADA4 Unit instrument is already inactive.

44467 $ADB3 Process alarm character string is not defined by the builder.

44469 $ADB5 Non-existing generic name is used.

44470 $ADB6 Array subscript for the generic name is out of range, or error in the array dimension.

44471 $ADB7 Null character string is assigned to a tag name assigned to the generic name.

44512 $ADE0 The unit instrument does not allocate valve pattern monitor.

44513 $ADE1 Cannot allocate the valve pattern monitor because the block status of the unitinstrument is END.

44514 $ADE2 Cannot allocate the valve pattern monitor because the block status of the unitinstrument is ABORTED.

44515 $ADE3 The unit instrument has already allocated another valve pattern monitor.

44543 $ADFF Unsupported function is used.

44547 $AE03 The batch ID recipe does not exist (*1).

44549 $AE05 Cannot receive the specified status modification command with the currentunit recipe status.

10th Edition : Dec.18,2003-00

H1-292

IM 33S01B30-01E

<H1.13 Error Handling>

Table Detail Error Code List (11/15)

Decimal Hexadecimal Description

Decimal Hexadecimal DescriptionH011336E.EPS

44811 $AF0B Setting to reference-only data was attempted.

44812 $AF0C Data setting validity check judged the setting invalid.

44813 $AF0D Array element was specified to a scalar type.

44814 $AF0E Array element was not specified, even though in the array type.

44815 $AF0F Two-dimensional element was specified for a one-dimensional array.

44816 $AF10 Requested array element specification exceeded the maximum number of elements for item definition.

44822 $AF16 The number of parameter requested is negative, or exceeds the maximum number.

45057 $B001 Unassigned generic name was used.

45058 $B002 Generic name marked by an asterisk (*) is used. (No error message is output.)

45072 $B010 The sequence table or the logic chart is being used by "drivewait" sub-statement, cannot be started again.

45073 $B011 Sequence table or a logic chart block mode in the "drivewait" start up condition became O/S.

45074 $B012 % (present block) cannot be used in a group assignment statement with a plant name specified.

45075 $B013%% (present unit instrument) cannot be used in a group assignment statement with a plant name specified.

45104 $B030 Accessed to another station while CPU allocation was monopolized.

45311 $B0EF Unsupported function is used.

45314 $B102 Signal destination is other than SFC block, operation, or unit instrument.

45315 $B103 Signaling operation illegal for a unit instrument was sent.

45316 $B104 Destination block is halted due to a database error.

45317 $B105 Destination block is not running.

45318 $B106 Signal processing with the specified signal name is not defined at the signal recipient SFC block.

45319 $B107 Neither signal processing with the specified signal name nor queued signal processing is not definedat the signal recipient SFC block.

44552 $AE08 Cannot cancel or load the unit recipe for unit recipe No.1.

44553 $AE09 Incorrect common block name.

44554 $AE0A Incorrect common data item name.

44557 $AE0D Incorrect status modification command name.

44566 $AE16 Cannot activate unit recipe because recipe status is not ACTIVE.

44803 $AF03 Remote station common data.

44804 $AF04 Invalid batch ID.

44805 $AF05 Invalid common block name.

44806 $AF06 Invalid common data item name.

*1: Even when the recipe with corresponding batch ID is reserved by operation and monitoring function, the detail errorcode $AE03 may still occur if the recipe is not downloaded to the control station.

SEE ALSO

For other conditions that may generate the detail error code $AE03, see the following:

“■ Conditions for Accessing Common Block Data” in H1.6.4, “Built-In Functions with Batch ID”

10th Edition : Dec.18,2003-00

H1-293

IM 33S01B30-01E

<H1.13 Error Handling>

Table Detail Error Code List (12/15)

Decimal Hexadecimal Description

Decimal Hexadecimal DescriptionH011337E.EPS

45321 $B109 Signals with a return signal cannot be transferred because interrupt signal reception processing hasalready been defined to the corresponding signal at the signal recipient SFC block.

45322 $B10A Signals cannot be received because the number of signal parameters exceeds the maximum number of signal parameters.

45323 $B10B Signals cannot be received because the maximum receiving number of signals are queued.

45324 $B10C Signals cannot be received because the maximum receiving number of signals are queued. (including those in return signal processing)

45325 $B10D "wait for qsignal" was executed in a program other than a main program.

45326 $B10E Maximum number of queuing signals that can be received is "0."

45360 $B130 Internal error occurred at the signal destination.

45320 $B108 Illegal operation for an interrupt signal was made.

45569 $B201 Function permitted only in an operation

45571 $B203 Has not been run from a unit instrument

45572 $B204 SFC blocks do not exist at all.

45573 $B205 Starting up of function blocks other than operation from the unit instrument was attempted.

45574 $B206 Block status cannot be changed because the block mode of an operation is in O/S.

45575 $B207 Being run from another unit instrument

45576 $B208 Block status cannot be changed because the pre-status change processing is in progress.

45577 $B209 Block status cannot be changed because the post-status change processing is in progress.

45578 $B20A Database associated with the SFC sequence name is not found.

45579 $B20B SFC sequence main program is under online maintenance.

45580 $B20C Pre-status change processing judged the status change invalid.

45581 $B20D Error was detected during the pre-status change processing.

45582 $B20E Pre-status change processing exceeded the maximum number of lines that can be run.

45583 $B20F SFC sequence main program does not exist.

45584 $B210 Online maintenance of the SFC sequence main program is incomplete.

45585 $B211 SEBOL area database does not exist.

45586 $B212 Cannot run an operation because no dynamically reserved area is available.

45587 $B213 Cannot change the block status because the operation termination processing is in progress.

45616 $B230 Internal error occurred in an operation.

46081 $B401 Cannot run an SFC block because no dynamically allocated area is available.

46097 $B411 Cannot change STEPNO because the block status is not PAUS.

46098 $B412 Cannot change a step to an interrupt program step (interrupt program step number cannot be set to STEPNO).

46100 $B414 Cannot change STEPNO while pre-status change processing is in progress.

46101 $B415 Cannot change STPNO while post-status change processing is in progress.

46113 $B421 Cannot change the block mode to O/S because the block status is not STOP or ABRT.

46114 $B422 Cannot change the block status in O/S block mode.

46115 $B423 Cannot receive the status change command RSET in the RUN block status

10th Edition : Dec.18,2003-00

H1-294

IM 33S01B30-01E

<H1.13 Error Handling>

Table Detail Error Code List (13/15)

Decimal Hexadecimal Description

Decimal Hexadecimal DescriptionH011338E.EPS

46116 $B424 Cannot receive the status change command ABRT in the STOP block status

46117 $B425 Cannot receive the status change command RSET in the PAUS block status

46118 $B426 Cannot receive the status change command RUN in the ABRT block status

46119 $B427 Cannot receive the status change command PAUS in the ABRT block status

46120 $B428 Cannot receive the status change command STOP in the ABRT block status

46121 $B429 Cannot change the block status while pre-status change processing is in progress.

46122 $B42A Cannot change the block status while post-status change processing is in progress.

46124 $B42C Cannot change the block mode to SEMI due to the specification of the SEMI mode operation

46125 $B42D Cannot change the block status of a monitoring operation

46126 $B42E Cannot run an operation other than from a unit instrument

46127 $B42F SFC block termination processing is in progress.

46128 $B430 Pre-status change processing determined the status change invalid.

46129 $B431 Error was detected in pre-status change processing.

46130 $B432 Pre-status change processing exceeded the maximum number of execution lines.

46131 $B433 Block mode cannot be changed because pre-status change processing is in progress.

46132 $B434 Cannot change the block status while post-status change processing is in progress

46133 $B435 Block mode cannot be changed because SFC block termination processing is in progress.

46161 $B451 SFC sequence main program does not exist.

46162 $B452 Common area data base for SEBOL stations do not exist.

46163 $B453 Data base for SFC sequence is not found.

46164 $B454 Online maintenance of the SFC sequence main program is incomplete.

46165 $B455 SFC block cannot be changed because the SFC sequence main program is under online maintenance.

46166 $B456 SEBOL area database does not exist.

49936 $C310 No response from the destination station.

49938 $C312 Destination station CPU is not ready.

49939 $C313 "A-time Over" occurred at the destination station.

49940 $C314 No receiving process on the destination station.

49943 $C317 "C-time Over" occurred at the destination station.

50577 $C591 ACM 12 communication module database is not defined.

50578 $C592 ACM 12 communication module database not defined.

50579 $C593 ACM 12 communication module database not defined.

50580 $C594 ACM 12 communication module database not defined.

50581 $C595 ACM 12 communication module database not defined.

50582 $C596 ACM 12 communication module database not defined.

50583 $C597 ACM 12 communication module database not defined.

50593 $C5A1 Database error

50594 $C5A2 Database error

10th Edition : Dec.18,2003-00

H1-295

IM 33S01B30-01E

<H1.13 Error Handling>

Table Detail Error Code List (14/15)

Decimal Hexadecimal Description

Decimal Hexadecimal DescriptionH011339E.EPS

50596 $C5A4 Database error

50597 $C5A5 Database error

50598 $C5A6 Database error

50599 $C5A7 Database error

50600 $C5A8 Database error

50601 $C5A9 Database error

50602 $C5AA Zero ACM I/O communication module

50603 $C5AB Specified point is not defined.

50606 $C5AE Abnormal card number

50607 $C5AF Database error

50608 $C5B0 Data type is not defined.

50641 $C5D1 Abnormal FIFO data size

50604 $C5AC Can not find configuration for this node.

50605 $C5AD The designated node is not the node for communication I/O.

50595 $C5A3 Specified size exceeds the data range.

50676 $C5F4 Internal error

50696 $C608 Tag name is not found in the plant.

53249 $D001 Reference value does not agree the data.

43250 $D002 Alarm status (ALRM) is not NR.

43251 $D003 Abnormal data status

53264 $D010 Cannot collect data item ALRM.

53280 $D020 Cannot change the block mode to O/S because the block status is RUN.

53281 $D021 Cannot change the block mode to O/S because the block status is PAUS.

53283 $D023 Cannot change the block status because the block status is O/S.

53284 $D024 Cannot receive the status change command RUN because the block status isSTOP.

53285 $D025 Cannot receive the status change command PAUS because the block status isSTOP.

53376 $D080 The number of registered items exceeds the limits.

53377 $D081 Cannot register data item ALRM

53500 $D0FC Will abort because an error was detected in initialization processing of systemdefinitions.

53282

53312 $D040 The valve pattern monitor is under online maintenance.

53313 $D041 The valve pattern monitor is allocated in another unit instrument.

53314 $D042 Different control area for the valve pattern monitor and the unit instrument.

53315 $D043 The specified function block is not a valve pattern monitor.

53499 $D0FB Abnormal data item name for the drive vpmon statement.

$D022 Cannot get the valve pattern monitor because of O/S block mode.

53501 $D0FD A function not supported was used.

53502 $D0FE Internal error

10th Edition : Dec.18,2003-00

H1-296

IM 33S01B30-01E

<H1.13 Error Handling>

Table Detail Error Code List (15/15)

Decimal Hexadecimal Description

H011340E.EPS

53504 $D100 Cannot monitor undefined data type.

53512 $D108 Cannot monitor character-string type.

53532 $D11C Cannot monitor single precision floating-point data.

53533 $D11D Cannot monitor single precision floating-point data with data status.

53535 $D11F Cannot monitor single precision floating-point data with data status or range.

53536 $D120 Cannot monitor double precision floating-point data.

53537 $D121 Cannot monitor double precision floating-point data with data status.

53540 $D124 Cannot monitor alarm type.

53544 $D128 Cannot monitor bit type.

53548 $D12C Cannot monitor indirect type.

53556 $D134 Cannot monitor data combination information.

53560 $D138 Cannot monitor dynamic data type.

53564 $D13C Cannot monitor data item names.

53568 $D140 Cannot monitor because data type is undetermined.

53569 $D141 Cannot monitor I/O data not connected.

53631 $D17F Cannot monitor HIS reservation type.

53503 $D0FF The valve pattern monitor is not registered optionally.

10th Edition : Dec.18,2003-00

H1-297

IM 33S01B30-01E

<H1.13 Error Handling>

H1.13.5 Values Used when an Error OccurredWhen an SFC block continues its execution after an error that can continue theprogram execution has occurred, the program will use a substitution values for thevariable or expression that caused the error.

This section explains about the values used instead of the variable or expressionthat caused the error. Also in this section, actions after an error occurs duringassignment processing or calculation processing of expression will be explained.

● Calculation Error

Calculation errors include overflow and zero-division. The following shows the values usedinstead of calculation results in the case of error occurrence. Calculation of expressions willbe continued using those values.

• Overflow:Maximum absolute value of “double” type with the same sign as the calculation result.

• Zero-divide:Maximum absolute value of “double” type with the same sign as the dividend.

However, in a division operation using the “/” operator, if 0 is divided by 0 when either orboth of the dividend numbers is/are real-number type, the “invalid calculation error” willresult. The execution of the statement in which an error occurred is terminated, whileexecution of SFC block is continued.

● Outside the Array Subscript Range Error

If an outside the array subscript range error occurs, execution of the statement is termi-nated. When this error occurs, assignment is not performed for an assignment statement,and a message will not be output for a “message” statement.

When multiple data are processed in one line by the group assignment statement, “drive”statement or “compare” statement, if the statement contains an error variable categorizedas out-of-array subscript range, processing for all other variables are terminated. Since theout-of-array subscript range error is categorized as an error that can continue programexecution, execution of SFC block will be continued.

● Error in Referencing Function Block Data

If a communication error, etc. occurs during reference to a function block data, execution ofthe statement is terminated. When this error occurs, assignment is not performed for anassignment statement, and a message will not be output for a “message” statement.

When multiple data are processed in one line by the group assignment statement, “drive”statement or “compare” statement, if the statement contains data which causes a commu-nication error, the processing with regard to the data will be terminated, while processingfor other variables (data) are executed. Since the error in referencing function block data iscategorized as an error that can continue program execution, execution of SFC block willbe continued (error class error code: 100).

10th Edition : Dec.18,2003-00

H1-298

IM 33S01B30-01E

<H1.13 Error Handling>

● Type Conversion Errors

If an overflow occurs during type conversion, the following values are given. Calculation ofexpression is continued using these values.

Table Positive and Negative Maximum Absolute Values

Positive maximum absolute value Negative maximum absolute value

integer 32767 -32768

long 2147483647 -2147483648

float 3.402823*10^38 -3.402823*10^38

double 1.79769313486231*10^308 -1.79769313486231*10^308H011341E.EPS

● Assignment Errors

If an error occurs on the right-hand side of an assignment statement (overflow or zero-division), assignment is done if the assigned variable is a local variable. If the assignedvariable is a function block data, no assignment is done, retaining the same assignedvalue.

If an overflow occurs during type conversion when assigning the data to a local variable,the maximum absolute value with the same sign is assigned. If an overflow occurs duringtype conversion when assigning the data to a function block data, no assignment is done,retaining the same data value.

● Errors in Character String and Numeric Type

When creating a program using implicit declarations of tag name types, if a tag name whichis not defined via the builder or the tag name of the FCS that is different from the one theSFC block belongs is used, the data item type of the function block is not checked duringcompilation. If this program has an error, a run-time error such as assigning a string data toa numeric variable might occur.

If a character-string variable appears in the operand for an operator that handles numericvalue such as an arithmetic operator, a run-time error occurs and the execution of thestatement is terminated. For example, if it is a “message” statement, the message is notoutput. Also, when assignment of numeric value to a character-string type variable orassignment of a character string to numeric type variable is attempted, a run-time erroroccurs and no assignment is done. However, when multiple data are processed in one lineby the group assignment statement, “drive” statement or “compare” statement, if thestatement contains a variable that will cause character string and numeric type error,processing for all other variables are terminated.

These errors are classified as an error that can continue program execution, and theexecution of the SFC block in which the error occurred will be continued.

10th Edition : Dec.18,2003-00

H1-299

IM 33S01B30-01E

<H1.13 Error Handling>

■ Conditional Expression Errors in Control StatementsActions taken when an error that can continue program execution occurs during calculationof conditional expressions in a control statement are shown below:

"if" statement ··· The condition is treated as unsatisfied.

"for" statement ··· Program execution is resumed from the statement following the "next" statement.

"while" statement ··· The condition is treated as unsatisfied.

"until" statement ··· The condition is treated as satisfied.

"wait until" statement ··· Branches to the designated destination if "error" or "errorsub" exists. If not, the program is resumed from the next statement.

"switch" statement ··· If "otherwise" exists, program execution is resumed from the line following the "otherwise." If not, the program is resumed from the statement following the "end switch" statement.

H011342E.EPS

■ Errors in Sequence Table or Logic ChartThe steps in SFC blocks can be described in SEBOL or in sequence tables or logic charts.If an error is detected in the step in a sequence table or a logic chart during the execution,the SFC block is forcibly terminated and the block status becomes ABRT.

The actions taken when an error is detected in a transition condition for the step describedin a sequence table or a logic chart, are the same as the steps described in SEBOL. TheSFC block will not be forcibly terminated and the transition condition is determined unsatis-fied.

Table Errors in Sequence Table or Logic Chart

Step type

Program type

Mainprogram

Pre-status changeprocessing

Post-status changeprocessing

Interrupt signalprocessing

ST step ABRT (*1) - ABRT (*1) ABRT (*1)

ST oneshot ABRT (*1) Determined asunchangeable ABRT (*1) ABRT (*1)

LC step ABRT (*1) - ABRT (*1) ABRT (*1)

LC oneshot ABRT (*1) Determined asunchangeable ABRT (*1) ABRT (*1)

H011343E.EPS

-: An ST step or a LC step cannot be used in the pre-status change processing.*1: Indicates that the SFC block will be forcibly terminated and the block status becomes ABRT. In the pre-status change

processing, it is determined the status is unchangeable but the block status of the SFC block does not change.

■ Errors in Transition ConditionIf an error that can continue program execution occurs during calculation of transitioncondition in an SFC block, the transition condition is treated as “status unsatisfied.”

10th Edition : Dec.18,2003-00

H1-300

IM 33S01B30-01E

<H1.14 Reserved Words in SEBOL>

H1.14 Reserved Words in SEBOL▼ Reserved Words in SEBOL

Identifiers listed in the following tables are used as reserved words by the compiler.Thus, they cannot be used for other purposes.

■ List of Reserved Words in SEBOLParentheses () in the table indicates the position each reserved word is used in the pro-gram.

[D] indicates a declaration, [S] a statement, [B] a built-in function, [O] an operator, [CALC] aword reserved for calculation expression, [XL] a word reserved for SEBOL in CENTUM-XL,and [N] indicates others.

PV, MV and other data item names used for function block data are not the reserved wordsfor the compiler and can be used as local and other variable names. Even though thesedata item names can be used as variable names for local variables, etc., it makes theprogram difficult to read. Therefore, it is recommended not to use the data item names asvariable names.

10th Edition : Dec.18,2003-00

H1-301

IM 33S01B30-01E

<H1.14 Reserved Words in SEBOL>

Table List of Reserved Words (1/2)

ACOS (B)

DOUBLE (D)

ACTION (N)

DREADPARA (B)

ALIAS (D)

CISTEP (N)

CKSTEP (B)

DRIVE (S)

AND (O)

CKSTEPCL (B)

DRIVEWAIT (S)

ARGBLOCK (D)

CMWRITE (B)

ASIN (B)

CMWRITEBID (B)

ASSIGN (S)

DSCHECK (B)

ASTM1 (CALC)

COMPARE (S)

ASTM2 (CALC)

ASTM3 (CALC)

CONFIRM (N)

ASTM4 (CALC)

COS (B)

ELSE (S)

ATAN (B)

CP (N)

END (S)

CREADPARA (B)

ENTRY (S)

BEGIN (S)

EOR (O)

BITPSTN (B)

ERETURN (S)

BITSRCH (B)

ERRC (B)

BLOCK (D)

ERRCE (B)

BOOT (B)

ERRF (B)

CASE (S)

ERRL (B)

CAT (B)

ERROR (S)

CCMREAD (B)

ERRORSUB (N)

CCMREADBID (B)

ERRORVAL (B)

ERRP (B)

CERRORID (B)

ERRS (B)

CHANGE (N)

DABS (B)

ESTEP (N)

CHAR (D)

DCMREAD (B)

EVENT (N)

CHAR16 (N)

DCMREADBID (B)

EXIT (S)

CHAR32 (N)

EXP (B)

CHAR4 (N)

DELAY (S)

FLOAT (D)

CHAR8 (N)

DELAYCYCLE (S)

FOR (S)

CHECK (S)

DERRORID (B)

FORMAT (S)

DIALOGUE (S)

FUNCTION (S)

CHR (B)

DLIMIT (B)

DMAX (B)

GENNAME (D)

DMIN (B)

GETDATE (B)

H011401E.EPS

GETNAME (B)

LERRORID (B)

LEVEL (S)

LLIMIT (B)

GETTAGNO (B)

LMAX (B)

LMIN (B)

GETTIME (B)

GLOBAL (D)

GOTO (S)

HISTORY (S)

ICHR (B)

IF (S)

INDEPENDENT (S)

INDEX (B)

INITIAL (N)

INT (B)

INTEGER (D)

ISIGMASK (S)

ISIGUNMASK (S)

ISTEP (N)

LABS (B)

LCMREAD (B)

LCMREADBID (B)

LEFT (B)

LEN (B)

10th Edition : Dec.18,2003-00

H1-302

IM 33S01B30-01E

<H1.14 Reserved Words in SEBOL>

Table List of Reserved Words (2/2)

H011402E.EPS

OTHERWISE SIN URASSIGNBID(B) (B)(S)

LOG QUIT TAN(B) (B)(S)

QSIGNAL SWITCH(S) (S)

LREADPARA REQUEST THEN(B) (S) (S)

ONESHOT SEQTABLE UNIT(S) (S) (S)

PRCSALARM SSWRITE VPMSTART(S) (S) (S)

OR SIGNAL URASSIGN (B)(S)(O)

LOCALTIME QUEUE SYSALARM(B) (S)(D)

PC SNAPSHOT URLOAD (B)(S)(CALC)

PCKP SNUM URLOADBID(B) (B)(CALC)

PROGRAM SSWRITEBIT WAIT(S) (S)(CALC)

LOGICCHART RECOVER TC(S) (S) (CALC)

LONG REPEAT TCF(D) (S) (CALC)

MID RIGHT TPC(B) (B) (CALC)

MSTEP RPRESERVE TPCFP(B) (CALC)(EX)

PR SSREAD VPMRESET(S) (S)(EX)

MASK RETRY TIMEMS (B)(S) (EX)

M3 RESULT TIMEGMT (B)(EX) (EX)

MOD RISTEP TPCF(O) (CALC)(EX)

NOPREEMPT SEBOL TPCMP(S) (CALC)(EX)

NEXT RQ TPCKP(S) (CALC)(EX)

NOT SEBOLBLOCK TPCP(O) (CALC)(EX)

OPEGUIDE SFCBLOCK UNTIL(S) (S)(EX)

PCP SSDTWRITE VPMOFF (S)(CALC) (EX)

POWER SSDTWRITEBIT VPMON (S)(B) (EX)

QSIGCANCEL STARTSTEP WEND(S) (S)(EX)

WHILEQSIGMOVE STEP(S) (S)(EX)

NOTCHECKARG SEMLOCK UINTEGER(S)(EX) (EX)

OG SEMUNLOCK ULONG(S)(EX) (EX)

MESSAGE RETURN TO(S) (S) (EX)

PCMP SQRT VM(B)(CALC) (EX)

10th Edition : Dec.18,2003-00

H1-303

IM 33S01B30-01E

<H1.14 Reserved Words in SEBOL>

■ List of Reserved Words in SEBOL Related to Process Management

Table List of Reserved Words in SEBOL Related to Process Management

H011403E.EPS

lcmreadbid (B)

dcmreadbid (B)

ccmreadbid (B)

cmwritebid (b)

urassignbid (B)

urloagbid (B)

lcmread (B)

dcmread (B)

ccmread (B)

cmwrite (B)

urassign (B)

urload (B)

rpreserve (B)

10th Edition : Dec.18,2003-00

H1-304

IM 33S01B30-01E

<H1.15 Application Size>

H1.15 Application Size▼ Application Size

Application sizes for SFC block and SEBOL program are shown below:

■ Maximum Number of Variable DeclarationsThe number of variable declarations is limited. If the limit is exceeded, a compile erroroccurs. The following table shows the maximum number of variable declarations perSEBOL program. The number of variables includes local variables and tag names that areimplicitly declared.

Table Maximum Number of Variable Declarations

Variable typeDeclarationstatement Remarks

No. ofNames

TotalElements(*1)

Local variable/global variable

integer, long,float, double,char*n

Total of all types.Count respectively if the local variables withsame name are declared in multiple steps.

1024in all (*2)

Tag names block

Including implicit declarations (*3).Total tag names of the "global block"declarations and "block" declarations in SFCblock. If the same tag name is declared using"block" in multiple steps, it is counted as one.The tag names only declared but not accessed are not included in the count.

256 256

Local generic name genname

The total number of local generic namesdeclared by "global genname" or "genname"in SFC block. If the same local generic nameis declared using "genname" in multiple steps,it is counted individually. The local genericnames only declared but not accessed are not included in the count.

128 256

Generic name unit genname

The total number of local generic namesdeclared by "global unit genname" and"genname" in SFC block.If the same generic name is declared using"unit genname" in multiple steps, it is countedas one. The generic names only declared butnot accessed are not included in the count.

256 512

H011501E.EPS

*1: Total in the entire program unit. The number of array elements is counted, assuming a simple variable as 1.*2: A compile error occurs if the size of local variable area exceeds 2147483646 ($7FFFFFFE) bytes. This area includes

the area to keep alignment. See the list below for the alignment of variables.• integer: 2• long: 4• float: 4• double: 8• char*n: 2

*3: Tag names of the actions that are described in a sequence table or a logic chart in an SFC block are included in thecount. The present block (%) and the present unit instrument (%%) are not included.

Since the size of a dummy argument array is determined by the actual argument, there areno limitations in the number of dummy arguments, except that the maximum number ofarguments per function is 32.

10th Edition : Dec.18,2003-00

H1-305

IM 33S01B30-01E

<H1.15 Application Size>

■ Other Maximum Values for SEBOL

● Maximum Values Other than Maximum Number of Variable Declarations

Table Maximum Values Other than Maximum Number of Variable Declarations

Description Max. value Remarks

Length per line (including continuing line) 511 bytes

Line number 9999

Size per program 65535 bytes

Function block data usable in expressions (total for one line) 32

Number of operators usable in one expression 64

#define 2048 Per one compile unit

#include 16 Per one compile unit

Object size 100K bytes Per one compile unitH011502E.EPS

● Maximum Values Related to SFC Blocks

Table Maximum Values Related to SFC Blocks

Description Max. value Remarks

Number of steps in one SFC (*1) 99

Total number of steps in one SFC block (*2) 300

Number of interrupt programs 31

Number for one step 2000

Size for one SEBOL step 65535 bytes

Transitions in one step 8H011503E.EPS

*1: Max. 99 SFC steps for each of the main program and interrupt program.*2: Max. 300 SFC steps for the main program and interrupt program in one SFC block as a total.

10th Edition : Dec.18,2003-00

Blank Page