Data types, Chapter 2, Data types -1 – Rockwell Automation 1746-BAS BASIC LANGUAGE User Manual

Page 17: Chapter

Advertising
background image

1

Publication 1746-RM001A-US-P

Chapter

2

Data Types

This chapter provides you a method of defining or displaying data within the
BASIC programming language through the use of:

data types

variables

Data Types

Data types are broken down into three sections: argument stack, string and
numeric elementary data types, and backplane conversion data.

Argument Stack

The argument stack (A-stack) stores all constants that the BASIC or BASIC-T
module is currently using. Operations such as add, subtract, multiply, and divide
always operate on the first two numbers of the argument stack and return the result
to the stack. The argument stack is 203 bytes long. Each floating point number
placed in the stack requires 6 bytes of storage. The argument stack can hold up to
33 floating point numbers before overflowing.

In addition, the PUSH command saves data to the argument stack and the POP
command restores data from the stack. PUSHes and POPs are typically associated
with CALLs. PUSHes and POPs are mechanisms used to transfer information to
and from CALL routines.

PUSH makes a copy of the variable being PUSHed, then puts that copy on the top
of the argument stack. POP takes the value on the top of the argument stack and
copies it to the variable being POPped.

String Data Types

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 use
characters instead of numbers. Strings are shown as:

$([expr])

The module uses single-dimension string variables,

$([expr])

. The dimension of

a string variable (the

[expr]

value) ranges from 0 to 254. This means that you can

define and manipulate 255 different strings in the module. Initially, no memory is
allocated for strings. Memory is allocated using the STRING statement. Strings are
declared and manipulated through the $ operator.

Advertising