Rockwell Automation AutoMax Enhanced Ladder Language Reference Manual User Manual

Page 282

Advertising
background image

AĆ10

A.2

Accessing Data Within Variables Via BitĆIndexing and

ElementĆIndexing

For the ladder instruction parameters, you can specify bits within integer and double

integer variables and elements and bits within an array variable. You can refer to bits or

elements by using constants or variables. For example, you could access bit 17 in the

double integer variable pump by using either pump.17, or any bit within pump using

pump.fill. Notice a period (.) was used to separate pump from the bit. The period (.) is

the bit delimiter.
To specify an element name or number, enclose it in square brackets ([ ]). For example,

if pump was an array and you want element number 17 within the array, you can access

it by: pump[17]. To access any element within the array pump, you can use pump[fill].

The square brackets ([ ]) are the element delimiter.
This methodology is called indexing. Using bitĆindexed and elementĆindexed variables

can help reduce the number of unique names required for your application and help

you manage data collection and manipulation. BitĆindexed variables can also help

make referring to I/O points easier. Just assign a name for the register corresponding to

the I/O module and reference each I/O point by appending the appropriate bit number.

For example, if one I/O module is controlling all the switches for a conveyor belt, you

can assign the name conveyor_switch" to the I/O module and reference each I/O point

by appending a bit's name or constant, such as conveyor_switch.2."
However, use bitĆindexing with caution because the program's execution time increases

with the complexity of the variable.
Only variables assigned to I/O modules can have names assigned to the whole integer

and to each bit.
You can use bitĆindexed variables on relay instructions. For specific information about

the supported variable types for an instruction, see the section pertaining to that

instruction.

Advertising