The will still programs that are available from RLWS follow a 920i be executing its other tasks, like calculating current single standard. You are welcome to download this weights, and running the setpoint engine. But it will standard from our website, or you can write your own.
Database Operations” on page 82, “Fieldbus User Program Interface” on page 83, “Program Category Page to Retrieve 920i Hardware Configuration” on Scale Data Acquisition GetMV page 84, and “920i User Graphics” on page 86. System Support Beep DisableHandler EnableHandler EventStatus EventTime...
Hello, world! It would look like this: ’s display in the status message area, every time 920i the indicator is turned on, taken out of configuration mode, or reset. Let’s take a closer look at each line of program HelloWorld;...
The -- can start on any column in a line and can be after, on the same line, as other valid program statements. 920i Programming Reference...
Page 11
Identifiers with global duration, in a program, are understood in all text regions of the program, 920i 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.
Page 12
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 13—18 are our first look at a function declaration. A function is a subprogram that can be invoked (or called) by other subprograms.
Page 13
2. If we had a printer connected to port 2 on the , every time the program startup handler is fired, we would see 920i the following printed output: The area of a circle with radius 1.0 is 3.14...
Literally, any time a whole number is used in the text of the program, the compiler creates an integer constant. The following gives examples of situations where an integer constant is used: iCount : integer := 25; for iIndex := 1 to 3 sResultString := IntegerToString(12345); sysResult := StartTimer(4); 920i Programming Reference...
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"; Language Syntax...
Page 16
4/7 = 0. If you were hoping to assign the result to a real like in the following example: rSlope : real; rSlope := 4/7; 920i Programming Reference...
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 , one of the operands must be a real data type or one of the operands must evaluate to a real. So we iRite could write the assignment statement like: rSlope := 4.0/7;...
Page 18
[g_ciArraySize] of tDescription; -- Variable declarations go here. g_iBuild : integer; g_srcResult : SysCode; g_aArray : tBigArray; g_rSingleRecord : tDescription; -- Start functions and procedures definitions here. function MakeVersionString : string; sTemp : string; begin 920i Programming Reference...
Page 20
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> ';' 920i Programming Reference...
Page 21
field-declaration-list RECORD RECORD Figure 3-5. Record Type Definition Syntax Examples: type MyRecord is record A : integer; B : real; end 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);...
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.
Page 24
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 optional-formal-args IDENTIFIER type subprogram-completion Figure 3-10. Function Declaration Syntax Examples: function Sum (A : integer; B : integer) : Integer; 920i Programming Reference...
begin return A + B; end; function PoundsPerGallon : Real; begin return 8.34; end; Statements There are only six discrete statements in . Some statements, like the if, call, and assignment (:=) are used iRite 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.
begin Write(g_ciPrinterPort, "Before function call: "); PrintGlobalString; SetGlobalString(g_sString); Write(g_ciPrinterPort, "After function call: "); PrintGlobalString; end GlobalAsVar; When run, the program prints the following: Before function call: Initialized, not changed yet In function call: Initialized, not changed yet After function call: String has been changed 3.4.3 If Statement THEN...
Page 28
:= 2; elsif (rWeight > 4.5) and (rWeight < 9.25) then iGrade := 3; elsif (rWeight > 9.25) and (rWeight < 11.875) then iGrade := 4; else iGrade := 0; sErrorString := "Invalid Weight!"; end if; 920i Programming Reference...
3.4.4 Loop Statement LOOP stmt-list optional-iteration-clause LOOP Figure 3-15. Loop Statement Syntax 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.
Page 30
Figure 3-17. Optional Step Clause Syntax NOTE: Use caution when designing loops to ensure that you don’t create an infinite loop. If your program encounters an infinite loop, only the loop will run; subsequent queued events will not be run. 920i Programming Reference...
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.
AuxFmt6, AuxFmt7, AuxFmt8, AuxFmt9, AuxFmt10, AuxFmt11, AuxFmt12, AuxFmt13, AuxFmt14, AuxFmt15, AuxFmt16, AuxFmt17, AuxFmt18, AuxFmt19, AuxFmt20 ); --TimerMode must match the definitions in API_timer.c in the core software. type TimerMode is (TimerOneShot, TimerContinuous, TimerDigoutON, TimerDigoutOFF); type OnOffType is (VOff, VOn); 920i Programming Reference...
This section lists the application programming interfaces (APIs) used to program the indicator. Functions 920i are grouped according to the kinds of operations they support. NOTE: If you are unsure whether your version of software supports a given API, check the system.src file to see if the API is present.
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] Scale number SysCode values returned: The scale specified by does not exist. SysInvalidScale The scale specified by has no tare. SysNoTare 920i Programming Reference...
The scale is reporting an error condition. SysDeviceError The function completed successfully. SysOK Example: ClearTare (Scale1); GetTareType Sets T to indicate the type of tare currently on scale S. Method Signature: function GetTareType (S : Integer; VAR T : TareType) : SysCode; Parameters: [in] Scale number...
The units specified by is not valid. SysInvalidUnits The scale is reporting an error condition. SysDeviceError The accumulator is not enabled for the specified scale. SysPermissionDenied The function completed successfully. SysOK Example: AccumValue : Real; … GetAccum (Scale1, AccumValue); 920i Programming Reference...
Page 39
GetAccumCount 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] Scale number [out] Accumulator count SysCode values returned: The scale specified by does not exist.
… AccumValue := 110.5 SetAccum (Scale1, Primary, AccumValue); 5.1.5 Scale Operations CurrentScale Sets S to the numeric ID of the currently displayed scale. Method Signature: function CurrentScale : Integer; Example: ScaleNumber : Integer; … ScaleNumber := CurrentScale; 920i Programming Reference...
Page 41
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] Scale number [out] Current display mode Mode values returned: Scale is currently in gross mode. GrossMode Scale is currently in net mode.
Page 42
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: function InRange (S : Integer; VAR V : Integer) : SysCode; Parameters: [in] Scale number [in] In-range value SysCode values returned: 920i Programming Reference...
Page 43
The scale specified by does not exist. SysInvalidScale The scale is reporting an error condition. SysDeviceError The function completed successfully SysOK Example: ScaleInRange : Integer; … InRange (Scale1, ScaleInRange); SelectScale Sets scale S as the current scale. Method Signature: function SelectScale (S : Integer) : SysCode; Parameters: [in] Scale number...
GetLCCD (S : Integer; VAR V : Integer) : SysCode; Parameters: [in] Scale number [out] Deadload count SysCode values returned: The scale specified by does not exist. SysInvalidScale The scale specified by is not an A/D-based scale. SysInvalidRequest 920i Programming Reference...
Page 45
The function completed successfully. SysOK GetLCCW Sets V to the calibrated span count for scale S. Method Signature: function GetLCCW (S : Integer; VAR V : Integer) : SysCode; Parameters: [in] Scale number [out] Calibrated span count SysCode values returned: The scale specified by does not exist.
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 79 for a list of handlers. Method Signature: procedure EnableHandler (handler); 920i Programming Reference...
Page 47
EventChar Returns a one-character string representing the character received on a communications port that caused the event. If EventChar is called outside the scope of a event, EventChar returns a PortxCharReceived PortxCharReceived string of length zero. See Section 6.1 on page 79 for information about the event handler.
Page 48
Method Signature: procedure GetEIN (I : Integer); Parameters: [out] EIN number GetGrads Sets G to the configured grad value of scale S. Method Signature: function GetGrads (S : Integer; VAR G : Integer) : SysCode; 920i Programming Reference...
Page 49
Parameters: [in] Scale number [out] Grads value SysCode values returned: The scale specified by does not exist. SysInvalidScale The scale specified by does not support this operation (serial scale). SysInvalidRequest The scale is reporting an error condition. SysDeviceError The function completed successfully. SysOK GetSoftwareVersion Returns the current software version.
Page 50
SetSoftkeyText (K : Integer; S : String) : SysCode; Parameters: [in] Softkey number [in] Softkey text SysCode values returned: The value specified for K is less than 1 or greater than 10, or does not represent a SysInvalidRequest configured softkey. The function completed successfully. SysOK 920i Programming Reference...
Page 51
SetSystemTime Sets the realtime clock to the value specified in DT. Method Signature: function SetSystemTime (VAR DT : DateTime) : SysCode; Parameters: [in] System DateTime SysCode values returned: Hour or minute entry not valid. SysInvalidRequest The function completed successfully. SysOK SetTime Sets the time in DT to the values specified by Hour, Minute, and Second.
Auxiliary format AuxFmtx SysCode values returned: The print format specified by does not exist. SysInvalidRequest The request could not be processed because the print queue is full. SysQFull The function completed successfully. SysOK Example: Fmtout : PrintFormat; … 920i Programming Reference...
Page 53
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] Serial port number Example: Send (Port1, 123.55); -- sends the value "123.55" to Port 1. SendChr Writes the single character specified to the port specified by P.
Page 54
This procedure cannot be used to send null characters. Use the SendChr or SendNull procedure to NOTE: send null characters. Method Signature: procedure Write (P : Integer; <arg-list>); Parameters: [in] Serial port number [in] arg_list Print text Example: WriteLn (Port1, "This is another test."); 920i Programming Reference...
SubmitData indicators configured for program scale operation, passes data from a user program to the scale 920i 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.
Page 56
GetSPBand (SP : Integer; V : Real) : SysCode; Parameters: [in] Setpoint number [out] Band value SysCode values returned: The setpoint specified by does not exist. SysInvalidSetpoint The setpoint specified by has no hysteresis (BANDVAL) parameter. SysInvalidRequest The function completed successfully. SysOK 920i Programming Reference...
Page 57
Example: SP7Bandval : Real; … GetSPBand (7, SP7BAndval); WriteLn (Port1, "Current Band Value of SP7 is", SP7Bandval); GetSPCaptured Sets V to the weight value that satisfied the setpoint SP. Method Signature: function GetSPCaptured (SP : Integer; V : Real) : SysCode; Parameters: [in] Setpoint number...
Page 58
The setpoint specified by does not exist. SysInvalidSetpoint The setpoint specified by has no preact (PREACT) parameter. SysInvalidRequest The function completed successfully. SysOK Example: SP2Preval : Real; … GetSPPreact (2, SP2Preval); WriteLn (Port1, "Current Preact Value of SP2 is", SP2Preval); 920i Programming Reference...
Page 59
GetSPPreCount Sets Count to the preact learn interval value (PCOUNT parameter) of setpoint SP. Method Signature: function GetSPPreCount (SP : Integer; Count : Integer) : SysCode; Parameters: [in] Setpoint number [out] Preact learn interval value Count SysCode values returned: The setpoint specified by does not exist.
Page 60
The function completed successfully. SysOK ResetBatch Terminates a running, stopped, or paused batch process and resets the batch system. Method Signature: function ResetBatch : SysCode; SysCode values returned: The BATCHNG configuration parameter is set to OFF. SysPermissionDenied 920i Programming Reference...
Page 61
No batch routine is running. SysBatchRunning The function completed successfully. SysOK SetBatchingMode Sets the batching mode (BATCHNG parameter) to the value specified by M. Method Signature: function SetBatchingMode (M : BatchingMode) : SysCode; Parameters: [in] Setpoint number [in] Batching mode BatchingMode values sent: Batching mode is off.
Page 62
The setpoint specified by has no NSAMPLE parameter. SysInvalidRequest The value cannot be changed because a batch process is currently running. SysBatchRunning The value specified for is not in the allowed range for setpoint SysOutOfRange The function completed successfully. SysOK 920i Programming Reference...
Page 63
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] Setpoint number [in]...
Page 64
SP3VOR := 35.5 SetSPVover (3, SP3VOR); 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: 920i Programming Reference...
[in] Setpoint number [in] Underrange SysCode values returned: The setpoint specified by does not exist. SysInvalidSetpoint The setpoint specified by has no VUNDER parameter. SysInvalidRequest The function completed successfully. SysOK Example: SP4VUR : Real; … SP4VUR := 26.4 SetSPVunder (4, SP4VUR); StartBatch Starts or resumes a batch run.
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 number fieldbus_no [in] Scale number scale_no 920i Programming Reference...
Page 67
[out] Fieldbus status status SysCode values returned: SysInvalidRequest The function completed successfully. 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 number...
PulseRate (S : Integer; VAR R : Integer) : SysCode; Parameters: [in] Slot number [out] Current pulse rate SysCode values returned: The specified counter ( ) is not a valid pulse input. SysInvalidCounter The function completed successfully. SysOK 920i Programming Reference...
5.10 Display Operations ClosePrompt Closes a prompt opened by the PromptUser function. Method Signature: procedure ClosePrompt; DisplayStatus 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);...
The value specified for gr_num is greater than 100. SysDeviceError The function completed successfully. SysOK SetBargraphLevel Sets the displayed level of bargraph widget W to the percentage (0–100%) specified by Level. Method Signature: function SetBargraphLevel (W : Integer; Level : Integer) : SysCode; Parameters: 920i Programming Reference...
Page 71
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 Installation 920i Manual for descriptions of the symbol widget states. Method Signature: function SetSymbolState (W : Integer;...
Page 73
SysCode values returned: The DisplayImage specified by does not exist. SysInvalidRequest bitmap SysOutOfRange Specified parameters exceed display height or width, or are too small to accommodate the graphic. SysDeviceError Internal error The function completed successfully. SysOK Example: G_Graph1 : DisplayImage; result : Syscode;...
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: 920i Programming Reference...
Page 75
The referenced database cannot be found. SysNoSuchDatabase The requested record is not contained in the database. SysNoSuchRecord The column specified by does not exist. SysNoSuchColumn The function completed successfully. 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;...
Resets the value of timer T (1–32) by stopping the timer, setting the timer mode to TimerOneShot, and setting the timer time-out to 1. Parameters: [in] Timer number Method Signature: function ResetTimer (T : Integer) : Syscode; SysCode values returned: The timer specified by a not valid timer. SysInvalidTimer 920i Programming Reference...
Page 77
The function completed successfully. SysOK ResumeTimer Restarts a stopped timer T (1–32) from its stopped value. Method Signature: function ResumeTimer (T : Integer) : Syscode; Parameters: [in] Timer number SysCode values returned: The timer specified by a not valid timer. SysInvalidTimer The function completed successfully.
Returns a value between –π/2 and π/2, representing the arctangent of x in radians. Method Signature: function Atan (x : Real) : Real; Ceil Returns the smallest integer greater than or equal to x. Method Signature: function Ceil (x : Real) : Integer; 920i Programming Reference...
Returns the cosine of x. x must be specified in radians. Method Signature: function Cos (x : Real) : Real; Returns the value of e Method Signature: function Exp (x : Real) : Real; Returns the value of log (x). Method Signature: function Log (x : Real) : Real;...
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; 920i Programming Reference...
Oct$ Returns an 11-character octal string equivalent to I. Method Signature: function Oct$ (I : Integer) : String; 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.
Integer; stop_sp : Integer) : SysCode; Parameters: [in] Data array name data [in] Scale number scale_no [in] Start setpoint number start_sp [in] Stop setpoint number stop_sp SysCode values returned: The function did not complete. SysRequestFailed The function completed successfully. SysOK 920i Programming Reference...
Runs when the UP navigation key is released 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. Table 6-1. 920i Event Handlers Appendix...
Runs when the ENTER key or Cancel softkey is pressed in response to a user prompt ZeroKeyPressed Runs when the ZERO key is pressed ZeroKeyReleased Runs when the ZERO key is released Table 6-1. 920i Event Handlers (Continued) Compiler Error Messages Error Messages Cause (Statement Type) Argument is not a handler name...
Page 85
Error Messages Cause (Statement Type) Expression must be numeric For statement Expression type does not match declaration Initializer Function name overloads handler name Function declaration uses name reserved for handler Handlers may not be called Procedure/function call Identifier already declared in this scope All declarations Illegal comparison Boolean expression...
Database Operations You can use and the database utility software (PN 72809) to edit, save, and restore ® iRev 920i Interchange databases for the . This section describes procedures for maintaining databases using , including: 920i 920i iRev •...
. If iRev Next Finish you wish to downloaded the imported database to the , follow the procedure described in 920i Section 6.3.5. 6.3.4 Clearing button on the top of the toolbar in the Data Editor clears both the screen and the entire...
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;...
Page 89
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,"...
920i User Graphics user programs can be used to display graphics. The entire display is writeable; graphics can be of any iRite 920i size, up to the full size of the display, and up to 100 graphic images can be displayed. The actual number of...
Need help?
Do you have a question about the 920i and is the answer not in the manual?
Questions and answers