13 binary$ function, 14 hex$ function, 15 left$ function – Rockwell Automation 57C610 Enhanced Basic Language, AutoMax User Manual

Page 93

Advertising
background image

7Ć5

In the last example, the format of the real number returned as a

string is the same number but in a different representation. All real

numbers will be returned by the STR$ function in this format.
The string will always be 14 characters long with a sign

(+ or -), a decimal point (.), 8 digits (12345678), an exponent sign

(E), and 2 digits of exponent (XX). The sign character is always

present after this conversion even if the number is positive.

7.13

BINARY$ Function

Format:

BINARY$(expression)

where:

expression must be an integer or integer expression.

The function returns the binary form of the input as a string of 1s and

0s. For example:

BIT$=BINARY$(NUMBER_1%)ąą

7.14

HEX$ Function

Format:

HEX$(expression)

where:

expression must be an integer or integer expression.

The function returns the hexadecimal value of the input as a string.

For example:

HEX_VAL$=HEX$(X%)

7.15

LEFT$ Function

Format:

LEFT$(string,str_length)

where:

string can be a string variable or expression.
str_length is the number of characters to take from the left side

of the string (string expression) in parameter 1.

The function returns a substring that is equal to `str_length'

(parameter 2) of the leftmost characters of the string or string

expression (parameter 1):

SUB_STRING$ = LEFT$(`ABCDEFG',4) (SUB_STRING$

has the value ABCD)ąąą

STR1$ = `12345'
SUB_STRING$ = LEFT$(STR1$ + `ABC',6) (SUB_STRING$

has the value 12345A)

Advertising
This manual is related to the following products: