RiceLake 920iUSB Programmingmanual
RiceLake 920iUSB Programmingmanual
RiceLake 920iUSB Programmingmanual
Version 5.00
Programming Reference
Contents
About This Manual ................................................................................................................................... 1
1.0
Introduction.................................................................................................................................. 1
1.1
1.2
1.3
1.4
1.5
1.6
2.0
What is iRite?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Why iRite? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
About iRite Programs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Running Your Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Sound Programming Practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Summary of Changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1
1
1
2
3
4
Tutorial ......................................................................................................................................... 5
2.1 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 Program Example with Constants and Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.0
Language Syntax........................................................................................................................ 10
3.1 Lexical Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.1.1
3.1.2
3.1.3
3.1.4
Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Delimiters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10
10
10
11
Type Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Variable Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Subprogram Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.4 Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.4.1
3.4.2
3.4.3
3.4.4
3.4.5
3.4.6
4.0
5.0
Assignment Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Call Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
If Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Loop Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Return Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exit Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
21
22
23
25
27
27
5.2
5.3
5.4
5.5
5.6
Weight Acquisition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Tare Manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Rate of Change. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Accumulator Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Scale Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
A/D and Calibration Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31
33
34
35
37
41
System Support. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Serial I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Program Scale. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Setpoints and Batching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Digital I/O Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
42
49
52
52
62
5FDIOJDBMUSBJOJOHTFNJOBSTBSFBWBJMBCMFUISPVHI3JDF-BLF8FJHIJOH4ZTUFNT
$PVSTFEFTDSJQUJPOTBOEEBUFTDBOCFWJFXFEBUXXXSMXTDPNPSPCUBJOFE
CZDBMMJOHBOEBTLJOHGPSUIFUSBJOJOHEFQBSUNFOU
2012 Rice Lake Weighing Systems. All rights reserved. Printed in the United States of America.
Specifications subject to change without notice.
Rice Lake Weighing Systems is an ISO 9001 registered company.
Version 5.00, April 2012
6.0
63
65
65
66
67
70
71
73
75
76
76
78
79
79
81
Appendix .................................................................................................................................... 85
6.1 Event Handlers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
6.2 Compiler Error Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
6.3 iRev Database Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
6.3.1
6.3.2
6.3.3
6.3.4
6.3.5
Uploading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Exporting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Importing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Clearing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Downloading. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
88
88
88
89
89
API Index................................................................................................................................................ 94
ii
1.0
1.1
Warning
Introduction
What is iRite?
1.2
1.3
Why iRite?
1.4
1.5
1.6
Summary of Changes
2.0
Tutorial
2.1
Getting Started
program HelloWorld;
begin
DisplayStatus("Hello, world!");
end HelloWorld;
program HelloWorld;
handler KeyPressed;
begin
DisplayStatus("Hello, world!");
end;
end HelloWorld;
2.2
The Hello, world! program didnt use any explicitly declared constants or variables (the string Hello, world!
is actually a constant, but not explicitly declared). Most useful programs use many constants and variables. Lets
look at a program that will calculate the area of a circle for various length radii. The program, named
PrintCircleAreas, is listed below.
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
program PrintCircleAreas;
-- Declare constants and aliases here.
g_ciPrinterPort : constant integer := 2;
-- Declare global variables here.
g_iCount : integer := 1;
g_rRadius : real;
g_rArea : real;
g_sPrintText: string;
begin
for g_iCount := 1 to 10
loop
g_rRadius := g_iCount;
g_rArea := CircleArea(g_rRadius);
g_sPrintText := "The area of a circle with radius " + RealToString(g_rRadius, 4, 1)
+ " is " + RealToString(g_rArea, 7, 2);
WriteLn(g_ciPrinterPort, g_sPrintText);
end loop;
end PrintCircleAreas;
The PrintCircleAreas program demonstrates variables and constants as well as introducing these important ideas:
for loop, assignment statement, function declarations, function calling and return parameters, string
concatenation, WriteLn procedure, a naming convention, comments, and a couple of data conversion functions.
You probably know by now that this program will calculate the areas of circles with radius from 1 to 10
(counting by 1s) and send text like, The area of a circle with radius 1 is 3.14, once for each radius, out the
communication port 2.
01
program PrintCircleAreas;
Line 1 is the program header with the keyword program and the program identifier PrintCircleAreas. This is
the same in theory as the HelloWorld program header.
Line 3 is a comment. In iRite all comments are started with a -- (double dash). All text after the double dash up
to the end of the line is considered a comment. Comments are used to communicate to any reader what is going
on in the program on the specific lines with the comment or immediately following the comment. The -- can
start on any column in a line and can be after, on the same line, as other valid program statements.
Line 4 is a global constant declaration for the communication port that a printer may be connected to. This simple
line has many important parts:
04
First, an identifier name is given. Identifier names are made up by the programmer and should accurately
describe what the identifier is used for. In the name g_ciPrinterPort the PrinterPort part tells us that this
identifier will hold the value of a port where a printer should be connected. The g_ci is a prefix used to
describe the type of the identifier. When g_ciPrinterPort is used later on in the program, the prefix may help
someone reading the program, even the programs author, to easily determine the identifiers data type without
having to look back at the declaration.
The g_ in the prefix helps tell us that the identifier is global. Global identifiers are declared outside of any
subprogram (handler, function, procedure) and have global scope. The term scope refers to the region of the
program text in which the identifier is known and understood. The term global means that the identifier is
visible or known everywhere in the program. Global identifiers can be used within an event handler body, or
any procedure or function body. Global identifiers also have program duration. The duration of an identifier
refers to when or at what point in the program the identifier is understood, and when their memory is allocated
and freed. Identifiers with global duration, in a 920i program, are understood in all text regions of the program,
and their memory is allocated at program start-up and is re-allocated when the indicator is powered up.
The c in the prefix helps us recognize that the identifier is a constant. Constants are a special type of identifier
that are initialized to a specific value in the declaration and may not be changed anytime or anywhere in the
program. Constants are declared by adding the keyword constant before the type.
Constants are very useful and make the program more understandable. In this example, we defined the printer
port as port 2. If we would have just used the number 2 in the call to WriteLn, then a reader of the program would
not have any idea that the programmer intended a printer to be connected to the 920is port 2.
Also, in a larger program, port 2 may be used hundreds of times in Write and WriteLn calls. Then, if it were
decided to change the printer port from port 2 to port 3, hundreds of changes would have to be made. With port 2
being a constant, only one change in the declaration of g_ciPrinterPort would be required to change the printer
port from 2 to 3.
The type of the constant is an integer. The i in the prefix helps us identify g_ciPrinterPort as an integer. The
keyword integer follows the keyword constant and specifies the type compatibility of the identifier as an integer
and also determines how much memory will be required to store the value (a value of 2 in this example). In the
iRite programming language, there are only 3 basic data types: integer, real and string.
The initialization of the constant is accomplished with the := 2 part of the statement. Initialization of constants
is done in the declaration, with the assignment operator, :=, followed by the initial value.
Finally, the statement is terminated by a semicolon. The ; is used in iRite and other languages as a statement
terminator and separator. Every statement must be terminated with a semicolon. Dont read this to mean every
line must end in a semicolon; this is not true. A statement may be written on one line, but it is usually easier to
read if the statement is broken down into enough lines to make some keywords stand out and to keep the length
of each line less than 80 characters.
Some statements contain one or more other statements. In our example, the statement:
g_ciPrinterPort : constant integer := 2;
is an example of a simple statement that easily fit on one line of code. The loop statement in the program startup
handler (main code body) is spread out over several lines and contains many additional statements. It does,
however, end with line end loop;, and ends in a semicolon.
06
07
08
09
10
Line 6 is another comment to let us know that the global variables are going to be declared.
Lines 710 are global variable declarations. One integer, g_iCounter, two reals, g_rRadius and g_rArea, and
one string, g_sPrintText, are needed during the execution of this program. Like the constant g_ciPrinterPort,
these identifiers are global in scope and duration; however, they are not constants. They may have an optional
initial value assigned to them, but it is not required. Their value may be changed any time they are in scope,
they may be changed in every region of the program anytime the program is loaded in the 920i.
Lines 1318 are our first look at a function declaration. A function is a subprogram that can be invoked (or
called) by other subprograms. In the PrintCircleAreas program, the function CircleArea is invoked in the
program startup event handler. The radius of a circle is passed into the function when it is invoked. In iRite there
are three types of subprograms: functions, procedures, and handlers.
13
14
15
16
17
18
On line 13, the function declaration starts with the keyword function followed by the function name. The
function name is an identifier chosen by the programmer. We chose the name CircleArea for this function
because the name tells us that we are going to return the area of a circle. Our function CircleArea has an optional
formal arguments (or parameters) list. The formal argument list is enclosed in parenthesis, like this: (rRadius
: real). Our example has one argument, but functions and procedures may have zero or more.
Argument declarations must be separated by a semicolon. Each argument is declared just like any other variable
declaration: starting with an identifier followed by a colon followed by the data type. The exception is that no
initialization is allowed. Initialization wouldnt make sense, since a value is passed into the formal argument
each time the function is called (invoked).
The rRadius parameters are passed by value. This means that the radius value in the call is copied in rRadius. If
rRadius is changed, there is no effect on the value passed into the function. Unlike procedures, functions may
return a value. Our function CircleArea returns the area of a circle. The area is a real number. The data type of the
value returned is specified after the optional formal argument list. The type is separated with a colon, just like in
other variable declarations, and terminated with a semicolon.
Up to this point in our program, we have only encountered global declarations. On line 14 we have a local
declaration. A local declaration is made inside a subprogram and its scope and duration are limited. So the
declaration: crPie : constant real := 3.141592654; on line 14 declares a constant real named
crPie with a value of 3.141592654. The identifier crPie is only knownand only has meaninginside the text
body of the function CircleArea. The memory for crPie is initialized to the value 3.141592654 each time the
function is called.
Line 15 contains the keyword begin and signals the start of the function code body. A function code body
contains one or more statements.
Line 16 is a comment that explains what we are about to do in line 17. Comments are skipped over by the
compiler, and are not considered part of the code. This doesnt mean they are not necessary; they are, but are not
required by the compiler.
Every function must return a value. The value returned must be compatible with the return type declared on line
14. The keyword return followed by a value, is used to return a value and end execution of the function. The
return statement is always the last statement a function runs before returning. A function may have more than
one return statement, one in each conditional execution path; however, it is good programming practice to have
only one return statement per function and use a temporary variable to hold the value of different possible return
values.
The function code body, or statement lists, is terminated with the end keyword on line 18.
In this program we do all the work in the program startup handler. We start this unnamed handler with the begin
keyword on line 21.
23
24
for g_iCount := 1 to 10
loop
25
26
27
28
29
30
31
32
33
34
g_rRadius := g_iCount;
g_rArea := CircleArea(g_rRadius);
g_sPrintText := "The area of a circle with radius " + RealToString(g_rRadius, 4, 1)
+ " is " + RealToString(g_rArea, 7, 2);
WriteLn(g_ciPrinterPort, g_sPrintText);
end loop;
On line 23 we see a for loop to start the first statement in the startup handler. In iRite there are two kinds of
looping constructs. The for loop and the while loop. For loops are generally used when you want to repeat a
section of code for a predetermined number of times. Since we want to calculate the area of 10 different circles,
we chose to use a for loop.
For loops use an optional iteration clause that starts with the keyword for followed by the name of variable,
followed by an assignment statement, followed by the keyword to, then an expression, and finally an optional
step clause. Our example doesnt use a step clause, but instead uses the implicit step of 1. This means that lines
26 through 32 will be executed ten times. The first time g_iCount will have a value of 1, and during the last
iteration, g_iCount will have a value of 10.
All looping constructs (the for and the while) start with the keyword loop and end with the keywords end loop,
followed by a semicolon. In our example, loop is on line 24 and end loop is on line 34. In between these two, are
found, the statements that make up the body of the loop.
Line 26 is an assignment of an integer data type into a real data type. This line is unnecessary and the assignment
could have been made automatically if the integer g_iCount was passed into the function CircleArea directly on
line 27, since CircleArea is expecting a real value. Calls to functions like CircleArea are usually done in an
assignment statement if the functions return value need to be used later in the program. The return value of
CircleArea (the area of a circle with radius g_rRadius) is stored in g_rArea.
The assignment on lines 29 and 30 uses two lines strictly for readability. This single assignment statement does
quite a bit. We are trying to create a string of plain English text that will say: The area of a circle with
radius xx.x is yyyy.yy, where the radius value will be substituted for xx.x and the calculated area will
be substituted for yyyy.yy. The global variable g_sPrintText is a string data type. The constants (or literals):
The area of a circle with radius and is are also strings.
However, g_rRadius and g_iArea are real values. We had to use a function from the API to convert the real
values to strings. The API function RealToString is passed a real and a width integer and a precision integer. The
width parameter specifies the minimum length to reserve in the string for the value. The precision parameter
specifies how many places to report to the right of the decimal place. To concatenate all the small strings into one
string we use the string concatenation operator, +.
Finally, we want to send the new string we made to a printer. The Write and WriteLn procedures from the API
send text data to a specified port. Earlier in the program we decided the printer port will be stored in
g_ciPrinterPort. So the WriteLn call on line 32 send the text stored in g_sPrintText, followed by a carriage return
character, out port 2.
If we had a printer connected to port 2 on the 920i, every time the program startup handler is fired, we would see
the following printed output:
The
The
The
The
The
The
The
The
The
The
area
area
area
area
area
area
area
area
area
area
of
of
of
of
of
of
of
of
of
of
a
a
a
a
a
a
a
a
a
a
circle
circle
circle
circle
circle
circle
circle
circle
circle
circle
with
with
with
with
with
with
with
with
with
with
radius 1.0
radius 2.0
radius 3.0
radius 4.0
radius 5.0
radius 6.0
radius 7.0
radius 8.0
radius 9.0
radius 10.0
is
is
is
is
is
is
is
is
is
is
3.14
12.57
28.27
50.27
78.54
113.10
153.94
201.06
254.47
314.16
3.0
Language Syntax
3.1
Lexical Elements
3.1.1
Identifiers
An identifier is a sequence of letters, digits, and underscores. The first character of an identifier must be a letter
or an underscore, and the length of an identifier cannot exceed 100 characters. Identifiers are not case-sensitive:
HELLO and hello are both interpreted as HELLO.
Examples:
Valid identifiers:
Variable12
_underscore
Std_Deviation
First character must be a letter or an underscore.
Not valid identifiers: 9abc
ABC DEF
Space (blank) is not a valid character in an identifier.
Identifiers are used by the programmer to name programs, data types, constants, variables, and subprograms. You
can name your identifiers anything you want as long as they follow the rules above and the identifiers is not
already used as a keyword or as a built-in type or built-in function. Identifiers provide the name of an entity.
Names are bound to program entities by declarations and provide a simple method of entity reference. For
example, an integer variable iCounter (declared iCounter : integer) is referred to by the name iCounter.
3.1.2
Keywords
Keywords are special identifiers that are reserved by the language definition and can only be used as defined by
the language. The keywords are listed below for reference purposes. More detail about the use of each keyword
is provided later in this manual.
and
array
begin
builtin
constant
database
else
elsif
end
exit
for
function
handler
if
integer
is
loop
mod
not
of
or
procedure program
real
record
return
step
stored
string
then
to
type
var
while
3.1.3
Constants
Constants are tokens representing fixed numeric or character values and are a necessary and important part of
writing code. Here we are referring to constants placed in the code when a value or string is known at the time of
programming and will never change once the program is compiled. The compiler automatically figures out the
data type for each constant.
Note
Be careful not to confuse the constants in this discussion with identifiers declared with the keyword
constant, although they may both be referred to as constants.
10
Real Constants:A real constant is an integer constant immediately followed by a decimal point and another
integer constant. Real constants conform to the requirements of IEEE-754 for double-precision floating point
values. When the compiler sees a number in the format n.n then a real constant is created. The value .56 will
generate a compiler error. Instead compose real constants between 1 and +1 with a leading zero like this: 0.56
and 0.667. The following gives examples of situations where a real constant is used:
rLength := 9.25;
if rValue <= 0.004 then
sResultString := RealToString(98.765);
rLogResult := Log(345.67);
String Constants:A string constant is a sequence of printable characters delimited by quotation marks (double
quotes, " "). The maximum length allowed for a string constant is 1000 characters, including the delimiters.
The following gives examples of situations where a string constant (or string literal) is used:
sUserPrompt := "Please enter the maximum barrel weight:";
WriteLn(iPrinter, "Production Report (1st Shift));
if sUserEntry = "QUIT" then
DisplayStatus("Thank You!");
3.1.4
Delimiters
Delimiters include all tokens other than identifiers and keywords, including the arithmetic operators listed below:
>=
<=
<>
:=
<>
=
+
*
/
.
,
;
:
(
)
[
]
"
Delimiters include all tokens other than identifiers and keywords. Below is a functional grouping of all of the
delimiters in iRite.
Punctuation
Parentheses
() (open and close parentheses) group expressions, isolate conditional expressions, and indicate function
parameters:
iFarenheit := ((9.0/5.0) * iCelcius) + 32;
-- enforce proper precedence
if (iVal >= 12) and (iVal <= 34) or (iMaxVal > 200)
-- conditional expr.
EnableSP(5); -- function parameters
Brackets
[ ] (open and close brackets) indicate single and multidimensional array subscripts:
type CheckerBoard is array [8, 8] of recSquare;
iThirdElement := aiValueArray[3];
Comma
The comma(,) separates the elements of a function argument list and elements of a multidimensional array:
type Matrix is array [4,8] of integer;
GetFilteredCount(iScale, iCounts);
Semicolon
The semicolon (;) is a statement terminator. Any legal iRite expression followed by a semicolon is interpreted as
a statement. Look around at other examples, its used all over the place.
Colon
The colon (:) is used to separate an identifier from its data type. The colon is also used in front of the equal sign
(=) to make the assignment operator:
function GetAverageWeight(iScale : integer) : real;
iIndex : integer;
csCopyright : constant string := "2002 Rice Lake Weighing Systems";
11
Quotation Mark
Quotation marks ("") are used to signal the start and end of string constants:
if sCommand = "download data" then
Write(iPCPort, "Data download in progress.
Please wait");
Relational Operators
Equal to (=)
Not equal to (<>)
The relational and equality operators are only used in an if expression. They may only be used between two
objects of compatible type, and the resulting construct will be evaluated by the compiler to be either true or false;
if
if
if
if
iPointsScored = 6 then
iSpeed > 65 then
rGPA <= 3.0 then
sEntry <> "2" then
Note
Be careful when using the equal to (=) operator with real data. Because of the way real data is
stored and the amount of precision retained, it may not contain what you would expect. For
example, given a real variable named rTolerance:
if rTolerance * 3 = 10 then
-- do something
end if;
Note
The evaluation of the if statement will resolve to false. The real value assigned to rTolerance by the
expression 10.0 / 3.0 will be a real value (3.333333) that, when multiplied by 3, is not quite equal to
10.
Logical Operators
Although they are keywords and not delimiters, this is a good place to talk about Logical Operators. In iRite
the logical operators are and, or, and not and are named logical and, logical or, and logical negation
respectively. They too are only used in an if expression. They can only be used with expressions or values that
evaluate to true or false:
if (iSpeed > 55) and (not flgInterstate) or (strOfficer = "Cranky") then
sDriverStatus := "Busted";
Arithmetic Operators
The arithmetic operators (+, ,* , /, and mod) are used in expression to add, subtract, multiply, and divide integer
and real values. Multiplication and division take precedence over addition and subtraction. A sequence of
operations with equal precedence is evaluated from left to right.
The keyword mod is not a delimiter, but is included here because it is also an arithmetic operator. The modulus
(or remainder) operator returns the remainder when operand 1 is divided by operand 2. For example:
rResult : 7 mod 3;
Note
12
Both division (/) and mod operations can cause the fatal divide-by-zero error if the second operand is
zero.
When using the divide operator with integers, be careful of losing significant digits. For example, if you are
dividing a smaller integer by a larger integer then the result is an integer zero: 4/7 = 0. If you were hoping to
assign the result to a real like in the following example:
rSlope : real;
rSlope := 4/7;
rSlope will still equal 0, not 0.571428671 as might be expected. This is because the compiler does integer math
when both operands are integers, and stores the result in a temporary integer. To make the previous statement
work in iRite, one of the operands must be a real data type or one of the operands must evaluate to a real. So we
could write the assignment statement like:
rSlope := 4.0/7;
If we were dividing two integer variables, we could multiply one of the operands by 1.0 to force the compile to
resolve the expression to a real:
rSlope : real;
iRise : integer := 4;
iRun : integer := 7;
rSlope := (iRise * 1.0) / iRun;
Note
The plus sign (+) is also used as the string concatenation operator. The minus sign () is also used as a
unary minus operator that has the result equal to the negative of its operand.
The assignment operator is used to assign a value to a compatible program variable or to initialize a constant. The
value on the left of the := must be a modifiable value. The following are some invalid examples:
3 := 1 + 1; -- not valid
ciMaxAge := 67; -- where ciMaxAge was declared with keyword constant
iInteger := "This is a string, not an integer!"; -- incompatible types
Structure Member Operator (dot)
The dot (.) is used to access the name of a field of a record or database types.
3.2
Program Structure
A program is delimited by a program header and a matching end statement. The body of a program contains a
declarations section, which may be empty, and an optional main code body. The declaration section and the main
code body may not both be empty.
<program>:
program IDENTIFIER ;
<decl-section>
<optional-main-body>
end IDENTIFIER ;
;
<optional-main-body>:
/* NULL */
| begin <stmt-list>
;
PROGRAM
IDENTIFIER
decl-section
END
optional-main-body
IDENTIFIER
13
The declaration section contains declarations defining global program types, variables, and subprograms. The
main code body, if present, is assumed to be the declaration of the program startup event handler. A program
startup event is generated when the instrument personality enters operational mode at initial power-up and when
exiting setup mode.
Example:
program MyProgram;
KeyCounter : Integer;
handler AnyKeyPressed;
begin
KeyCounter := KeyCounter + 1;
end;
begin
KeyCounter := 0
end MyProgram;
The iRite language requires declaration before use so the order of declarations in a program is very important.
The declaration before use requirement is imposed to prevent recursion, which is difficult for the compiler to
detect.
In general, it make sense for certain types of declarations to always come before others types of declarations. For
example, functions and procedures must always be declared before the handlers. Handlers cannot be called or
invoked from within the program, only by the event dispatching system. But functions and procedures can be
called from within event handlers; therefore, always declare the functions and procedures before handlers.
Another example would be to always declare constants before type definitions. This way you can size an array
with named constants.
Here is an example program with a logical ordering for various elements:
program Template;
14
3.3
Declarations
3.3.1
Type Declarations
Type declarations provide the mechanism for specifying the details of enumeration and aggregate types. The
identifier representing the type name must be unique within the scope in which the type declaration appears. All
user-defined types must be declared prior to being used.
<type-declaration>:
type IDENTIFIER is <type-definition> ';'
;
<type-definition>:
<record-type-definition>
| <array-type-definition>
| <database-type-definition>
| <enum-type-definition>
;
TYPE
IDENTIFIER
IS
type-denition
15
IDENTIFIER
stored-option
constant-option
type
type-declaration
variable-declaration
optional-initial-value
procedure-declaration
function-declaration
handler-declaration
An enumeration type definition defines a finite ordered set of values. Each value, represented by an identifier,
must be unique within the scope in which the type definition appears.
<enum-type-definition>:
'(' <identifier-list> ')'
;
<identifier-list>:
IDENTIFIER
| <identifier-list> ',' IDENTIFIER
;
Examples:
type StopLightColors is (Green, Yellow, Red);
type BatchStates is (NotStarted, OpenFeedGate, CloseGate, WaitforSS, PrintTicket, AllDone);
Record Type Definitions
A record type definition describes the structure and layout of a record type. Each field declaration describes a
named component of the record type. Each component name must be unique within the scope of the record; no
two components can have the same name. Enumeration, record and array type definitions are not allowed as the
type of a component: only previously defined user- or system-defined type names are allowed.
<record-type-definition>:
record
<field-declaration-list>
end record
;
<field-declaration-list>:
<field-declaration>
| <field declaration-list>
<field declaration>
;
<field-declaration>:
IDENTIFIER ':' <type> ';'
;
16
RECORD
END
eld-declaration-list
RECORD
The EmployeeRecord record type definition, below, incorporates two enumeration type definitions, tDepartment
and tEmptype:
type tDepartment is (Shipping, Sales, Engineering, Management);
type tEmptype is (Hourly, Salaried);
type EmployeeRecord is
record
ID : integer;
Last : string;
First : string;
Dept : tDepartment;
EmployeeType : tEmptype;
end record;
Database Type Definitions
A database type definition describes a database structure, including an alias used to reference the database.
<database-type-definition>:
database (STRING_CONSTANT)
<field-declaration-list>
end database
;
<field-declaration-list>:
<field-declaration>
| <field declaration-list>
<field declaration>
;
<field-declaration>:
IDENTIFIER ':' <type> ';'
;
DATABASE
STRING-CONSTANT
END
eld-declaration-list
DATABASE
17
A : integer
B : real
end database;
;
Array Type Definitions
An array type definition describes a container for an ordered collection of identically typed objects. The
container is organized as an array of one or more dimensions. All dimensions begin at index 1.
<array-type-definition>:
array '[' <expr-list> ']' of <type>
;
ARRAY
expr-list
END
type
A two-dimensional array in which each dimension has an index range of 10 (110), for a total of 100 elements
could be defined as follows:
type MyArray is array [10,10] of Integer;
Note
3.3.2
In all of the preceding examples, no variables (objects) are created, no memory is allocated by the type
definitions. The type definition only defines a type for use in a later variable declaration, at which time
memory is allocated.
Variable Declarations
A variable declaration creates an object of a particular type. The type specified must be a previously defined
user- or system-defined type name. The initial value, if specified, must be type-compatible with the declared
object type. All user-defined variables must be declared before being used.
Variables declared with the keyword stored cause memory to be allocated in battery-backed RAM. Stored data
values are retained even after the indicator is powered down.
Variables declared with the keyword constant must have an initial value.
<variable-declaration>:
IDENTIFIER ':' <stored-option> <constant-option> <type>
<optional-initial-value>
;
<stored-option>:
/* NULL */
| stored
;
<constant-option>:
/* NULL */
| constant
;
<optional-initial-value>:
/* NULL */
| := <expr>
;
Example:
MyVariable : StopLightColor;
18
3.3.3
Subprogram Declarations
A subprogram declaration defines the formal parameters, return type, local types and variables, and the
executable code of a subprogram. Subprograms include handlers, procedures, and functions.
Handler Declarations
A handler declaration defines a subprogram that is to be installed as an event handler. An event handler does not
permit parameters or a return type, and can only be invoked by the event dispatching system.
<handler-declaration>:
handler IDENTIFIER ';'
<decl-section>
begin
<stmt-list>
end ';'
;
HANDLER
IDENTIFIER
BEGIN
decl-section
stmt-list
END
A procedure declaration defines a subprogram that can be invoked by other subprograms. A procedure allows
parameters but not a return type. A procedure must be declared before it can be referenced; recursion is not
supported.
<procedure-declaration>:
procedure IDENTIFIER
<optional-formal-args> ';'
<decl-section>
begin
<stmt-list>
end ';'
;
<optional-formal-args>:
/* NULL */
| <formal-args>
;
<formal-args>:
19
IDENTIFIER
optional-formal-args
subprogram-completion
A function declaration defines a subprogram that can be invoked by other subprograms. A function allows
parameters and requires a return type. A function must be declared before it can be referenced; recursion is not
supported. A function must return to the point of call using a return-with-value statement.
<function-declaration>:
function IDENTIFIER
<optional-formal-args> ':' <type> ';'
<decl-section>
begin
<stmt-list>
end ';'
;
FUNCTION
IDENTIFIER
type
optional-formal-args
subprogram-completion
20
begin
return A + B;
end;
function PoundsPerGallon : Real;
begin
return 8.34;
end;
3.4
Statements
There are only six discrete statements in iRite. Some statements, like the if, call, and assignment (:=) are used
extensively even in the simplest program, while the exit statement should be used rarely. The if and the loop
statements have variations and can be quite complex. Lets take a closer look at each of the six:
<stmt>:
<assign-stmt>
| <call-stmt>
| <if-stmt>
| <return-stmt>
| <loop-stmt>
| exit-stmt>
;
3.4.1
Assignment Statement
:=
expr
The assignment statement uses the assignment operator (:=) to assign the expression on the right-hand side to the
object or component on the left-hand side. The types of the left-hand and right-hand sides must be compatible.
The value on the left of the := must be a modifiable value. Here are some examples:
Simple assignments:
iMaxPieces := 12000;
rRotations := 25.3456;
sPlaceChickenPrompt := "Please place the chicken on the scale";
21
Call Statement
The call statement is used to initiate a subprogram invocation. The number and type of any actual parameters are
compared against the number and type of the formal parameters that were defined in the subprogram declaration.
The number of parameters must match exactly. The types of the actual and formal parameters must also be
compatible. Parameter passing is accomplished by copy-in, or by copy-in/copy-out for var parameters.
<call-stmt>:
<name> ';'
;
Copy-in refers to the way value parameters are copied into their corresponding formal parameters. The default
way to pass a parameter in iRite is by value. By value means that a copy of actual parameter is made to use in
the function or procedure. The copy may be changed inside the function or procedure but these changes will
never affect the value of the actual parameter outside of the function or procedure, since only the copy may be
changed.
The other way to pass a parameter is to use a copy-in/copy-out method. To specify the copy-in/copy-out method,
a formal parameter must be preceded by the keyword var in the subprogram declaration. Var stands for
variable, which means the parameter may be changed. Just like with a value parameter, a copy is made.
However, when the function or procedure is done executing, the value of the copy is then copied, or assigned,
back into the actual parameter. This is the copy-out part. The result is that if the formal var parameter was
changed within the subprogram, then the actual parameter will also be changed after the subprogram returns.
Actual var parameters must be values: a constant cannot be passed as a var parameter.
One potentially troublesome issue occurs when passing a global parameter as a var parameter. If a global
parameter is passed to a function or procedure as a var parameter, then the system makes a copy of it to use in the
function body. Lets say that the value of the formal parameter is changed and then some other function or
procedure call is made after the change to the formal parameter. If the function or procedure called uses, by
name, the same global parameter that was passed into the original function, then the value of the global
parameter in the second function will be the value of the global when it was pass into the original function. This
is because the changes made to the formal parameter (only a copy of the actual parameter passed in) have not yet
been copied-out, since the function or procedure has not returned yet. This is better demonstrated with an
example:
program GlobalAsVar;
g_ciPrinterPort : constant integer := 2;
g_sString : string := "Initialized, not changed yet";
procedure PrintGlobalString;
begin
WriteLn(g_ciPrinterPort, g_sString);
end;
22
end;
begin
Write(g_ciPrinterPort, "Before function call: ");
PrintGlobalString;
SetGlobalString(g_sString);
Write(g_ciPrinterPort, "After function call: ");
PrintGlobalString;
end GlobalAsVar;
If Statement
IF
THEN
expr
stmt-list
END
optional-elsif-list
optional-else-part
IF
The if statement is one of the programmers most useful tools. The if statement is used to force the program to
execute different paths based on a decision. In its simplest form, the if statement looks like this:
if <expression> then
<statement list>
end if;
The decision is made after evaluating the expression. The expression is most often a conditional expression. If
the expression evaluates to true, then the statements in <statement list> are executed. This form of the if
statement is used primarily when you only want to do something if a certain condition is true. Here is an
example:
if iStrikes = 3 then
sResponse := "Youre out!";
end if;
ELSE
stmt-list
Another form of the if statement, known as the if-else statement has the general form:
if <expression> then
<statement list 1>
else
<statement list 2>
end if;
23
The if-else is used when the program must decide which of exactly two different paths of execution must be
executed. The path that will execute the statement or statements in <statement list 1> will be chosen if
<expression> evaluates to true. Here is an example:
if iAge => 18 then
sStatus := "Adult";
else
sStatus := "Minor";
end if;
If the statement is false, then the statement or statements in <statement list 2> will be executed. Once the
expression is evaluated and one of the paths is chosen, the expression is not evaluated again. This means the
statement will terminate after one of the paths has been executed.
For example, if the expression was true and we were executing <statement list 1>, and within the code in
<statement list 1> we change some part of <expression> so it would at that moment evaluate to false,
<statement list 2> would still not be executed. This point is more relevant in the next form called the if-elsif.
ELSIF
expr
THEN
stmt-list
The if-elsif version is used when a multi-way decision is necessary and has this general form:
if <expression> then
<statement list 1>
elsif <expression> then
<statement list 2>
elsif <expression> then
<statement list 3>
elsif <expression> then
<statement list 4>
else
<statement list 5>
end if;
24
3.4.4
Loop Statement
optional-iteration-clause
LOOP
END
stmt-list
LOOP
The loop statement is also quite important in programming. The loop statement is used to execute a statement list
0 or more times. An optional expression is evaluated and the statement list is executed. The expression is then
re-evaluated and as long as the expression is true the statements will continue to get executed. The loop
statement in iRite has three general forms. One way is to write a loop with no conditional expression. The loop
will keep executing the loop body (the statement list) until the exit statement is encountered. The exit statement
can be used in any loop, but is most often used in this version without a conditional expression to evaluate. It has
this form:
loop
<statement list>
end loop;
This version is most often used with an if statement at the end of the statement list. This way the statement list
will always execute at least once. This is referred to as a loop-until. Here is an example:
rGrossWeight : real;
loop
WriteLn(2, "Im in a loop.");
GetGross(1, Primary, rGrossWeight);
if rGrossWeight > 200 then
exit;
end if;
end loop;
A similar version uses an optional while clause at the start of the loop. The while-loop version is used when you
want the loop to execute zero or more times. Since the expression is evaluated before the loop is entered, the
statement list may not get executed even once. Here is the general form for the while-loop statement:
while <expression>
loop
<statement list>
end loop;
Here is the same example from above, but with a while clause. Keep in mind that if the gross weight is greater
than 200 pounds, then the loop body will never execute:
rGrossWeight : real;
GetGross(1, Primary, rGrossWeight);
while rGrossWeight <= 200
loop
WriteLn(2, "Im in a loop.");
GetGross(1, Primary, rGrossWeight);
end loop;
Here we see that we had to get the weight before we could evaluate the expression. In addition we have to get the
weight in the loop. In this example, it would be better programming to use the loop-until version.
Another version is known as the for-loop. The for-loop is best used when you want to execute a chunk of code
for a known or predetermined number of times. In its general form the for-loop looks like this:
25
:=
name
expr
TO
expr
optional-step-clause
WHILE
expr
The optional step clause can be omitted if you want <name> to increment by 1 after each run of the statement
list. If you want to increment <name> by 2 or 3, or decrement it by 1 or 2, then you have to use the step clause.
The step expression (1 in the second example below) must be a constant.
for iCount := 97 to 122
loop
strAlpha := strAlpha + chr$(iCount);
end loop;
for iCount := 10 to 0 step -1
loop
if iCount = 0 then
strMissionControl := "Blast off!";
else
strMissionControl := IntegerToString(iCount, 2);
end if;
end loop;
STEP
expr
Note
26
Use caution when designing loops to ensure that you dont create an infinite loop. If your program
encounters an infinite loop, only the loop will run; subsequent queued events will not be run.
3.4.5
Return Statement
The return statement can only be used inside of subprograms (functions, procedures, and event handlers). The
return statement in procedures and handlers cannot return a value. An explicit return statement inside a procedure
or handler is not required since the compiler will insert one if the return statement is missing. If you want to
return from a procedure or handler before the code body is done executing, then you can use the return statement
to exit at that point.
procedure DontDoMuch;
begin
if PromptUser("circle: ") <> SysOK then
return;
end if;
end;
Functions must return a value and an explicit return statement is required. The data type of the expression
returned must be compatible with the return type specified in the function declaration.
function Inc(var viNumber : integer) : integer;
begin
viNumber := viNumber + 1;
return viNumber;
end;
It is permissible to have more than one return statement in a subprogram, but not recommended. In most
instances it is better programming practice to use conditional execution (using the if statement) with one return
statement at the end of the function than it is to use a return statement multiple times. Return statements
liberally dispersed through a subprogram body can result in dead code (code that never gets executed) and
hard-to-find bugs.
RETURN
optional-return-value
Exit Statement
The exit statement is only allowed in loops. It is used to immediately exit any loop (loop-until, for-loop,
while-loop) it is called from. Sometimes it is convenient to be able to exit from a loop instead of testing at the
top. In the case of nested loops (a loop inside another loop), only the innermost enclosing loop will be exited. See
the loop examples in Section 3.4.4 on page 25 for the exit statement in action.
EXIT
;
Figure 3-19. Exit Statement Syntax
27
4.0
Built-in Types
The following built-in types are used in parameters passed to and from the functions described in this section.
Most built-in types are declared in the system.src file found in the iRev application directory. Some built-in types
are defined by the compiler and are not declared in the system.src file.
type SysCode is (SysOK,
SysLFTViolation,
SysOutOfRange,
SysPermissionDenied,
SysInvalidScale,
SysBatchRunning,
SysBatchNotRunning,
SysNoTare,
SysInvalidPort,
SysQFull,
SysInvalidUnits,
SysInvalidSetpoint,
SysInvalidRequest,
SysInvalidMode,
SysRequestFailed,
SysInvalidKey,
SysInvalidWidget,
SysInvalidState,
SysInvalidTimer,
SysNoSuchDatabase,
SysNoSuchRecord,
SysDatabaseFull,
SysNoSuchColumn,
SysInvalidCounter,
SysDeviceError,
SysInvalidChecksum,
SysOk,
SysNoFileSystemFound,
SysPortbusy,
SysFileNotFound,
SysDirectoryNotFound,
SysFileExists,
SysInvalidFileFormat,
SysInvalidMode,
SysBadFilename, (over 8 characters)
SysMediaChanged,
SysNoFileOpen,
SysEndOfFile);
type Mode is (GrossMode, NetMode, TareMode);
type Units is (Primary, Secondary, Tertiary);
type TareType is (NoTare, PushButtonTare, KeyedTare);
type BatchingMode is (Off, Manual, Auto);
type BatchStatus is (BatchComplete, BatchStopped, BatchRunning, BatchPaused);
-- PrintFormat must match the definitions in print.h in the core software.
type PrintFormat is (GrossFmt, NetFmt,
AuxFmt,
TrWInFmt, TrRegFmt, TrWOutFmt,
SPFmt,
AccumFmt, AlertFmt,
28
29
DualAnalogOut );
-- Array size must match MAX_SLOTS in core code common.h.
type HW_array_type is array[14] of HW_type;
-- Graph type must match definitions in graphing.h.
type GraphType is ( Line, Bar, XY );
-- Decimal_Type must match enumeration in cfg.h.
type Decimal_type is ( DP_8_888888,
DP_88_88888,
DP_888_8888,
DP_8888_888,
DP_88888_88,
DP_888888_8,
DP_8888888,
DP_8888880,
DP_8888800,
DP_DEFAULT );
-- IQValType must match the enumeration in iQube.h in the core software.
type IQValType is ( IQSys, IQPlat, IQRawLC, IQCCorrLC, IQZeroLC, IStatLC
IQ2ScaleWt, IQ2StatusLC );
type USBDeviceType is(USBNoDevice, USBHostPC, USBPrinter1, USBPrinter2,
USBKeyboard, USBFileSystem);
type FileAccessMode is(FileCreate, FileAppend, FileRead);
type FileLineTermination is(FileCRLF, FileCR, FileLF);
Using SysCode Data
SysCode data can be used to take some action based on whether or not a function completed successfully. For
example, the following code checks the SysCode result following a GetTare function. If the function completed
successfully, the retrieved tare weight is written to Port 1:
Scale1 : constant Integer := 1;
Port1 : constant Integer := 1;
SysResult : SysCode;
TareWeight : Real;
30
5.0
API Reference
This section lists the application programming interfaces (APIs) used to program the 920i indicator. Functions
are grouped according to the kinds of operations they support.
If you are unsure whether your version of software supports a given API, check the system.src file to see if
5.1
Turns off data recording started with InitDataRecording. This procedure removes all connections to the data
recording function. To restart data recording, use the InitDataRecording function.
Method Signature:
procedure CloseDataRecording (scale_no : Integer);
Parameters:
[in]
scale_no
Scale number
GetDataRecordSize
Returns the number of data points recorded in the user-specified data array.
Method Signature:
function GetDataRecordSize (scale_no : Integer) : Integer;
Parameters:
[in]
scale_no
Scale number
number
GetGross
Sets W to the current gross weight value of scale S, in the units specified by U. W will contain a weight value even
if the scale is in programmed overload.
Method Signature:
function GetGross (S : Integer; U : Units; VAR W : Real) : SysCode;
Parameters:
[in]
S
[in]
U
[out]
W
Scale number
Units (Primary, Secondary, Tertiary)
Gross weight
SysInvalidScale
SysInvalidUnits
SysInvalidRequest
SysDeviceError
SysOK
Example:
GrossWeight : Real;
31
GetNet
Sets W to the current net weight value of scale S, in the units specified by U. W will contain a weight value even if
the scale is in programmed overload.
Method Signature:
function GetNet (S : Integer; U : Units; VAR W : Real) : SysCode;
Parameters:
[in]
S
[in]
U
[out]
W
Scale number
Units (Primary, Secondary, Tertiary)
Net weight
SysInvalidScale
SysInvalidUnits
SysInvalidRequest
SysDeviceError
SysOK
Example:
NetWeight : Real;
Scale number
Units (Primary, Secondary, Tertiary)
Tare weight
SysInvalidScale
SysInvalidUnits
SysInvalidRequest
SysNoTare
SysDeviceError
SysOK
Example:
TareWeight : Real;
InitDataRecording allows raw weights to be stored to a user program-specified array on each iteration of the
scale processor. Recording begins when the start_sp is satisfied and ends when the stop_sp is satisfied.
InitDataRecording specifies the data array used for the recording, scale number, and the start and stop setpoint
numbers.
Note
If the setpoint conditions return to the start conditions (start_sp satisfied, stop_sp not satisfied), recording
will continue at the array location where it left off. Thus, a continuous batch will need to call
CloseDataRecording to stop recording, then call InitDataRecording to restart data recording at the
beginning of the array.
Method Signature:
function InitDataRecording (data : DataArray; scale_no : Integer; start_sp :
Integer; stop_sp : Integer) : SysCode;
32
Parameters:
[in]
[in]
[in]
[in]
data
scale_no
start_sp
stop_sp
SysRequestFailed
SysOK
5.1.2
Tare Manipulation
AcquireTare
Scale number
SysInvalidScale
SysLFTViolation
SysOutOfRange
SysPermissionDenied
SysDeviceError
SysOK
Example:
AcquireTare (Scale1);
ClearTare
Removes the tare associated with scale S and sets the tare type associated with the scale to NoTare.
Method Signature:
function ClearTare (S : Integer) : SysCode;
Parameters:
[in]
S
Scale number
SysInvalidScale
SysNoTare
SysDeviceError
SysOK
Example:
ClearTare (Scale1);
GetTareType
Scale number
Tare type
33
NoTare
PushbuttonTare
KeyedTare
SysInvalidScale
SysOK
Example:
TT : TareType;
Scale number
Units (Primary, Secondary, Tertiary)
Tare weight
SysInvalidScale
SysInvalidUnits
SysLFTViolation
SysOutOfRange
SysDeviceError
SysOK
Example:
DesiredTare : Real;
DesiredTare := 1234.5;
SetTare (Scale1, Primary, DesiredTare);
5.1.3
Rate of Change
GetROC
Scale number
Rate of change value
SysInvalidScale
SysDeviceError
SysOK
Example:
ROC : Real;
34
5.1.4
Accumulator Operations
ClearAccum
Scale number
SysInvalidScale
SysPermissionDenied
SysDeviceError
SysOK
Example:
ClearAccum (Scale1);
GetAccum
Sets W to the value of the accumulator associated with scale S, in the units specified by U.
Method Signature:
function GetAccum (S : Integer; U : Units; VAR W ; Real) : SysCode;
Parameters:
[in]
S
[in]
U
[out]
W
Scale number
Units (Primary, Secondary, Tertiary)
Accumulated weight
SysInvalidScale
SysInvalidUnits
SysDeviceError
SysPermissionDenied
SysOK
Example:
AccumValue : Real;
Sets N to the number of accumulations performed for scale S since its accumulator was last cleared.
Method Signature:
function GetAccumCount (S : Integer; VAR N ; Integer) : SysCode;
Parameters:
[in]
S
[out]
N
Scale number
Accumulator count
SysInvalidScale
SysPermissionDenied
SysDeviceError
SysOK
Example:
NumAccums : Integer;
35
GetAccumDate
Scale number
Accumulator date
SysInvalidScale
SysPermissionDenied
SysDeviceError
SysOK
Example:
AccumDate : String;
Scale number
Accumulator time
SysInvalidScale
SysPermissionDenied
SysDeviceError
SysOK
Example:
AccumTime : String;
Sets W to the average accumulator value associated with scale S, in the units specified by U, since the
accumulator was last cleared.
Method Signature:
function GetAvgAccum (S : Integer; U : Units; VAR W ; Real) : SysCode;
Parameters:
[in]
S
U
[in]
[out]
W
Scale number
Units (Primary, Secondary, Tertiary)
Average accumulator weight
SysInvalidScale
SysInvalidUnits
SysDeviceError
SysPermissionDenied
SysOK
36
Example:
AvgAccum : Real;
Sets V to the text string representing the current display units for scale S.
Method Signature:
function GetUnitsString (S : Integer; U : Units; VAR V : String) : SysCode;
Parameters:
[in]
S
[in]
U
[out]
V
Scale number
Units (Primary, Secondary, Tertiary)
Current display units string
Primary
Secondary
Tertiary
SysInvalidScale
SysInvalidUnits
SysOK
Example:
CurrentUnitsString : Units;
Sets the value of the accumulator associated with scale S to weight W, in units specified by U.
Method Signature:
function SetAccum (S : Integer; U : Units; W : Real) : SysCode;
Parameters:
[in]
S
[in]
U
[in]
W
Scale number
Units (Primary, Secondary, Tertiary)
Accumulator value
SysInvalidScale
SysInvalidUnits
SysDeviceError
SysPermissionDenied
SysOK
Example:
AccumValue : Real;
AccumValue := 110.5
SetAccum (Scale1, Primary, AccumValue);
5.1.5
Scale Operations
CurrentScale
37
Example:
ScaleNumber : Integer;
ScaleNumber := CurrentScale;
GetMode
Sets M to the value representing the current display mode for scale S.
Method Signature:
function GetMode (S : Integer; VAR M : Mode) : SysCode;
Parameters:
[in]
S
[out]
U
Scale number
Current display mode
GrossMode
NetMode
SysInvalidScale
SysDeviceError
SysOK
Example:
CurrentMode : Mode;
Sets U to the value representing the current display units for scale S.
Method Signature:
function GetUnits (S : Integer; VAR U : Units) : SysCode;
Parameters:
[in]
S
[out]
U
Scale number
Current display units
Primary
Secondary
Tertiary
SysInvalidScale
SysDeviceError
SysOK
Example:
CurrentUnits : Units;
Sets V to a non-zero value if scale S is within 0.25 grads of gross zero. If the condition is not met, V is set to zero.
Method Signature:
38
Scale number
Center-of-zero value
SysInvalidScale
SysDeviceError
SysOK
Example:
ScaleAtCOZ : Integer;
Scale number
In-motion value
SysInvalidScale
SysDeviceError
SysOK
Example:
ScaleInMotion : Integer;
Sets V to zero value if scale S is in an overload or underload condition. Otherwise, V is set to a non-zero value.
Method Signature:
Scale number
In-range value
SysInvalidScale
SysDeviceError
SysOK
Example:
ScaleInRange : Integer;
Scale number
39
SysInvalidScale
SysOK
The scale specified by S does not exist. The current scale is not changed
The function completed successfully.
Example:
SelectScale (Scale1);
SetMode
Scale number
Scale mode
GrossMode
NetMode
SysInvalidScale
SysInvalidMode
SysDeviceError
SysOK
Example:
SetMode (Scale1, Gross);
SetUnits
Scale number
Scale units
Primary
Secondary
Tertiary
SysInvalidScale
SysInvalidUnits
SysDeviceError
SysOK
Example:
SetUnits (Scale1, Secondary);
ZeroScale
40
Scale number
SysInvalidScale
SysLFTViolation
SysOutOfRange
SysDeviceError
SysOK
Example:
ZeroScale (Scale1);
5.1.6
GetFilteredCount
Scale number
Current filtered A/D count
SysInvalidScale
SysInvalidRequest
SysDeviceError
SysOK
Example:
FilterCount : Integer;
Scale number
Deadload count
SysInvalidScale
SysInvalidRequest
SysOK
GetLCCW
Scale number
Calibrated span count
SysInvalidScale
SysInvalidRequest
SysOK
41
GetRawCount
Scale number
Current raw A/D count
SysInvalidScale
SysInvalidRequest
SysDeviceError
SysOK
Example:
RawCount : Integer;
Scale number
Test weight value
SysInvalidScale
SysInvalidRequest
SysOK
GetZeroCount
Scale number
Zero count
SysInvalidScale
SysInvalidRequest
SysOK
5.2
System Support
Date$
Disables the specified event handler. See Section 6.1 on page 85 for a list of handlers.
Method Signature:
procedure DisableHandler (handler);
42
DisplayIsSuspended
Returns a true (non-zero) value if the display is suspended (using the SuspendDisplay procedure), or a false
(zero) value if the display is not suspended.
Method Signature:
function DisplayIsSuspended : Integer;
EnableHandler
Enables the specified event handler. See Section 6.1 on page 85 for a list of handlers.
Method Signature:
procedure EnableHandler (handler);
EventChar
Returns a one-character string representing the character received on a communications port that caused the
PortxCharReceived event. If EventChar is called outside the scope of a PortxCharReceived event, EventChar returns a
string of length zero. See Section 6.1 on page 85 for information about the PortxCharReceived event handler.
Method Signature:
function EventChar : String;
Example:
handler Port4CharReceived;
strOneChar : string;
begin
strOneChar := EventChar;
end;
EventKey
Returns an enumeration of type Keys with the value corresponding to the key press that generated the event. See
Section 4.0 on page 28 for a definition of the Keys data type.
Method Signature:
function EventKey : Keys;
Example:
handler KeyPressed;
begin
if EventKey = ClearKey then
end if;
end;
EventPort
Returns the communications port number that received an F#x serial command. This function extracts data from
the CmdxHandler event for the F#x command, if enabled. (The CmdxHandler, if enabled, runs whenever a F#x
command is received on any serial port.) If the CmdxHandler is not enabled, this function returns 0 as the port
number.
Method Signature:
function EventPort : Integer;
EventString
Returns the string sent with an F#x serial command. This function extracts data from the CmdxHandler event for
the F#x command, if enabled. (The CmdxHandler, if enabled, runs whenever a F#x command is received on any
serial port.) If the CmdxHandler is not enabled, or if no string is defined for the F#x command, this function
returns a string of length zero.
Method Signature:
function EventString : String;
43
GetConsecNum
Scale number
Units (Primary, Secondary, Tertiary)
Count-by value
SysInvalidScale
SysInvalidUnits
SysInvalidRequest
SysDeviceError
SysOK
GetDate
Extracts date information from DT and places the data in variables Year, Month, and Day.
Method Signature:
procedure GetDate (DT : DateTime; VAR Year : Integer; VAR Month : Integer; VAR Day
: Integer);
Parameters:
[in]
[out]
[out]
[out]
DT
Year
Month
Day
GetGrads
Scale number
Grads value
SysInvalidScale
SysInvalidRequest
SysDeviceError
SysOK
GetIqubeData
Returns data from a given iQube. The types that IQValType may be are: IQSys, IQPlat, IQRawLC, IQCorrLC,
IQZeroLC, IQStatLC, IQScaleWt, and IQ2StatusLC. IQSys returns the system weight value. IQPlat returns the
millivolt value for the indexed platform. IQRawLC returns the indexed raw load cell millivolt value. IQCorrLC
returns the indexed corrected load cell millivolt value. IQZeroLC returns the indexed load cell deadload millivolt
value. IQStatLC returns the indexed load cell status. IQ2ScaleWt returns the indexed scale weight value. IQSys
and IQPlat are revised to also return the scale data. IQ2StatusLC returns the indexed load cell status. The old
IQStatLC is not supported and will return SysInvalidRequest.
44
Note
When using with Firmware 4.xx/iQube2: The IQSys and IQPlat data types will return SysOk as long as the
command is correctly formatted (i.e., scale exists). If you want to know whether the iQube2 is in an error
condition, look at the value (not the syscode) of the IQ2StatusLC data type.
Method Signature:
function GetIqubeData(port_no : integer; dataType : IQValType; index : integer;
data : real) : SysCode;
SysCode values returned:
SysOutOfRange
SysInvalidRequest
SysDeviceError
SysOK
GetKey
Waits for a key press from the indicator front panel before continuing the program. The optional time-out is
specified in 0.01-second intervals (1/100 seconds); if the wait time is set to zero, the procedure will wait
indefinitely.
Method Signature:
function GetKey (timeout : Integer) : Syscode;
Parameters:
[in]
timeout
Time-out value
Example:
this_key : Keys;
Extracts time information from DT and places the data in variables Hour, Minute, and Second.
Method Signature:
procedure GetTime (DT : DateTime; VAR Hour : Integer; VAR Minute : Integer; VAR
Second : Integer);
Parameters:
[in]
[out]
[out]
[out]
DT
Hour
Minute
Second
GetUID
45
Hardware
Returns an array of HW_type. The elements of the array correspond to option card slots in the 920i. This API is
useful for determining the presence of option cards that are required or that could activate different options in the
user program.
Method Signature:
procedure Hardware(var hw : HW_array_type);
SysCode values returned: None
KeyPress
Provides intrinsic functionality for a key. The following keys will have intrinsic function, in addition to the front
panel keys already in the Keys built-in type: TimeDateKey, WeighInKey, WeighOutKey, ID_EntryKey,
DisplayTareKey, TruckRegsKey, DisplayAccumKey, ScaleSelectKey, DisplayROCKey, SetpointKey,
BatchStartKey, BatchStopKey, BatchPauseKey, BatchResetKey, DiagnosticsKey, ContactsKey, DoneKey,
TestKey. The ContactsKey will actually function like the Dignostics softkey, while the DiagnosticsKey will go
straight to the Diagnostics screen. The DoneKey will only return from the contacts screen. The TestKey will
allow the user program to test for strict weigh mode by not doing anything at all. This API will only function in
actual weigh mode.
Method Signature:
function KeyPress (K : Keys) : SysCode;
SysCode values returned:
SysInvalidMode
SysInvalidKey
SysInvalidRequest
SysOK
The indicator is not actually in weigh mode. The TestKey will return
SysInvalidMode for all sub-modes of weigh mode (ie, the contact screen) as well as
any other mode (ie, time & date entry, or open prompt).
Any Invalid key. Softkeys and Undefined Keys are considered invalid.
Processing the key returns invalid or error.
The function completed successfully
LockKey
Disables the specified front panel key. Possible values are: ZeroKey, GrossNetKey, TareKey, UnitsKey,
PrintKey, Soft1Key, Soft2Key, Soft3Key, Soft4Key, Soft5Key, NavUpKey, NavRightKey, NavDownKey,
NavLeftKey, EnterKey, N1Key, N2Key, N3Key, N4Key, N5Key, N6Key, N7Key, N8Key, N9Key, N0Key,
DecpntKey, ClearKey.
Method Signature:
function LockKey (K : Keys) : SysCode;
Parameters:
[in]
K
Key name
SysInvalidKey
SysOK
ProgramDelay
Pauses the user program for the specified time. Delay time is entered in 0.01-second intervals (1/100 seconds,
100 = 1 second).
Method Signature:
procedure ProgramDelay (D : Integer);
Parameters:
[in]
D
Delay time
Example:
ProgramDelay(200); -- Pauses the program for 2 seconds.
46
ResumeDisplay
Consecutive number
SysOutOfRange
The value specified is not in the allowed range. The consecutive number is not
changed.
The function completed successfully.
SysOK
SetDate
Sets the date in DT to the values specified by Year, Month, and Day.
Method Signature:
function SetDate (VAR DT : DateTime; VAR Year : Integer; VAR Month : Integer; VAR
Day : Integer) : SysCode;
Parameters:
[out]
[in]
[in]
[in]
DT
Year
Month
Day
SysInvalidRequest
SysOK
SetSoftkeyText
Softkey number
Softkey text
SysInvalidRequest
SysOK
The value specified for K is less than 1 or greater than 10, or does not represent a
configured softkey.
The function completed successfully.
SetSystemTime
System DateTime
SysInvalidRequest
SysOK
47
SetTime
Sets the time in DT to the values specified by Hour, Minute, and Second.
Method Signature:
function SetTime (VAR DT : DateTime; VAR Hour : Integer; VAR Minute : Integer; VAR
Second : Integer) : SysCode;
Parameters:
[out]
[in]
[in]
[in]
DT
Hour
Minute
Second
SysInvalidRequest
SysOK
SetUID
Note
Changes made to the UID using the SetUID function are lost when the indicator power is cycled. When
power is restored, the UID is reset to the value at the last SAVE/EXIT from configuration mode.
Method Signature:
function SetUID (newid : String) : SysCode;
Parameters:
[in]
newid
Unit identifier
SysOutOfRange
SysOK
The unit identifier specified for newid is not in the allowed range. The UID is not
changed.
The function completed successfully.
STick
Returns the number of system ticks, in 1/1200th of a second intervals, since the indicator was powered on (1200
= 1 second).
Method Signature:
function STick : Integer;
SuspendDisplay
Enables the specified front panel key. Possible values are: ZeroKey, GrossNetKey, TareKey, UnitsKey, PrintKey,
Soft1Key, Soft2Key, Soft3Key, Soft4Key, Soft5Key, NavUpKey, NavRightKey, NavDownKey, NavLeftKey,
EnterKey, N1Key, N2Key, N3Key, N4Key, N5Key, N6Key, N7Key, N8Key, N9Key, N0Key, DecpntKey,
ClearKey.
48
Method Signature:
function UnlockKey (K : Keys) : SysCode;
Parameters:
K
[in]
Key name
SysInvalidKey
SysOK
UnlockKeypad
SysPermissionDenied
SysOK
WaitForEntry()
Similar to GetEntry, WaitForEntry causes the user program to wait for operator input. Wait time is specified in
0.01-second intervals (1/100 seconds); if the wait time is set to zero, the procedure will wait indefinitely or until
the Enter key is pressed.
Note
The UserEntry handler must be disabled (see DisableHandler on page 42) before using this procedure.
Method Signature:
procedure WaitForEntry (I : Integer);
Parameters:
[in]
I
5.3
Serial I/O
Requests a print operation using the print format specified by F. Output is sent to the port specified in the print
format configuration.
Method Signature:
function Print (F : PrintFormat) : SysCode;
Parameters:
[in]
F
Print format
GrossFmt
NetFmt
TrWInFmt
TrRegFmt
TrWOutFmt
SPFmt
AccumFmt
AuxFmtx
Gross format
Net format
Truck weigh-in format
Truck register format (truck IDs and tare weights)
Truck weigh-out format
Setpoint format
Accumulator format
Auxiliary format
SysInvalidRequest
SysQFull
SysOK
49
Example:
Fmtout : PrintFormat;
Fmtout := NetFmt
Print (Fmtout);
Send
Writes the integer or real number specified in <number> to the port specified by P.
Method Signature:
procedure Send (P : Integer; <number>);
Parameters:
[in]
P
Example:
Send (Port1, 123.55); -- sends the value "123.55" to Port 1.
SendChr
Example:
SendChr (Port1, 65); -- sends upper-case "A" (ASCII 65) to Port 1.
SendNull
Example:
Send (Port1); -- sends a null character (ASCII 00) to Port 1.
SetPrintText
Sets the value of the user-specified format (1-99) to the text specified. The text can be any string of up to 16
characters; if a string of more than 16 characters is specified, nothing is printed.
Method Signature:
function SetPrintText (fmt_num : Integer ; text : String) : Syscode;
Parameters:
[in]
fmt_num User-specified format number
[in]
text
Print format text
Example:
SetPrintText(1, "User Pgm. Text");
StartStreaming
Starts data streaming for the port number specified by P. Streaming must be enabled for the port in the indicator
configuration.
Method Signature:
function StartStreaming (P : Integer) : SysCode;
Parameters:
[in]
P
50
SysInvalidPort
SysInvalidRequest
SysOK
Example:
StartStreaming (1);
StopStreaming
SysInvalidPort
SysInvalidRequest
SysOK
Example:
StopStreaming (1);
Write
Writes the text specified in the <arg-list> to the port specified by P. A subsequent Write or WriteLn
operation will begin where this Write operation ends; a carriage return is not included at the end of the data sent
to the port.
Note
This procedure cannot be used to send null characters. Use the SendChr or SendNull procedure to send
null characters.
Method Signature:
procedure Write (P : Integer; <arg-list>);
Parameters:
[in]
P
Serial port number
[in]
arg_list Print text
Example:
Write (Port1, "This is a test.");
WriteLn
Writes the text specified in the <arg-list> to the port specified by P, followed by a carriage return and a line
feed (CR/LF). The line feed (LF) can be suppressed by setting the indicator TERMIN parameter for the specified
port to CR in the SERIAL menu configuration. A subsequent Write or WriteLn operation begins on the next
line.
Note
This procedure cannot be used to send null characters. Use the SendChr or SendNull procedure to send
null characters.
Method Signature:
51
5.4
Program Scale
SubmitData
For 920i indicators configured for program scale operation, passes data from a user program to the scale
processor. Weight, mode, and tare values are provided by the user program; the displayed weight is the weight
value minus tare. Gross/net mode is set by the gn parameter regardless of whether a tare value is passed. This
allows display of a net value when the net is known but gross and tare values are not available.
Note that because the user program supplies all weight data, weight data acquisition APIs are not valid for
program scales. When used with program scales, these APIs (including GetGross, GetNet, GetTare) will
typically return a SysCode value of SysInvalidScale. Always check the returned SysCode value of scale-related
APIs to ensure valid data.
Syntax:
function SubmitData (scale : Integer; weight : Real; gn : Mode; units : UnitType;
tare : Real) : SysCode;
SysCode values returned:
SysInvalidScale
SysOK
SubmitDSPData
Submit data to a program scale. This function works much like SubmitData() but has fewer parameters. New to
this function is the dp : Decimal_Type that allows the program to set the decimal point for the display. The call
assumes Gross mode and primary units.
Syntax:
function SubmitDSPData( scale : integer; weight : real; units : string; dp :
Decimal_Type ) : SysCode;
SysCode values returned:
SysInvalidScale
SysOK
5.5
Unless otherwise stated, when an API with a VAR parameter returns a SysCode value other than SysOK,
the VAR parameter is not changed.
DisableSP
Setpoint number
SysInvalidSetpoint
SysBatchRunning
SysInvalidRequest
SysOK
Example:
DisableSP (4);
EnableSP
52
Parameters:
[in]
SP
Setpoint number
SysInvalidSetpoint
SysBatchRunning
SysInvalidRequest
SysOK
Example:
EnableSP (4);
GetBatchingMode
Off
Auto
Manual
GetBatchStatus
Batch status
BatchComplete
BatchStopped
BatchRunning
BatchPaused
SysInvalidRequest
SysOK
GetCurrentSP
Setpoint number
SysInvalidRequest
SysBatchNotRunning
SysOK
Example:
CurrentSP : Integer;
GetCurrentSP (CurrentSP);
WriteLn (Port1, "Current setpoint is", CurrentSP);
53
GetSPBand
Sets V to the current band value (BANDVAL parameter) of the setpoint SP.
Method Signature:
function GetSPBand (SP : Integer; V : Real) : SysCode;
Parameters:
[in]
SP
[out]
V
Setpoint number
Band value
SysInvalidSetpoint
SysInvalidRequest
SysOK
Example:
SP7Bandval : Real;
Setpoint number
Captured weight value
SysInvalidSetpoint
SysInvalidRequest
SysOK
GetSPCount
For DINCNT setpoints, sets Count to the value specified for setpoint SP.
Method Signature:
function GetSPCount (SP : Integer; VAR Count : Integer) : SysCode;
Parameters:
[in]
SP
[out]
Count
Setpoint number
Count value
SysInvalidSetpoint
SysInvalidRequest
SysOK
GetSPDuration
For time of day (TOD) setpoints, sets DT to the current trip duration (DURATION parameter) of the setpoint SP.
Method Signature:
function GetSPDuration (SP : Integer; VAR DT : DateTime) : SysCode;
Parameters:
[in]
SP
[out]
DT
Setpoint number
Setpoint trip duration
SysInvalidSetpoint
SysInvalidRequest
SysOK
54
Example:
SP3DUR : DateTime;
Sets V to the current hysteresis value (HYSTER parameter) of the setpoint SP.
Method Signature:
function GetSPHyster (SP : Integer; V : Real) : SysCode;
Parameters:
[in]
SP
[out]
V
Setpoint number
Hysteresis value
SysInvalidSetpoint
SysInvalidRequest
SysOK
Example:
SP5Hyster : Real;
For averaging (AVG) setpoints, sets N to the current number of samples (NSAMPLE parameter) of the setpoint
SP.
Method Signature:
function GetSPNSample (SP : Integer; VAR N : Integer) : SysCode;
Parameters:
[in]
SP
[out]
N
Setpoint number
Sample value
SysInvalidSetpoint
SysInvalidRequest
SysOK
Example:
SP5NS : Integer;
Sets V to the current preact value (PREACT parameter) of the setpoint SP.
Method Signature:
function GetSPPreact (SP : Integer; V : Real) : SysCode;
Parameters:
[in]
SP
[out]
V
Setpoint number
Preact value
SysInvalidSetpoint
SysInvalidRequest
SysOK
55
Example:
SP2Preval : Real;
Sets Count to the preact learn interval value (PCOUNT parameter) of setpoint SP.
Method Signature:
function GetSPPreCount (SP : Integer; Count : Integer) : SysCode;
Parameters:
[in]
SP
[out]
Count
Setpoint number
Preact learn interval value
SysInvalidSetpoint
SysInvalidRequest
SysOK
Example:
SP3PCount : Integer;
For time of day (TOD) setpoints, sets DT to the current trip time (TIME parameter) of the setpoint SP.
Method Signature:
function GetSPTime (SP : Integer; VAR DT : DateTime) : SysCode;
Parameters:
[in]
SP
[out]
DT
Setpoint number
Current setpoint trip time
SysInvalidSetpoint
SysInvalidRequest
SysOK
Example:
SP2TIME : DateTime;
Setpoint number
Setpoint value
SysInvalidSetpoint
SysInvalidRequest
SysOK
56
Example:
SP4Val : Real;
For checkweigh (CHKWEI) setpoints, sets V to the current overrange value (VOVER parameter) of the setpoint
SP.
Method Signature:
function GetSPVover (SP : Integer; VAR V : Real) : SysCode;
Parameters:
[in]
SP
[out]
V
Setpoint number
Overrange value
SysInvalidSetpoint
SysInvalidRequest
SysOK
Example:
SP3VOR : Real;
For checkweigh (CHKWEI) setpoints, sets V to the current underrange value (VUNDER parameter) of the
setpoint SP.
Method Signature:
function GetSPVunder (SP : Integer; VAR V : Real) : SysCode;
Parameters:
[in]
SP
[out]
V
Setpoint number
Underrange value
SysInvalidSetpoint
SysInvalidRequest
SysOK
Example:
SP4VUR : Real;
SysPermissionDenied
SysBatchRunning
SysOK
57
ResetBatch
Terminates a running, stopped, or paused batch process and resets the batch system.
Method Signature:
function ResetBatch : SysCode;
SysCode values returned:
SysPermissionDenied
SysBatchRunning
SysOK
SetBatchingMode
Setpoint number
Batching mode
Off
Auto
Manual
SysInvalidMode
SysOK
SetSPBand
Sets the band value (BANDVAL parameter) of setpoint SP to the value specified by V.
Method Signature:
function SetSPBand (SP : Integer; V : Real) : SysCode;
Parameters:
[in]
SP
[in]
V
Setpoint number
Band value
SysInvalidSetpoint
SysInvalidRequest
SysBatchRunning
SysOK
Example:
SP7Bandval : Real;
SP7Bandval := 10.0
SetSPBand (7, SP7Bandval);
SetSPCount
For DINCNT setpoints, sets the VALUE parameter of setpoint SP to the value specified by Count.
Method Signature:
function SetSPCount (SP : Integer; Count : Integer) : SysCode;
Parameters:
[in]
SP
[in]
Count
58
Setpoint number
Count value
SysInvalidSetpoint
SysInvalidRequest
SysOK
SetSPDuration
For time of day (TOD) setpoints, sets the trip duration (DURATION parameter) of setpoint SP to the value
specified by DT.
Method Signature:
function SetSPDuration (SP : Integer; DT : DateTime) : SysCode;
Parameters:
[in]
SP
[in]
DT
Setpoint number
Setpoint trip duration
SysInvalidSetpoint
SysInvalidRequest
SysBatchRunning
SysOutOfRange
SysOK
Example:
SP3DUR : DateTime;
SP3DUR := 00:3:15
SetSPDuration (3, SP3DUR);
SetSPHyster
Sets the hysteresis value (HYSTER parameter) of setpoint SP to the value specified by V.
Method Signature:
function SetSPHyster (SP : Integer; V : Real) : SysCode;
Parameters:
[in]
SP
[in]
V
Setpoint number
Hysteresis value
SysInvalidSetpoint
SysInvalidRequest
SysBatchRunning
SysOK
Example:
SP5Hyster : Real;
SP5Hyster := 15.0;
SetSPHyster (5, SP5Hyster);
SetSPNSample
For averaging (AVG) setpoints, sets the number of samples (NSAMPLE parameter) of setpoint SP to the value
specified by N.
Method Signature:
function SetSPNSample (SP : Integer; N : Integer) : SysCode;
Parameters:
[in]
SP
[in]
N
Setpoint number
Sample value
59
SysInvalidSetpoint
SysInvalidRequest
SysBatchRunning
SysOutOfRange
SysOK
Example:
SP5NS : Integer;
SP5NS := 10
SetSPNSample (5, SP5NS);
SetSPPreact
Sets the preact value (PREACT parameter) of setpoint SP to the value specified by V.
Method Signature:
function SetSPPreact (SP : Integer; V : Real) : SysCode;
Parameters:
[in]
SP
[in]
V
Setpoint number
Preact value
SysInvalidSetpoint
SysInvalidRequest
SysBatchRunning
SysOK
Example:
SP2PreVal : Real;
SP2PreVal := 30.0;
SetSPPreact (2, SP2PreVal);
SetSPPreCount
Sets the preact learn interval value (PCOUNT parameter) of setpoint SP to the value specified by Count.
Method Signature:
function SetSPPreCount (SP : Integer; Count : Integer) : SysCode;
Parameters:
[in]
SP
[in]
Count
Setpoint number
Preact learn interval value
SysInvalidSetpoint
SysInvalidRequest
SysBatchRunning
SysOK
Example:
SP3PCount : Integer;
SP3Pcount := 4;
SetSPPreCount (3, SP3PCount);
SetSPTime
For time of day (TOD) setpoints, sets the trip time (TIME parameter) of setpoint SP to the value specified by DT.
Method Signature:
function SetSPTime (SP : Integer; DT : DateTime) : SysCode;
60
Parameters:
[in]
SP
[in]
DT
Setpoint number
Setpoint trip time
SysInvalidSetpoint
SysInvalidRequest
SysBatchRunning
SysOutOfRange
SysOK
Example:
SP2TIME : DateTime;
SP2TIME := 08:15:00
SetSPTime (2, SP2TIME);
SetSPValue
Setpoint number
Setpoint value
SysInvalidSetpoint
SysInvalidRequest
SysBatchRunning
SysOutOfRange
SysOK
Example:
SP4Val : Real;
SP4Val := 350.0;
SetSPValue (4, SP4Val);
SetSPVover
For checkweigh (CHKWEI) setpoints, sets the overrange value (VOVER parameter) of setpoint SP to the value
specified by V.
Method Signature:
function SetSPVover (SP : Integer; V : Real) : SysCode;
Parameters:
[in]
SP
[in]
V
Setpoint number
Overrange value
SysInvalidSetpoint
SysInvalidRequest
SysOK
Example:
SP3VOR : Real;
SP3VOR := 35.5
SetSPVover (3, SP3VOR);
61
SetSPVunder
For checkweigh (CHKWEI) setpoints, sets the underrange value (VUNDER parameter) of setpoint SP to the
value specified by V.
Method Signature:
function SetSPVunder (SP : Integer; V : Real) : SysCode;
Parameters:
[in]
SP
[in]
V
Setpoint number
Underrange
SysInvalidSetpoint
SysInvalidRequest
SysOK
Example:
SP4VUR : Real;
SP4VUR := 26.4
SetSPVunder (4, SP4VUR);
StartBatch
SysPermissionDenied
SysBatchRunning
SysOK
StopBatch
SysPermissionDenied
SysBatchNotRunning
SysOK
5.6
In the following digital I/O control functions, slot 0 represents the J2 connector on the indicator CPU board and
supports four digital I/O bits (14). Digital I/O on expansion boards (slots 114) each support 24 bits of I/O (bits
124).
GetDigin
Sets V to the value of the digital input assigned to slot S, bit D. GetDigin sets the value of V to 0 if the input is on,
to 1 if the input is off. Note that the values returned are the reverse of those used when setting an output with the
SetDigout function.
Method Signature:
function GetDigin (S : Integer; D : Integer; VAR V : Integer) : SysCode;
Parameters:
[in]
S
[in]
D
[out]
D
62
Slot number
Bit number
Digital input status
SysInvalidRequest
SysOK
The slot and bit assignment specified is not a valid digital input.
The function completed successfully.
Example:
DIGINS0B3 : Integer;
Sets V to the value of the digital output assigned to slot S, bit D. GetDigout sets the value of V to 0 if the output is
on, to 1 if the output is off. Note that the values returned are the reverse of those used when setting an output with
the SetDigout function.
Method Signature:
function GetDigout (S : Integer; D : Integer; VAR V : Integer) : SysCode;
Parameters:
[in]
S
[in]
D
[out]
D
Slot number
Bit number
Digital output status
SysInvalidRequest
SysOK
The slot and bit assignment specified is not a valid digital output.
The function completed successfully.
Example:
DIGOUTS0B2 : Integer;
Sets value of the digital output assigned to slot S, bit D, to the value specified by V. Set V to 1 to turn the
specified output on; set V to 0 to turn the output off.
Method Signature:
function SetDigout (S : Integer;
Parameters:
[in]
S
[in]
D
[in]
D
Slot number
Bit number
Digital output status
SysInvalidRequest
SysOutOfRange
SysOK
The slot and bit assignment specified is not a valid digital output.
The value V must be 0 (inactive) or 1 (active).
The function completed successfully.
Example:
DIGOUTS0B2 : Integer;
DIGOUTS0B2 := 0;
SetDigout (0, 2, DIGOUTS0B2);
5.7
Fieldbus Data
BusImage
BusImage is a data type to allow a user program to pass integer data to and from a fieldbus.
Method Signature:
type BusImage is array[32] of integer;
63
BusImageReal
BusImageReal is a data type to allow a user program to pass real data to and from a fieldbus.
Method Signature:
type BusImageReal is array[32] of real;
GetFBStatus
Returns the status word for the specified fieldbus. See the fieldbus Installation and Programming manual for a
description of the status word format.
Method Signature:
function GetFBStatus (fieldbus_no : Integer; scale_no : Integer; VAR status : Integer) :
SysCode;
Parameters:
[in]
fieldbus_no
[in]
scale_no
[out]
status
Fieldbus number
Scale number
Fieldbus status
SysInvalidRequest
SysOK
GetImage
For integer data, GetImage returns the content of the BusImage for the specified fieldbus.
Method Signature:
function GetImage (fieldbus_no : Integer; VAR data : BusImage) : SysCode;
Parameters:
[in]
fieldbus_no
[out]
BusImage
Fieldbus number
Bus image
SysInvalidRequest
SysOK
GetImageReal
For real data, GetImage returns the content of the BusImageReal for the specified fieldbus.
Method Signature:
function GetImageReal (fieldbus_no : Integer; VAR data : BusImageReal) : SysCode;
Parameters:
[in]
fieldbus_no
BusImageReal
[out]
Fieldbus number
Bus image
SysInvalidRequest
SysOK
SetImage
For integer data, SetImage sets the content of the BusImage for the specified fieldbus.
Method Signature:
function SetImage (fieldbus_no : Integer; data : BusImage) : SysCode;
Parameters:
[in]
fieldbus_no
[in]
BusImage
Fieldbus number
Bus image
SysInvalidRequest
SysOK
64
SetImageReal
For real data, SetImageReal sets the content of the BusImageReal for the specified fieldbus.
Method Signature:
function SetImage (fieldbus_no : Integer; data : BusImageReal) : SysCode;
Parameters:
[in]
fieldbus_no
[in]
BusImageReal
Fieldbus number
Bus image
SysInvalidRequest
SysOK
5.8
SetAlgout
Sets the analog output card in slot S to the percentage P. Negative P values are set to zero; values greater than
100.0 are set to 100.0.
Method Signature:
function SetAlgout (S : Integer;
Parameters:
[in]
S
[in]
P
P : Real) : SysCode;
Slot number
Analog output percentage value
SysInvalidPort
SysInvalidRequest
SysOK
5.9
ClearPulseCount
Sets the pulse count of the pulse input card in slot S to zero.
Method Signature:
function ClearPulseCount (S : Integer) : SysCode;
Parameters:
[in]
S
Slot number
SysInvalidCounter
SysOK
PulseCount
Sets C to the current pulse count of the pulse input card in slot S.
Method Signature:
function PulseCount (S : Integer;
Parameters:
[in]
S
[out]
C
Slot number
Current pulse count
SysInvalidCounter
SysOK
65
PulseRate
Sets R to the current pulse rate (in pulses per second) of the pulse input card in slot S.
Method Signature:
function PulseRate (S : Integer;
Parameters:
[in]
S
[out]
C
Slot number
Current pulse rate
SysInvalidCounter
SysOK
Displays the string msg in the front panel status message area. The length of string msg should not exceed 32
characters.
Method Signature:
procedure DisplayStatus (msg : String);
Parameters:
[in]
msg
Display text
GetEntry
Opens the alpha entry box and places the string msg in the user prompt area.
Method Signature:
function PromptUser (msg : String) : SysCode;
Parameters:
[in]
msg
Prompt text
SysRequestFailed
SysOK
SelectScreen
Screen number
SysInvalidRequest
SysOK
66
SetEntry
Sets the user entry for a programmed prompt. This procedure can be used to provide a default value for entry box
text when prompting the operator for input. Up to 1000 characters can be specified.
Method Signature:
procedure SetEntry (S : String);
Graph identifier
DrawGraphic
Displays or erases a graphic defined in the bitmap.iri file incorporated into the user program source (.src) file.
See Section 6.6 on page 92 for more information about display programming.
Method Signature:
function DrawGraphic (gr_num : Integer; x_start : Integer; y_start : Integer;
bitmap : DisplayImage; color : Color_type; height : Integer; width : Integer) :
SysCode;
Parameters:
[in]
[in]
[in]
[in]
[in]
[in]
[in]
gr_num
x_start
y_start
bitmap
color
height
width
Graphic number
X-axis starting pixel location
Y-axis starting pixel location
Graphic bitmap
Color type
Graphic height
Graphic width
SysDeviceError
The value specified for gr_num is greater than 100.
SysOK
The function completed successfully.
Setting up a graph requires several functions that must be performed in the following order:
GraphCreate assigns storage and defines the type of graph
GraphInit sets the location of the graph on the display
GraphScale sets the value bounds for the graph
GraphPlot is used to actually plot the graph on the display
GraphCreate
GraphCreate assigns storage and defines the graph display type for use by other graphing functions.
Method Signature:
function GraphCreate (graphic_no : Integer; bitmap : DisplayImage; color :
Color_type; kind : GraphType) : SysCode;
Parameters:
[in]
[in]
[in]
[in]
graphic_no
bitmap
color
kind
Graphic number
Bitmap
Graphic color
Graphic kind
SysInvalidRequest
SysOK
67
Example:
G_Graph1 : DisplayImage;
result : Syscode;
begin
result := GraphCreate(1, G_Graph1, Black, Bar);
if result = SysOK then
result :=GraphInit(71,30,60,110,240);
end if;
end;
GraphInit
GraphInit sets the location of the graph on the display. x_start and y_start values specify the distance, in
pixels, from top left corner of the display at which the top left corner of the graph is shown. height and width
specify the graph size, in pixels. (Full display size is 240 pixels high by 320 pixels wide.)
Method Signature:
function GraphInit (graphic_no : Integer; x_start : Integer; y_start : Integer;
height : Integer; width : Integer) : SysCode;
Parameters:
[in]
[in]
[in]
[in]
[in]
[in]
[in]
graphic_no
x_start
y_start
bitmap
color
height
width
Graphic number
X-axis starting pixel location
Y-axis starting pixel location
Graphic bitmap
Color type
Graphic height
Graphic width
SysInvalidRequest
SysOutOfRange
SysDeviceError
SysOK
Example:
G_Graph1 : DisplayImage;
result : Syscode;
begin
result := GraphCreate(1, G_Graph1, Black, Bar);
if result = SysOK then
result :=GraphInit(71,30,60,110,240);
end if;
end;
GraphPlot
GraphPlot plots the graph previously set up using the GraphCreate, GraphInit, and GraphScale functions. The
graph appears as a histogram: each GraphPlot call places a bar or line at the right edge of the graph, moving
values from previous calls to the left. The width of the bar, in pixels, is specified by width parameter. The
maximum width value is 8; larger values are reduced to 8. If the y_value is beyond the bounds set by
GraphScale, the bar is plotted to the maximum or minimum value.
Method Signature:
function GraphPlot (graphic_no : Integer; y_value : Real; width : Integer; color :
Color_type) : SysCode;
Parameters:
[in]
[in]
[in]
[in]
68
graphic_no
y_value
color
width
Graphic number
Pixel height of histogram
Color type
Pixel width of moving bar
SysInvalidRequest
SysOK
Example:
result : Syscode;
weight : real;
begin
GetGross(1,Primary,weight);
result := GraphPlot(1, weight, 1, Black);
end;
GraphScale
GraphScale sets the minimum and maximum x and y values for a graph. Currently, only the y values are used for
the histogram displays; x values are reserved for future use, but must be present in the call.
Method Signature:
function GraphScale (graphic_no : Integer; x_min : Real; x_max : Real; y_min :
Real; y_max : Real) : SysCode;
Parameters:
[in]
[in]
[in]
[in]
[in]
graphic_no
x_min
x_max
y_min
y-max
Graphic number
Minimum x-axis value
Maximum x-axis value)
Minimum y-axis value
Maximum y-axis value
SysInvalidRequest
SysOutOfRange
SysOK
Example:
GraphScale(1, 10.0, 50000.0, 0.0, 10000.0);
SetBargraphLevel
Sets the displayed level of bargraph widget W to the percentage (0100%) specified by Level.
Method Signature:
function SetBargraphLevel (W : Integer; Level : Integer) : SysCode;
Parameters:
[in]
W
[in]
Level
SysInvalidWidget
SysOK
SetLabelText
SysInvalidWidget
SysOK
69
SetNumericValue
SysInvalidWidget
SysOK
SetSymbolState
Sets the state of symbol widget W to S. The widget state determines the variant of the widget symbol displayed.
All widgets have at least two states (values 1 and 2); some have three (3). See Section 9.0 of the 920i Installation
Manual for descriptions of the symbol widget states.
Method Signature:
function SetSymbolState (W : Integer; S : Integer) : SysCode;
Parameters:
[in]
W
[in]
S
SysInvalidWidget
SysOK
SetWidgetVisibility
Widget number
Widget visibility
SysInvalidWidget
SysOK
When enabled, this event handler is activated when new data arrives on a field bus option card. SetImage() must
be called before BusCommandHandler() will be activated again. A new activation of the handler can occur when
new data is present on the bus.
Method Signature:
BusCommandHandler()
xKeyReleased
This class of event handlers is activated when a key is released. The "x" is replaced with the name of the key. Key
names are the same as for the xKeyPressed handlers. Note that the xKeyReleased handlers are subject to the
same timing considerations as all other user handlers. The events are queued in the order they are detected. Any
handler that involves lengthy operations may delay the start of other handlers.
Method Signature:
handler xKeyReleased;
70
Adds a record to the referenced database. Using this function invalidates any previous sort operation.
Method Signature:
function <DB>.Add : SysCode;
SysCode values returned:
SysNoSuchDatabase
SysDatabaseFull
SysOK
<DB>.Clear
SysNoSuchDatabase
SysOK
<DB>.Delete
Deletes the current record from the referenced database. Using this function invalidates any previous sort
operation.
Method Signature:
function <DB>.Delete : SysCode;
SysCode values returned:
SysNoSuchDatabase
SysNoSuchRecord
SysOK
The following <DB.Find> functions allow a database to be searched. Column I is an alias for the field name,
generated by the "Generate iRev import file" operation. The value to be matched is set in the working database
record, in the field corresponding to column I, before a call to <DB>.FindFirst or <DB>.FindLast.
<DB>.FindFirst
Finds the first record in the referenced database that matches the contents of <DB> column I.
Method Signature:
function <DB>.FindFirst (I : Integer) : SysCode;
SysCode values returned:
SysNoSuchDatabase
SysNoSuchRecord
SysNoSuchColumn
SysOK
<DB>.FindLast
Finds the last record in the referenced database that matches the contents of <DB> column I.
Method Signature:
function <DB>.FindLast (I : Integer) : SysCode;
SysCode values returned:
SysNoSuchDatabase
SysNoSuchRecord
SysNoSuchColumn
SysOK
71
<DB>.FindNext
Finds the next record in the referenced database that matches the criteria of a previous FindFirst or FindLast
operation.
Method Signature:
function <DB>.FindNext : SysCode;
SysCode values returned:
SysNoSuchDatabase
SysNoSuchRecord
SysOK
<DB>.FindPrev
Finds the previous record in the referenced database that matches the criteria of a previous FindFirst or FindLast
operation.
Method Signature:
function <DB>.FindLast : SysCode;
SysCode values returned:
SysNoSuchDatabase
SysNoSuchRecord
SysOK
<DB>.GetFirst
SysNoSuchDatabase
SysNoSuchRecord
SysOK
<DB>.GetLast
SysNoSuchDatabase
SysNoSuchRecord
SysOK
<DB>.GetNext
SysNoSuchDatabase
SysNoSuchRecord
SysOK
<DB>.GetPrev
72
SysNoSuchDatabase
SysNoSuchRecord
SysOK
<DB>.Sort
Sorts database <DB> into ascending order based on the contents of column I. The sort table supports a maximum
of 30 000 elements. Databases with more than 30 000 records cannot be sorted.
Method Signature:
function <DB>.Sort (I : Integer) : SysCode;
SysCode values returned:
SysNoSuchDatabase
SysNoSuchRecord
SysOK
<DB>.Update
Updates the current record in the referenced database with the contents of <DB>. Using this function invalidates
any previous sort operation.
Method Signature:
function <DB>.Update : SysCode;
SysCode values returned:
SysNoSuchDatabase
SysNoSuchRecord
SysOK
Resets the value of timer T (132) by stopping the timer, setting the timer mode to TimerOneShot, and setting the
timer time-out to 1.
Parameters:
[in]
T
Timer number
Method Signature:
function ResetTimer (T : Integer) : Syscode;
SysCode values returned:
SysInvalidTimer
SysOK
ResumeTimer
Timer number
SysInvalidTimer
SysOK
73
SetTimer
Sets the time-out value of timer T (132). Timer values are specified in 0.01-second intervals (1= 10 ms, 100 =
1 second). For one-shot timers, the SetTimer function must be called again to restart the timer once it has expired.
Method Signature:
function SetTimer (T : Integer ; V : Integer) : Syscode;
Parameters:
[in]
T
[in]
V
Timer number
Timer value
SysInvalidTimer
SysOK
SetTimerDigout
SetTimer Digout is used to provide precise control of state changes for timers using TimerDigoutOff or
TimerDigoutOn modes. The state of the specified digital output (slot S, bit D)is changed when timer T (132)
expires.
Method Signature:
function SetTimer (T : Integer ; S : Integer ; D: Integer) : Syscode;
Parameters:
[in]
T
[in]
S
[in]
D
Timer number
Digital I/O slot number
Digital I/O bit number
SysInvalidTimer
SysOK
Example:
SetTimer(1,100); -- Set value of Timer1 to 100 (1 second)
SetTimerMode(1,TimerDigoutOn); -- Set timer mode to turn on the digital output
SetTimerDigout(1,0,1); -- Set which digital output to control (slot 0, bit 1)
StartTimer(1); -- Start timer
SetTimerMode
Sets the mode value, M, of timer T (132). This function, normally included in a program startup handler, only
needs to be called once for each timer unless the timer mode is changed.
Method Signature:
function SetTimer (T : Integer ; M : TimerMode) : Syscode;
Parameters:
[in]
T
[in]
M
Timer number
Timer mode
TimerOneShot
TimerContinuous
TimerDigOutOff
TimerDigOutOn
SysInvalidTimer
SysInvalidState
SysInvalidRequest
SysOK
74
StartTimer
Starts timer T (132). For one-shot timers, this function must be called each time the timer is used. Continuous
timers are started only once; they do not require another call to StartTimer unless stopped by a call to the
StopTimer function.
Method Signature:
function StartTimer (T : Integer) : Syscode;
Parameters:
[in]
T
Timer number
SysInvalidTimer
SysOK
StopTimer
Timer number
SysInvalidTimer
SysOK
75
Log10
Returns the sign of the numeric operand. If x < 0, the function returns a value of 1; otherwise, the value returned
is 1.
Method Signature:
function Sign (x : Real) : Integer;
Sin
76
BusImage
type DisplayImage is array[2402] of integer; Type DisplayImage is for user graphics and will hold the largest
displayable user graphic.
DTComponent
type HW_array_type is array[14] of HW_type; Used with the Hardware() API, each element of the array
represents a 920i expansion slot.
HW_type
type HW_type is ( NoCard, DualSerial, DualAtoD, SingleAtoD, AnalogOut, DigitalIO, Pulse, Memory,
reservedcard, DeviceNet, Profibus, reserved2card, ABRIO, reserved3card, DSP2000, AnalogInput, Ethernet );
Each of the enumerations represent a kind of option card for the 920i.
Keys
type Keys is (Soft4Key, Soft5Key, GrossNetKey, UnitsKey, Soft3Key, Soft2Key, Soft1Key, ZeroKey,
Undefined3Key, Undefined4Key, TareKey, PrintKey, N1KEY, N4KEY, N7KEY, DecpntKey, NavUpKey,
NavLeftKey, EnterKey, Undefined5Key, N2KEY, N5KEY, N8KEY, N0KEY, Undefined1Key, Undefined2Key,
NavRightKey, NavDownKey, N3KEY, N6KEY, N9KEY, ClearKey);
Mode
type PrintFormat is (GrossFmt, NetFmt, AuxFmt, TrWInFmt, TrRegFmt, TrWOutFmt, SPFmt, AccumFmt,
AlertFmt);
SysCode
77
TimerMode
type UnitType is (kilogram, gram, ounce, short_ton, metric_ton, grain, troy_ounce, troy_pound, long_ton,
custom, none, pound);
WgtMsg
Returns the ASCII value of the first character of string S. If S is an empty string, the value returned is 0.
Method Signature:
function Asc (S : String) : Integer;
Chr$
Returns the string S with all upper-case letters converted to lower case.
Method Signature:
function LCase$ (S : String) : String;
Left$
Returns a string containing the leftmost I characters of string S. If I is greater than the length of S, the function
returns a copy of S.
Method Signature:
function Left$ (S : String; I : Integer) : String;
Len
Returns a number of characters (specified by length) from string s, beginning with the character specified by
start. If start is greater than the string length, the result is an empty string. If start + length is greater
than the length of S, the returned value contains the characters from start through the end of S.
Method Signature:
function Mid$ (S : String; start : Integer; length : Integer) : String;
Oct$
78
Right$
Returns a string containing the rightmost I characters of string S. If I is greater than the length of S, the function
returns a copy of S.
Method Signature:
function Right$ (S : String; I : Integer) : String;
Space$
Returns the string S with all lower-case letters converted to upper case.
Method Signature:
function UCase$ (S : String) : String;
Returns a string representation of the integer I with a minimum length of W. If W is less than zero, zero is used as
the minimum length. If W is greater than 100, 100 is used as the minimum length.
Method Signature:
function IntegerToString (I : Integer; W : Integer) : String;
RealToString
Returns a string representation of the real number R with a minimum length of W, with P digits to the right of the
decimal point. If W is less than zero, zero is used as the minimum length; if W is greater than 100, 100 is used as
the minimum length. If P is less than zero, zero is used as the precision; if P is greater than 20, 20 is used.
Method Signature:
function RealToString (R : Real; W : Integer; P: Integer) : String;
StringToInteger
Returns the integer equivalent of the numeric string S. If S is not a valid string, the function returns the value 0.
Method Signature:
function StringToInteger (S : String) : Integer;
StringToReal
Returns the real number equivalent of the numeric string S. If S is not a valid string, the function returns the
value 0.0.
Method Signature:
function StringToReal (S : String) : Real;
A five-byte IEEE-1594 extended floating point number, expressed as an array or bytes, is converted to a standard
4-byte floating point real. NaN and infinity are processed. If a number is too small to convert to 4-byte precision,
zero is returned. If a number is too large to convert to 4-byte precision, infinity is returned.
Method Signature:
function DecodeExtFloat( weight : ExtFloatArray ) : real;
EncodeExtFloat
Converts a 4-byte floating point real to a 5-byte IEEE-1394 extended floating point number in the form of an
array of five bytes.
79
Method Signature:
function EncodeExtFloat( weight : real ) : ExtFloatArray;
DecodeMessage
An entire measured value response message is partially decoded. Use with DecodeWeight() to decode all
parameters. This routine takes an entire measured value response message (from byte count to checksum) and
decodes the quarter-D bit, the weighing range, stability, and the verified bit. Enumerations are returned as
integers specified in the Sartorius xBPI protocol documentation.
Method Signature:
function DecodeMessage( msg : WgtMsg; var qd : integer; var range : integer; var
stability : integer; var verified : integer ) : SysCode;
SysCode values returned:
SysInvalidChecksum
SysOK
DecodeWeight
An entire measured value response message is partially decoded. Use with DecodeMessage() to decode all
parameters. This routine takes an entire measured value response message (from byte count to checksum) and
decodes the weight, decimal point, units, and status. Enumerations are returned as integers specified in the
Sartorius xBPI protocol documentation.
Method Signature:
function DecodeWeight( msg : WgtMsg; var weight : real; var dp : integer; var units
: integer; var status : integer ) : SysCode;
SysCode values returned:
SysInvalidChecksum
SysOK
InitHiPrec
Establishes communications with an RS-485 Sartorius platform. Sends a BREAK signal to the platform, then
sets communications parameters for xBPI protocol, RS-485, 9600 baud, 8-bit odd parity, two stop bits. 920i
indicator must have port set up accordingly. The platform parameters set by InitHiPrec() are: * Set baud rate to
9600 * Delete tare and application tares * The following are parameter table settings * Allow changes in the
Parameter Table (setting 40) * Standard Weighing Mode (setting 2) * Stability Range (setting 3) * Stability
Symbol Delay (setting 4) * Auto Zero (setting 6) * Zero Range (setting 11) * Power-On Zero Range (setting 12)
* Power-On Tare or Zeroing (setting 13) * Normal Output of Measured Values (setting 14) * Calibration Prompt
Off (setting 15) * Only one Weighing Range (setting 25) * Weight Units = Kilograms (setting 7) * Basic
Accuracy (setting 8) * Communication Type = xBPI (setting 35) * Data Output at Defined Intervals = Auto
(setting 38) * Allow Tare and Zero without standstill (setting 5) Setting numbers are the Sartorius parameter table
setting numbers.
Method Signature:
function InitHiPrec( port_no : integer ) : SysCode;
SysCode values returned:
SysRequestFailed
SysOK
SubmitMessage
An entire Sartorius weight response message (from byte count to checksum) is decoded and submitted to a scale
for display. The scale must be setup as a Program Scale.
Method Signature:
function SubmitMessage( scale : integer; msg : WgtMsg ) : SysCode;
SysCode values returned:
SysInvalidChecksum
SysOK
SysInvalidScale
80
5.21 USB
User program access to the USB file system requires new APIs for the user program to manipulate and use these
files. A user program may have only one file open at a time. Once opened, any further file accesses will be to that
file.
USBFileOpen( filename : string; mode : FileAccessMode ) : Syscode
This API is used to read a file from the flash drive. Opening a file as Read positions the internal pointer at the
start of the file. Opening a file as Create or Append positions the internal pointer at the end of the file. Any
attempt to read a file opened as Create or Append will return SysEndOfFile.
Parameters:
Filename - The 920i will look in a folder named whatever the 920i's UID is set for (defaulted to 1) for the
filename sent as the parameter. Use the entire path (without the drive). For example, if your file is stored on C:/
Examples/USB/Testing.txt the parameter would be: Examples/USB/Testing.txt
FileAccessMode - A new enumeration (see Section 4.0) with the choices of FileCreate, FileAppend, or
FileRead.
SysCode values returned:
SysOk
SysNoFileSystemFound
SysPortBusy
SysFileNotFound
SysDirectoryNotFound
SysFileExists
SysInvalidFileFormat
SysBadFilename (over 8 characters)
SysEndOfFile
Example:
USBFileOpen(Testing.txt, FileCreate); --Creates a new empty file called Testing.txt.
USBFileOpen(test,FileAppend); --Adds to a currently stored file called Testing.txt
USBFileOpen(test,FileRead); --Reads from a currently stored file
USBFileClose()
This API is used to close a currently opened file (see USBFileOpen). A file must be closed before device
removal or the file contents may be corrupted.
No parameters.
SysCode values returned:
SysOk
SysNoFileSystemFound
SysMediaChanged
SysNoFileOpen
This API deletes a file saved to the USB drive. To overwrite an existing file, the user program should first delete
the file, then reopen it with Create access.
Parameters:
Filename - The 920i will look in a folder named whatever the 920i's UID is set for (defaulted to 1) for the
filename sent as the parameter.
SysCode values returned:
SysOk
SysNoFileSystemFound
SysPortBusy
SysFileNotFound
SysDirectoryNotFound
SysBadfilename
Example:
USBFileDelete(Testing.txt);
81
SysInvalidMode
SysBadfilename
Example:
USBFileExists(Testing.txt);
ReadLn( var data : string )
This API will read a string from whatever file is currently open. The string will be placed in a
string-type-variable that must be defined.
Parameters:
Data: This is the string type variable that they data will be placed in to display or print or otherwise be used by
the program. It reads one line at a time and the entire line is in this string.
SysCode values returned:
SysOk
SysNoFileOpen
SysMediaChanged
SysNoFileSystemFound
SysEndOfFile
Example:
Result := ReadLn(sTempString); --Reads a line of data from whatever file is open
while Result <> SysEndOfFile --Loops, looking at the return code until the end
loop
Result := ReadLn(sTempString);
WriteLn(3, sTempString); --Prints each line read out Port 3
end loop;
WriteLn( port : integer; data : string )
Write( port : integer; data : string )
These APIs both writ out a port (and are not new to USB but can be used by the USB). If writing to the USB
drive it will append the string to the end of the currently open file. The only difference between the two is the
WriteLn sends a carriage return/line feed at the end, and Write does not.
Parameters:
Port - Whichever port on the 920i the data will be sent out of. Port 2 is used for USB.
Example - see ReadLn.
GetUSBStatus() : Syscode
This API returns the most recent status report for the USB port. This is useful for validating a Write or WriteLn.
Example:
Result := GetUSBStatus;
GetUSBAssignment() : deviceType
82
Selects a secondary device for current use, capturing the current device as primary.
Parameters: device (see Section 4.0).
SysCode values returned:
SysOk
SysDeviceNotFound
SysPortBusy
Example:
SetUSBAssignment(USBHostPC);
ReleaseUSBAssignment()
SysPortBusy
Example:
ReleaseUSBAssignment;
IsUSBDevicePresent( device : deviceType )
SysDeviceNotFound
Example:
Result := IsUSBDevicePresent(USBFileSystem);
if Result <> SysOk then
WriteLn(OutPort,"Flash Drive Not Found");
else
WriteLn(OutPort,"SysOK");
end if;
83
Opens a file in Read mode using the name of the database and the Unit ID and calls the core to process it as a
database file. The file is closed when done.
SysCode values returned:
SysOk
SysNoSuchDatabase
SysNoFileSystemFound
SysFileAlreadyOpen
SysFileNotFound
SysDirectoryNotFound
SysInvalidFileFormat
SysPortBusy
Example:
if DBLoad("Product") = Sysok then
DisplayStatus("Product Database Loaded into 920i")
end if;
DBSave(database name)
Opens a file in Create mode using the name of the database and the Unit ID and calls the core to process it as a
database file. File is closed when done. For example if the Unit ID in the 920i was 5, it would store a file to E:/
5/Product.txt. (If your computer recognized the thumb drive as drive E).
SysCode values returned:
SysOk
SysNoSuchDatabase
SysNoFileSystemFound
SysFileAlreadyOpen
SysFileNotFound
SysDirectoryNotFound
SysFileExists
SysPortBusy
Example:
if DBSave("Product") = Sysok then
DisplayStatus("Product Database Saved to thumb drive")
end if;
SysCodeToString( code : SysCode )
Returns the name of the SysCode as a string (so it can be printed or displayed).
Example:
Result := SetFileTermin(FileCRLF);
if Result <> SysOk then
WriteLn(3,(SysCodeToString(Result)));--Makes the syscode able to be printed
else
WriteLn(3,"SysOK");
end if;
84
6.0
6.1
Appendix
Event Handlers
Handler
Description
AlertHandler
Runs when an error is generated from an attached iQUBE. Use the EventString function to
retrieve the error message displayed by the 920i.
BusCommandHandler
ClearKeyPressed
ClearKeyReleased
CmdxHandler
Runs when an F#x serial command is received on a serial port, where x is the F# command
number, 132. The communications port number receiving the command and the text
associated with the F#x command can be returned from the CmdxHandler using the
EventPort and EventString functions (see page 43).
DiginSxByActivate
Runs when the digital input assigned to slot x, bit y is activated. Valid bit assignments for slot 0
are 14; valid bit assignments for slots 1 through 14 are 124.
DiginSxByDeactivate
Runs when the digital input assigned to slot x, bit y is deactivated. Valid bit assignments for
slot 0 are 14; valid bit assignments for slots 1 through 14 are 124.
DotKeyPressed
Runs when the decimal point key on the numeric keypad is pressed
DotKeyReleased
Runs when the decimal point key on the numeric keypad is released
EnterKeyPressed
EnterKeyReleased
GrossNetKeyPressed
GrossNetKeyReleased
KeyPressed
Runs when any front panel key is pressed. Use the EventKey function within this handler to
determine which key caused the event.
KeyReleased
Runs when any front panel key is released. Use the EventKey function within this handler to
determine which key caused the event.
MajorKeyPressed
Runs when any of the five preceding major keys is pressed. Use the EventKey function within
this handler to determine which key caused the event.
MajorKeyReleased
Runs when any of the five preceding major keys is released. Use the EventKey function within
this handler to determine which key caused the event.
NavDownKeyPressed
NavDownKeyReleased
NavKeyPressed
Runs when any of the navigation cluster keys (including ENTER) is pressed. Use the EventKey
function within this handler to determine which key caused the event.
NavKeyReleased
Runs when any of the navigation cluster keys (including ENTER) is released. Use the EventKey
function within this handler to determine which key caused the event.
NavLeftKeyPressed
NavLeftKeyReleased
NavRightKeyPressed
NavRightKeyReleased
NavUpKeyPressed
NavUpKeyReleased
NumericKeyPressed
Runs when any key on the numeric keypad (including CLR or decimal point) is pressed. Use
the EventKey function within this handler to determine which key caused the event.
85
Handler
Description
NumericKeyReleased
Runs when any key on the numeric keypad (including CLR or decimal point) is released. Use
the EventKey function within this handler to determine which key caused the event.
NxKeyPressed
NxKeyReleased
PortxCharReceived
Runs when a character is received on port x, where x is the port number, 132. Use the
EventChar function within these handlers to return a one-character string representing the
character that caused the event.
PrintFmtx
Runs when a print format x (110) that includes the event raised (<EV>) token is printed.
PrintKeyPressed
PrintKeyReleased
ProgramStartup
SoftKeyPressed
Runs when any softkey is pressed. Use the EventKey function within this handler to determine
which key caused the event.
SoftKeyReleased
Runs when any softkey is released. Use the EventKey function within this handler to determine
which key caused the event.
SoftxKeyPressed
Runs when softkey x is pressed, where x=the softkey number, 15, left to right
SoftxKeyReleased
Runs when softkey x is released, where x=the softkey number, 15, left to right
SPxTrip
TareKeyPressed
TareKeyReleased
TimerxTrip
UnitsKeyPressed
UnitsKeyReleased
UserxKeyPressed
Runs when a user-defined softkey is pressed, where x is the user-defined key number, 110
UserxKeyReleased
Runs when a user-defined softkey is released, where x is the user-defined key number, 110
UserEntry
Runs when the ENTER key or Cancel softkey is pressed in response to a user prompt
ZeroKeyPressed
ZeroKeyReleased
6.2
Enable/disable handler
Write/Writeln
Type declaration
Type declaration
Type declaration
If/while statement
Object declaration
Object declaration
Exit statement
Subscript reference
86
Error Messages
Qualifying expression
For statement
Initializer
Procedure/function call
All declarations
Illegal comparison
Boolean expression
Subscript reference
Invalid qualifier
Qualifying expression
For statement
Procedure/function call
Handler declaration
Qualifying expression
Procedure/handler declaration
Logical expression
Expression
Procedure/function call
Procedure/function call
Subprogram declaration
Write/Writeln
Subprogram invocation
Type declaration
Type declaration
Assignment statement
Startup body
Return statement
For statement
Procedure/function call
Syntax error
Any statement
Internal error
Internal error
Any declaration
Numeric operators
Procedure/function call
Assignment statement
Undefined identifier
Procedure/function call
Subscript reference
Procedure/function call
87
6.3
You can use iRev and the 920i Interchange database utility software (PN 72809) to edit, save, and restore
databases for the 920i. This section describes procedures for maintaining 920i databases using iRev, including:
Upload: Copies the database from the 920i to iRev
Download: Copies the database from iRev to the 920i
Import: Copies the contents of a database file stored on the PC into iRev
Export: Copies the contents of a database file opened in iRev to a file on the PC
Clear All: Clears the contents of a database on the 920i.
Note
6.3.1
Editing: Databases can be displayed and edited using the iRev Data Editor
Uploading
To upload a database from the indicator (for viewing, editing, or backup), do the following:
1. Make a serial connection between the PC and the 920i
2. Start iRev
3. Connect to the indicator by clicking on the Connect button on the right side of the top toolbar
4. Click the Database bar on the left side of the iRev window
5. Click the Data Editor icon.
6. Select the database you want to upload, then click the Upload button on top right of the toolbar.
7. A status message box will confirm that iRev is Uploading Data. When the upload is done, the message will
change to Upload Complete. Please export your data to a delimited file for backup. Click OK.
You can now view, edit, or export the contents of the 920i database. Note that changing the database in iRev alone
does not change the database stored in the 920i; you must then clear the existing 920i database and replace it by
downloading the edited database (see Section 6.3.5 on page 89).
6.3.2
Exporting
For display, printing, or backup, you can save a database opened in iRev to a text file by using the Export
function.
1. With an open database uploaded to or created in iRev, click Export on the top toolbar.
2. A dialog box is shown to select which separator (delimiter) should be used to separate the database
fields. For example, if you pick tab-delimiting for a customer database, it might look like the following:
ElliotRobert1234555-8686
If you select semi-colon delimiting instead, the same entry will appear as shown below:
Elliot;Robert;1234;555-8686.
3. After you select the delimiter, click Begin. You are prompted to choose where to store the text file. Save
it in the same folder as your other program files.
4. When complete, a message box confirms Export Successful. You can now use the exported file for viewing
or printing the database, or for later import to iRev for download to the 920i.
6.3.3
Importing
Import works the same way as export but brings a previously exported text file into iRev. The imported database
can then be downloaded to the 920i.
1. Start the iRev Data Editor and select the table you into which you want to import data.
2. Click Import on the top toolbar.
3. A dialog box is shown to select the file to import. Double click on the file you want to import.
4. The Data Import Wizard box is shown that displays the first couple of rows of data in your file. Notice that
the field names are shown as the first row. This is not something you want to import into your database
88
since the field names are not part of the data. Click the up arrow next to Start import at row: prompt to start
at row 2 (the real data).
5. Click Next and select the separator character you used when the file was exported (the default is
tab-delimited).
6. Click Next again, then click Finish to import the file. All of your data should now be displayed in iRev. If
you wish to downloaded the imported database to the 920i , follow the procedure described in
Section 6.3.5.
6.3.4
Clearing
The Clear All button on the top of the toolbar in the iRev Data Editor clears both the iRev screen and the entire 920i
database. You must clear an existing 920i database before downloading edited data, but this function must be
used with care to avoid losing data.
To clear a database:
1. Upload the database from the 920i (see Section 6.3.1).
2. Edit the database and fields, if necessary.
3. Use the Export function described in Section 6.3.2 to save a copy of the database.
4. Highlight all of the fields at once and copy them using either Ctrl-C or by choosing Edit-Copy from the
toolbar.
5. Click the Clear All button to clear both the 920i database and the iRev fields.
6. Upload the blank database from the 920i to ensure data integrity. The lock symbol on the iRev screen will
open, allowing a new database to be downloaded.
7. To replace the cleared database with edited data, move the cursor to the upper left-hand box and paste the
copied data back into the iRev database. (Press Ctrl-V or choose Edit-Paste from the toolbar.)
8. Click the Download button to send fresh, edited data back down to the indicator (see below).
6.3.5
Downloading
When you download data to the 920i, it does not overwrite data that is there. Downloaded data is
added to the database regardless of whether it is the same data. If you edit uploaded data in iRev and want to
replace the indicator database, you must first Clear All, upload the cleared (blank) database, and then download
the edited data. (See Section 6.3.4 above.)
1. Create or edit the data in the rows and columns you want entered in the database.
2. With the indicator connected, click the Download button at the top on the toolbar.
3. A status box shows the download progress (Downloading Row [number] of [total rows]). When complete, a
Download completed successfully message is shown. The database is now stored in the 920i.
IMPORTANT:
6.4
The fieldbus data APIs (see Fieldbus Data on page 63), two type definitions (BusImage, BusImageReal), and
the EventPort function are used to manage fieldbus data.
The function of BusCommandHandler is similar to other user-written event handlers. When present and enabled
with the EnableHandler(BusCommandHandler) call, the BusCommandHandler is activated every time a message
is received on a fieldbus. Keeping the BusCommandHandler execution short is important in order to not miss
data transfers on the fieldbus.
The normal operation of BusCommandHandler is expected to include the following system calls in the following
order:
EventPort
GetImage, or GetImageReal
SetImage, or SetImageReal
with intervening code to perform the required user functions. The SetImage or SetImageReal call should be as
close to the end of the BusCommandHandler as possible.
The BusImage type is the data type passed in GetImage and SetImage (or, for real data, GetImageReal and
SetImageReal).
89
This call returns an array of data as received from the fieldbus. As only the data elements received on the fieldbus
are changed in a GetImage call, the array should be initialized prior to the GetImage call. The fieldbus_no is
the number returned by an EventPort call from within the BusCommandHandler.
SetImage(fieldbus_no : integer; var data : BusImage) : SysCode
This call writes data to the fieldbus chip for access on the next cycle of the PLC. All data elements of the data
array should be properly set before calling SetImage. The fieldbus_no is the number returned by an
EventPort call from within the BusCommandHandler.
Example BusCommandHandler Code
--------------------------------------------------------- Handler Name : BusCommandHandler
-- Created By : Rice Lake Weighing Systems
-- Last Modified on : 1/16/2003
--- Purpose : Example handler skeleton.
--- Side Effects :
-------------------------------------------------------handler BusCommandHandler;
--Declaration Section
busPort : integer;
data : BusImage;
i : integer;
result : SysCode;
begin
-- Clear out the data array.
for i := 1 to 32 loop
data[i] := 0;
end loop;
-- Find out which port (which bus card) started this event.
busPort := EventPort;
-- Then read the received data.
result := GetImage(busPort, data);
-- Test result as desired
-- Data interpretation and manipulation goes here.
-- Finally, put the changed data back.
result := SetImage(busPort, data);
-- Test result as desired
end;
6.5
The HARDWARE serial command (see Section 10 of the 920i Installation Manual, PN 67887) returns a list of
coded identifiers to describe which option cards are installed in a 920i system. The following program provides a
similar function by deciphering the coded values returned by the HARDWARE command and printing a list of
installed option cards.
The largest 920i system configuration (CPU board plus two six-card expansion boards) can support up to 14
option cards; the following program builds a 1 x 14 array by searching each slot for an installed option card then
printing a list of slots and installed cards.
90
program Hardware;
my_array : HW_array_type;
handler User1KeyPressed;
i : integer;
next_slot : HW_type;
begin
Hardware(my_array);
for i := 1 to 14
loop
if my_array[i] = NoCard then
WriteLn(2,"Slot ",i," No Card");
elsif my_array[i] = DualAtoD then
WriteLn(2,"Slot ",i," DualAtoD");
elsif my_array[i] = SingleAtoD then
WriteLn(2,"Slot ",i," SinglAtoD");
elsif my_array[i] = DualSerial then
WriteLn(2,"Slot ",i," DualSerial");
elsif my_array[i] = AnalogOut then
WriteLn(2,"Slot ",i," AnalogOut");
elsif my_array[i] = DigitalIO then
WriteLn(2,"Slot ",i," DigitalIO");
elsif my_array[i] = Pulse then
WriteLn(2,"Slot ",i," Pulse");
elsif my_array[i] = Memory then
WriteLn(2,"Slot ",i," Memory");
elsif my_array[i] = DeviceNet then
WriteLn(2,"Slot ",i," DeviceNet");
elsif my_array[i] = Profibus then
WriteLn(2,"Slot ",i," Profibus");
elsif my_array[i] = Ethernet then
WriteLn(2,"Slot ",i," Ethernet");
elsif my_array[i] = ABRIO then
WriteLn(2,"Slot ",i," ABRIO");
elsif my_array[i] = BCD then
WriteLn(2,"Slot ",i," BCD");
elsif my_array[i] = DSP2000 then
WriteLn(2,"Slot ",i," DSP2000");
elsif my_array[i] = AnalogInput then
WriteLn(2,"Slot ",i," AnalogInput");
elsif my_array[i] = ControlNet then
WriteLn(2,"Slot ",i," ControlNet");
elsif my_array[i] = DualAnalogOut then
WriteLn(2,"Slot ",i," DualAnalogOut");
end if;
end loop;
WriteLn(2,"");
end;
end Hardware;
91
6.6
iRite user programs can be used to display graphics. The entire 920i display is writeable; graphics can be of any
size, up to the full size of the 920i display, and up to 100 graphic images can be displayed. The actual number of
graphics that can be loaded depends on the size of the graphics and of the user program, both of which reside in
the user program space.
Graphics used in iRite programs can be from any source but must be saved as monochrome bitmap (.bmp) files
with write access (file cannot be read-only). To enable the file for use in an iRite program, it is converted to a user
program #include (.iri) file using the bmp2iri.exe program (see Figure 6-1).
DOS command window: run bmp2iri.exe
C:\bmp2iri prompt
C:\
bitmapped graphic
prompt.bmp
g_Prompt
bmp2iri.exe
DisplayImage;
Procedure initPrompt;
begin
g_Prompt [1] := 16;
g_Prompt [1] := 16;
g_Prompt [1] := 132153342;
g_Prompt [1] := 2147368956;
g_Prompt [1] := 536350704;
g_Prompt [1] := 2147385342;
g_Prompt [1] := 1073483760;
g_Prompt [1] := 2122218558;
g_Prompt [1] := 1010572920;
g_Prompt [1] := 132121536;
...
bitmap.iri le
Figure 6-1 shows the conversion process for a graphic file, prompt.bmp, to a user program #include, bitmap.iri.
The conversion is done by running the bmp2iri.exe program in a DOS command window: note that the bmp2iri
program assumes the .bmp extension for the input graphic file (prompt.bmp). If additional files are converted
using bmp2iri.exe, the output of the program is appended to the bitmap.iri file.
To display the graphic, the bitmap.iri file must be incorporated into the user program by doing the following:
In the iRite source (.src) file, immediately following the program declaration, add: #include
bitmap.iri
In the startup handler, call the array initialization routine for each graphic.
To display or erase a graphic, or to clear all graphics, call the DrawGraphic API with the appropriate
parameters (see page 67).
92
93
API Index
Symbols
.Add 71
.Clear 71
.Delete 71
.FindFirst 71
.FindLast 71
.FindNext 72
.GetFirst 72
.GetNext 72
.GetPrev 72
.Sort 73
.Update 73
<DB>.FindPrev 72
<DB>.GetLast 72
A
A/D and calibration data APIs
GetFilteredCount 41
GetLCCD 41
GetLCCW 41
GetRawCount 42
GetWVAL 42
GetZeroCount 42
scale operations
GetFilteredCount 41
GetLCCD 41
GetLCCW 41
GetRawCount 42
GetWVAL 42
GetZeroCount 42
Abs 75, 76, 77
Asc 78
ATan 75, 76, 77
BitAnd 76
BitNot 76
BitOr 76
bit-wise operations
BitAnd 76
94
BitNot 76
BitOr 76
BitXor 76
BitXor 76
Ceil 75, 77
Chr$ 78
ClearAccum 35
ClearGraph 67
ClearPulseCount 65
ClearTare 33
CloseDataRecording 31
ClosePrompt 66
Cos 75, 77
CurrentScale 37
data conversion
IntegerToString 79
RealToString 79
StringToInteger 79
StringToReal 79
data recording
CloseDataRecording 31
GetDataRecordSize 31
InitDataRecording 32
database operations
<DB>.FindPrev 72
<DB>.GetLast 72
Date$ 42
display operations
ClosePrompt 66
DisplayStatus 66
GetEntry 66
GetKey 45
PromptUser 66
SelectScreen 66
SetEntry 67
WaitForEntry 49
display programming
DrawGraphic 67
SetBargraphLevel 69
SetLabelText 69
SetNumericValue 70
SetSymbolState 70
SetWidgetVisibility 70
DisplayStatus 66
DrawGraphic 67
EnableHandler 43
EnableSP 52
EventChar 43
EventKey 43
EventPort 43
EventString 43
Exp 75, 77
fieldbus data
GetFBStatus 64
GetImage 63, 64
GetImageReal 64
SetImage 64
SetImageReal 65
GetAccum 35
GetAccumCount 35
GetAccumDate 36
GetAccumTime 36
GetAvgAccum 36
GetBatchingMode 53
GetBatchStatus 53
GetConsecNum 44
GetCountBy 44
GetCurrentSP 53
GetDataRecordSize 31
GetDate 44
GetDigin 62
GetDigout 63
GetEntry 66
GetFBStatus 64
GetFilteredCount 41
GetGrads 44
GetGross 31
GetImage 63, 64
GetImageReal 64
GetKey 45
GetLCCD 41
GetLCCW 41
GetMode 38
GetNet 32
GetRawCount 42
GetROC 34
GetSoftwareVersion 45
GetSPBand 54
GetSPCaptured 54
GetSPDuration 54
GetSPHyster 55
GetSPNSample 55
GetSPPreact 55
GetSPPreCount 56
GetSPTime 56
GetSPValue 56
GetSPVover 57
GetSPVunder 57
GetTare 32
GetTareType 33
GetTime 45
GetUID 45
GetUnits 38
GetUnitsString 37
GetWVAL 42
GetZeroCount 42
GraphCreate 67
graphing
ClearGraph 67
GraphCreate 67
GraphInit 68
GraphPlot 68
GraphScale 69
GraphInit 68
GraphPlot 68
GraphScale 69
Hex$ 78
InCOZ 38
InitDataRecording 32
InMotion 39
InRange 39
IntegerToString 79
LCase$ 78
Left$ 78
Len 78
LockKey 46
Log 75, 77
Log10 76, 77, 78
mathematical operations
Abs 75, 76, 77
ATan 75, 76, 77
Ceil 75, 77
Cos 75, 77
Exp 75, 77
Log 75, 77
Log10 76, 77, 78
Sign 76, 77, 78
Sin 76, 77, 78
Sqrt 76, 77, 78
Tan 76, 77
Mid$ 78
Oct$ 78
PauseBatch 57
Print 49
program scale
SubmitData 52
ProgramDelay 46
PromptUser 66
pulse input operations
ClearPulseCount 65
PulseCount 65
PulseRate 66
PulseCount 65
PulseRate 66
RealToString 79
ResetBatch 58
ResumeDisplay 47
Right$ 79
95
GetAvgAccum 36
SetAccum 37
rate of change
GetROC 34
scale operations
CurrentScale 37
GetMode 38
GetUnits 38
GetUnitsString 37
InCOZ 38
InMotion 39
InRange 39
SelectScale 39
SetMode 40
SetUnits 40
ZeroScale 40
tare manipulation
AcquireTare 33
ClearTare 33
GetTareType 33
SetTare 34
weight acquisition
GetGross 31
GetNet 32
GetTare 32
SelectScale 39
SelectScreen 66
Send 50
SendChr 50
SendNull 50
serial I/O
Print 49
Send 50
SendChr 50
SendNull 50
SetPrintText 50
StartStreaming 50
StopStreaming 51
Write 51
WriteLn 51
SetAccum 37
SetAlgout 65
SetBargraphLevel 69
SetBatchingMode 58
SetConsecNum 47
SetDate 47
SetDigout 63
SetEntry 67
SetImage 64
SetImageReal 65
SetLabelText 69
SetMode 40
SetNumericValue 70
96
GetSPCaptured 54
GetSPDuration 54
GetSPHyster 55
GetSPNSample 55
GetSPPreact 55
GetSPPreCount 56
GetSPTime 56
GetSPValue 56
GetSPVover 57
GetSPVunder 57
PauseBatch 57
ResetBatch 58
SetBatchingMode 58
SetSPBand 58
SetSPCount 58
SetSPDuration 59
SetSPHyster 59
SetSPNSample 59
SetSPPreact 60
SetSPPreCount 60
SetSPTime 60
SetSPValue 61
SetSPVover 61
SetSPVunder 62
StartBatch 62
StopBatch 62
SetPrintText 50
SetSoftkeyText 47
SetSPBand 58
SetSPCount 58
SetSPDuration 59
SetSPHyster 59
SetSPNSample 59
SetSPPreact 60
SetSPPreCount 60
SetSPTime 60
SetSPValue 61
SetSPVover 61
SetSPVunder 62
SetSymbolState 70
SetSystemTime 47
SetTare 34
SetTime 48
SetTimerDigout 74
SetUID 48
SetUnits 40
SetWidgetVisibility 70
Sign 76, 77, 78
Sin 76, 77, 78
Space$ 79
Sqrt 76, 77, 78
StartBatch 62
StartStreaming 50
STick 48
StopBatch 62
StopStreaming 51
string operations
Asc 78
Chr$ 78
Hex$ 78
LCase$ 78
Left$ 78
Len 78
Mid$ 78
Oct$ 78
Right$ 79
Space$ 79
UCase$ 79
StringToInteger 79
StringToReal 79
SubmitData 52
SuspendDisplay 48
system support
Date$ 42
DisableHandler 42
EnableHandler 43
EventChar 43
EventKey 43
EventPort 43
EventString 43
GetConsecNum 44
GetCountBy 44
GetDate 44
GetGrads 44
GetSoftwareVersion 45
GetTime 45
GetUID 45
LockKey 46
ProgramDelay 46
ResumeDisplay 47
SetConsecNum 47
SetDate 47
SetSoftkeyText 47
SetSystemTime 47
SetTime 48
SetUID 48
STick 48
SuspendDisplay 48
SystemTime 48
Time$ 48
UnlockKey 48
UnlockKeypad 49
SystemTime 48
Tan 76, 77
Time$ 48
timer controls
SetTimerDigout 74
UCase$ 79
UnlockKey 48
UnlockKeypad 49
WaitForEntry 49
Write 51
WriteLn 51
ZeroScale 40
Asc 78
ATan 75, 76, 77
B
BitAnd 76
BitNot 76
BitOr 76
bit-wise operations APIs
BitAnd 76
BitNot 76
BitOr 76
BitXor 76
BitXor 76
C
Ceil 75, 77
Chr$ 78
ClearAccum 35
ClearGraph 67
ClearPulseCount 65
ClearTare 33
CloseDataRecording 31
ClosePrompt 66
Cos 75, 77
CurrentScale 37
D
data conversion APIs
IntegerToString 79
RealToString 79
StringToInteger 79
StringToReal 79
data recording APIs
CloseDataRecording 31
GetDataRecordSize 31
InitDataRecording 32
database operations APIs
<DB>.FindPrev 72
<DB>.GetLast 72
Date$ 42
DecodeExtFloat 79
DecodeMessage 80
DecodeWeight 80
digital I/O control APIs
GetDigin 62
GetDigout 63
SetDigout 63
DisableHandler 42
DisableSP 52
display operations APIs
ClosePrompt 66
DisplayStatus 66
GetEntry 66
GetKey 45
PromptUser 66
SelectScreen 66
SetEntry 67
WaitForEntry 49
display programming APIs
DrawGraphic 67
SetBargraphLevel 69
SetLabelText 69
SetNumericValue 70
SetSymbolState 70
SetWidgetVisibility 70
DisplayStatus 66
97
DrawGraphic 67
E
EnableHandler 43
EnableSP 52
EncodeExtFloat 79
EventChar 43
EventKey 43
EventPort 43
EventString 43
Exp 75, 77
F
fieldbus data APIs
GetFBStatus 64
GetImage 63, 64
GetImageReal 64
SetImage 64
SetImageReal 65
G
GetAccum 35
GetAccumCount 35
GetAccumDate 36
GetAccumTime 36
GetAvgAccum 36
GetBatchingMode 53
GetBatchiStatus 53
GetConsecNum 44
GetCountBy 44
GetCurrentSP 53
GetDataRecordSize 31
GetDate 44
GetDigin 62
GetDigout 63
GetEntry 66
GetFBStatus 64
GetFilteredCount 41
GetGrads 44
GetGross 31
GetImage 63, 64
GetImageReal 64
GetIqubeData 44
GetKey 45
GetLCCD 41
GetLCCW 41
GetMode 38
GetNet 32
GetRawCount 42
GetROC 34
GetSoftwareVersion 45
GetSPBand 54
GetSPCaptured 54
GetSPDuration 54
GetSPHyster 55
GetSPNSample 55
GetSPPreact 55
GetSPPreCount 56
GetSPTime 56
98
GetSPValue 56
GetSPVover 57
GetSPVunder 57
GetTare 32
GetTareType 33
GetTime 45
GetUID 45
GetUnits 38
GetUnitsString 37
GetWVAL 42
GetZeroCount 42
GraphCreate 67
graphing APIs
ClearGraph 67
GraphCreate 67
GraphInit 68
GraphPlot 68
GraphScale 69
GraphInit 68
GraphPlot 68
GraphScale 69
H
Hex$ 78
High Precision 79
I
InCOZ 38
InitDataRecording 32
InitHiPrec 80
InMotion 39
InRange 39
IntegerToString 79
L
LCase$ 78
Left$ 78
Len 78
LockKey 46
Log 75, 77
Log10 76, 77, 78
M
mathematical operations APIs
Abs 75, 76, 77
ATan 75, 76, 77
Ceil 75, 77
Cos 75, 77
Exp 75, 77
Log 75, 77
Log10 76, 77, 78
Sign 76, 77, 78
Sin 76, 77, 78
Sqrt 76, 77, 78
Tan 76, 77
Mid$ 78
O
Oct$ 78
GetTare 32
PauseBatch 57
Print 49
program scale APIs
SubmitData 52
ProgramDelay 46
PromptUser 66
pulse input operations APIs
ClearPulseCount 65
PulseCount 65
PulseRate 66
PulseCount 65
PulseRate 66
R
rate of change APIs
GetROC 34
RealToString 79
ResetBatch 58
ResetTimer 73
ResumeDisplay 47
ResumeTimer 73
Right$ 79
S
Scale Data Acquisition 31
Weight Acquisition 31
CloseDataRecording 31
GetDataRecordSize 31
rate of change
GetROC 34
scale operations
CurrentScale 37
GetMode 38
GetUnits 38
GetUnitsString 37
InCOZ 38
InMotion 39
InRange 39
SelectScale 39
SetMode 40
SetUnits 40
ZeroScale 40
tare manipulation
AcquireTare 33
ClearTare 33
GetTareType 33
SetTare 34
weight acquisition
GetGross 31
GetNet 32
99
SetBatchingMode 58
SetSPBand 58
SetSPCount 58
SetSPDuration 59
SetSPHyster 59
SetSPNSample 59
SetSPPreact 60
SetSPPreCount 60
SetSPTime 60
SetSPValue 61
SetSPVover 61
SetSPVunder 62
StartBatch 62
StopBatch 62
SetPrintText 50
SetSoftkeyText 47
SetSPBand 58
SetSPCount 58
SetSPDuration 59
SetSPHyster 59
SetSPNSample 59
SetSPPreact 60
SetSPPreCount 60
SetSPTime 60
SetSPValue 61
SetSPVover 61
SetSPVunder 62
SetSymbolState 70
SetSystemTime 47
SetTare 34
SetTime 48
SetTimer 74
SetTimerDigout 74
SetTimerMode 74
SetUID 48
SetUnits 40
SetWidgetVisibility 70
Sign 76, 77, 78
Sin 76, 77, 78
Space$ 79
Sqrt 76, 77, 78
StartBatch 62
StartStreaming 50
StartTimer 75
STick 48
StopBatch 62
StopStreaming 51
StopTimer 75
string operations APIs
Asc 78
Chr$ 78
Hex$ 78
LCase$ 78
Left$ 78
Len 78
Mid$ 78
Oct$ 78
Right$ 79
Space$ 79
UCase$ 79
100
StringToInteger 79
StringToReal 79
SubmitData 52
SubmitDSPData 52
SubmitMessage 80, 81
SuspendDisplay 48
system support APIs
Date$ 42
DisableHandler 42
EnableHandler 43
EventChar 43
EventKey 43
EventPort 43
EventString 43
GetConsecNum 44
GetCountBy 44
GetDate 44
GetGrads 44
GetSoftwareVersion 45
GetTime 45
GetUID 45
LockKey 46
ProgramDelay 46
ResumeDisplay 47
SetConsecNum 47
SetDate 47
SetSoftkeyText 47
SetSystemTime 47
SetTime 48
SetUID 48
STick 48
SuspendDisplay 48
SystemTime 48
Time$ 48
UnlockKey 48
UnlockKeypad 49
SystemTime 48
T
Tan 76, 77
tare manipulation APIs
AcquireTare 33
ClearTare 33
GetTareType 33
SetTare 34
Time$ 48
timer control APIs
SetTimerDigout 74
Timer Controls 73
U
UCase$ 79
UnlockKey 48
UnlockKeypad 49
W
WaitForEntry 49
weight acquisition APIs
GetGross 31
GetNet 32
GetTare 32
Write 51
WriteLn 51
Z
ZeroScale 40
101
102
PN 67888 04/12