Example 1, Example 2, Example 3 – Rockwell Automation 1746-BAS BASIC LANGUAGE User Manual
Page 18
Publication 1746-RM001A-US-P
2-2 Data Types
When allocating memory for a string, you must account for the overhead bytes
used by BASIC to manipulate strings. BASIC uses one overhead byte per string
being declared plus one additional overhead byte.
Example 1
String 106,20
Allocates space for five 20 byte strings (100 bytes) and includes five overhead bytes
(1 per string) and one additional overhead byte.
In the module you can define strings with the LET statement, the INPUT
statement, and with the ASC operator.
Example 2
>10 STRING 106,20
>20 $(1)=“THIS IS A STRING, ”
>30 INPUT “WHAT’S YOUR NAME? - ”,$(2)
>40 PRINT $(1),$(2)
>50 END
READY
>RUN
WHAT’S YOUR NAME? - FRED
THIS IS A STRING, FRED
READY
>
You can also assign strings to each other with a LET statement.
Example 3
LET $(2)=$(1)
Result: Assigns the string value in $(1) to the STRING $(2).