Type Conversions; Using Variables - Agilent Technologies 3458A User Manual

Hide thumbs Also See for 3458A:
Table of Contents

Advertisement

Note

Type Conversions

Using Variables

in an assignment statement with the LET command. For example, the
following statements automatically declare the variable names specified.
OUTPUT 722; "LET A=SIN(.223)"
OUTPUT 722; "LET B=3.14159"
Some 3458A commands expect a specific variable type when defining
variables for parameters. For example, the TIME command expects a real
number. Similarly, commands which return numeric results will return
specific number types. The LINE? command returns an integer number.
Measurements returned are real numbers. All variables are REAL unless
otherwise specified.
PROGRAMMING HINT
Once you declare an array type, you cannot re-declare it as a different type
without scratching memory first (see the SCRATCH command in chapter
6). If you refer to a real number within a command that expects an integer,
the 3458A converts the real number to an integer. Likewise, if you refer to
an integer number within a command that expects a real number, the 3458A
converts the integer number to a real number. Therefore, you can minimize
system overhead time by allocating variables according to their use. For
example,
OUTPUT 722; "REAL TIME_INT; LET TIME_INT=2.25; TIMER
TIME_INT"
The 3458A automatically converts between real and integer values whenever
necessary. When real numbers are converted to integer representations,
information may be lost. Two potential problem areas exist in this
conversion, rounding errors and range errors.
When a real number is converted to an integer, the real value is rounded to
the closest integer value. All information to the right of the decimal point
is lost.
Range errors exist when converting real values to integer values. While
real values range from approximately –10
is only from –32768 to +32767 (approximately –l0
not all real numbers can be rounded to an equivalent integer value. This
problem can generate "Integer Overflow" error.
Simple variable and array names may contain up to 10 characters. The first
character must be a letter (A–Z) but the remaining nine characters can be
letters, numbers (0–9), the underscore character ("_"), or the question mark
("?"). Upper case is the same as lower case. Variable names must not be the
same as 3458A commands, parameters, or stored state names.
You can assign any numeric variable with the LET command (the keyword
"LET" is required). For example, the following statements are equivalent.
OUTPUT 722; "LET TIME_INT = 120E-3"
Chapter 7 BASIC Language for the 3458A
308
308
to +10
,the integer range
4
4
to +10
). Therefore,
267

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents