PACSystems RX3i Serial Communications Modules User`s Manual


Add to my manuals
269 Pages

advertisement

PACSystems RX3i Serial Communications Modules User`s Manual | Manualzz

Integer Variables

Integers are 32-bit signed values with a length of 4 bytes. Integer variables have a valid range of (2,147,483,647 to -2,147,483,646). Values can be assigned to the variables as base 10 whole numbers or hexadecimal values. Hexadecimal numbers in an SPL script must begin with a digit (0-9) and end with an ‘H’. The hexadecimal value for -1 is 0FFFFFFFFH. somevar = 0ABF3H

PRINT somevar somevar = 10 * 20 somevar.0 = 1 somevar.1 = 3 somevar.2 = 5 somevar.3 = 7

Declaring Integer Variables

Each integer variable must be declared using a DIM statement before it can be used in the

SPL script. The DIM statement reserves storage in the system and associates a name with the variable. An error will occur if a variable is dimensioned more than once. One variable can be declared per DIM statement. One DIM statement allowed per line. The DIM statement can be used at any point in the program. DIM statements are executed during runtime as they are encountered, they are not pre-allocated.

The INTEGER statement must be used in conjunction with the DIM statement. INTEGER declares an 32-bit signed integer variable. The variable can either be accessed one byte at a time using the sub-reference dot (‘.’) notation, or assigned a whole signed value. Integer subelements are indexed from 0 to 3, with index 0 the least significant byte and index 3 the most significant byte. An attempt to de-reference an integer using a sub-element index larger than

3 will result in a "range of variable exceeded" error. When declared, the variable is automatically initialized to 0.

Syntax:

[DIM] [variable name] INTEGER

Example:

DIM somevar INTEGER somevar = 1020304H somevar.0 = 4 (LSB) somevar.1 = 3 somevar.2 = 2 somevar.3 = 1 (MSB)

9

GFK-2460E Chapter 9 Serial Protocol Language (SPL) 9-11

advertisement

Was this manual useful for you? Yes No
Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Related manuals

advertisement

Table of contents