- No category
advertisement
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
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Related manuals
advertisement
Table of contents
- 152 Serial Communications Module DNP V3.0 Master Device Profile
- 154 Serial Communications Module DNP V3.0 Master Implementation Table
- 159 Implementing DNP3 Master Functions
- 163 Reading Static Data from an Outstation
- 165 Reading IIN Data from an Outstation
- 166 Reading Change Event Data of Any Class from an Outstation
- 167 Reading Class 1, 2, 3 Data from an Outstation
- 178 Writing Binary or Analog Output Data to an Outstation: Direct Operate
- 179 Writing Output Data to an Outstation: Select then Operate
- 180 Writing Analog Input Deadband Data to an Outstation
- 181 Reading Time and Date from an Outstation
- 182 Writing Time and Date to an Outstation
- 183 Sending a Cold Restart Command to an Outstation
- 184 Clearing the Device Restart IIN Bit in an Outstation
- 185 Enabling or Disabling Unsolicited Responses in an Outstation
- 187 Serial Communications Module DNP V3.0 Slave Device Profile
- 189 Serial Communications Module DNP V3.0 Slave Implementation Table
- 194 Serial Communications Module DNP3 Slave Point Lists
- 198 Implementing DNP3 Slave Functions
- 210 Configuring a Port for SPL
- 210 Creating an SPL Script
- 211 Operation of the SPL Script
- 212 Exchanging Status and Control Data with the PLC CPU
- 215 Reserved Symbols
- 215 Syntax rules and requirements
- 216 SPL Statements
- 217 Global Variables
- 218 Variable Names
- 218 Variable Reference and Assignment
- 219 Integer Variables
- 220 Array Variables
- 221 Script Control Statements: GOTO
- 222 Script Control Statements: FOR – TO – NEXT
- 223 Script Control Statements: IF - THEN - <ELSE> – ENDIF
- 224 Script Control Statements: GOSUB – RETURN
- 225 Script Control Statements: STOP
- 226 Functional Errors
- 226 Fatal Errors
- 229 Statements to Exchange CPU Data: EXNEXT
- 231 Statements to Exchange CPU Data: EXSTAT
- 234 Statements to Exchange CPU Data: EXREAD
- 235 Statements to Exchange CPU Data: EXWRITE
- 237 SPL Statements for Exchanging Serial Port Data: GETB
- 238 SPL Statements for Exchanging Serial Port Data: PUTB
- 239 Global Variable for Serial Communications: SERIAL
- 240 Optional Global Variables for Serial Communications
- 241 Checksum Statements: BCC
- 241 Checksum Statements: CRC
- 242 Precedence of Operators
- 243 Logical Operators: AND
- 243 Logical Operators: OR
- 244 Logical Operators: XOR
- 244 Logical Operators: MOD
- 245 ASCII Conversion Statements: ASCTOVAL
- 246 ASCII Conversion Statements: VALTOASC
- 247 Time Statements: TIMER
- 247 Time Statements: ELAPSED
- 248 Debugging the SPL Script
- 250 Control SPL Script Execution from the Command Line Interface Port