Date retrieve string – call 52, Description of string operators – Rockwell Automation 1771-DB Basic Module User Manual - Series A User Manual

Page 108

Advertising
background image

Operating Functions

Chapter 5

5–71

CALL 52 returns the current date in a string (dd/mmm/yy). PUSH the
number of the string to receive the date. You must allocate a minimum of 9
characters for the string.

Example:

u10 STRING 100,20

u20 PUSH 1: CALL 52: REM put date in string 1

u30 PRINT $(1)

u40 END

uRUN
30/JAN/87

A string is a character or group of characters stored in memory. Usually,
the characters stored in a string make up a word or a sentence. Strings
allow you to deal with words instead of numbers. This allows you to refer
to individuals by name instead of by number.

The BASIC Module contains one dimensioned string variable, $([expr]).
The dimension of the string variable (the [expr] value) ranges from 0 to
254. This means that you can define and manipulate 255 different strings
in the BASIC Module. Initially, no memory is allocated for strings.
Memory is allocated by the STRING [expr], [expr] STATEMENT. See
Section 5.4.31 for more information on this statement.

In the BASIC Module you can define strings with the LET statement, the
INPUT statement and with the ASC () operator.

Example:

u10 STRING 100,20

u20 $(1)=“THIS IS A STRING,”

u30 INPUT “WHAT’S YOUR NAME? – ”,$(2)

u40 PRINT $(1),$(2)

u50 END

uRUN

WHAT’S YOUR NAME? – FRED

THIS IS A STRING, FRED

You can also assign strings to each other with a LET statement.

Example:

LET $(2)=$(1)

Assigns the string value in $(1) to the STRING $(2).

5.9.10
Date Retrieve String –
CALL 52

5.10
Description of String
Operators

Advertising