beautypg.com

ProSoft Technology MVI56-BAS User Manual

Page 36

background image

BASIC Programming

MVI56-BAS ♦ ControlLogix Platform

User Manual

BASIC Module (DB/BAS Compatible)

Page 36 of 234

ProSoft Technology, Inc.

December 13, 2011

3.3

Using Strings

Strings are a group of characters that can be accessed in a BASIC program or

command line by the following syntax:

$(num)

Where num varies between 0 and 254.
Before using strings, you must allocate enough memory using the

STRING

command:

STRING(A,B)

Where:
A = total number of bytes for the all strings
B = maximum number of bytes for each string
The MVI56-BAS requires an extra byte for each string and an additional

overhead byte.

Example:

10 STRING 307, 50
20 $(0) = "TEST 1"
30 $(1) = "TEST 2"
40 $(2) = "TEST 3"
50 $(3) = "TEST 4"
60 $(4) = "TEST 5"
70 $(5) = "TEST 6"

The

STRING

command allocated space for 6 strings (50 bytes each) plus one byte

for each string and one byte overall.
There are several BASIC CALLs that allow string manipulation. Refer to String

CALLs (page 147).