31 rotater% function, 32 bcd_out% function, 33 bcd_in% function – Rockwell Automation 57C610 Enhanced Basic Language, AutoMax User Manual

Page 101

Advertising
background image

7Ć13

7.31

ROTATER% Function

Format:

ROTATER%(variable, rotate_count)

where:

variable is a single or double integer variable or expression.
rotate_count is the number of bit positions to rotate the integer

expression (0 to 15 single integer; 0 to 31 for double integer).

This function returns an integer value, equal to the integer

expression that was input, rotated the specific number of binary

places to the right (Bit 0 wraps around to bit 15, or bit 31 if double

integer).
For example:

SWAP_4_1% = ROTATER%(INPUT_CARD%,4)

In this example, a 16Ćbit value is read from an input module and bits

(4 to 15) are rotated into bit positions (0 to 11). Bits (0 to 3) are

rotated into bit positions (12 to 15).

7.32

BCD_OUT% Function

Format:

BCD_OUT%(variable)

where:

variable is a single or double integer variable or expression

(variable value < 9999 decimal).

This function returns an integer value, equal to the integer

expression that was input, with each decimal digit converted to a

hexadecimal 4Ćbit binary equivalent (opposite of the BCD IN%

function):

SWITCH_VALS% = 2156
OUTCARD_CARD% = BCD_OUT%(SWITCH_VALS%)

In the above example, the decimal value 2156 is converted to a

16Ćbit hexadecimal value equal to 2156H (hex).
If the value input to BCD_OUT% is greater than 9999 decimal, the

output will be hex 9999H and an error will be logged. The same is

true if the input number is negative; the output will be 0000H (hex)

and an error will be logged.

7.33

BCD_IN% Function

Format:

BCD_IN%(variable)

where:

variable is a single or double integer variable or expression

(variable value < 9999 hex).

This function returns an integer value, equal to the integer

expression that was input, with each digit converted from a

Advertising
This manual is related to the following products: