Specifying Arrays - Omron CJ2 CPU UNIT SOFTWARE User Manual

Cj2 cpu unit software
Hide thumbs Also See for CJ2 CPU UNIT SOFTWARE:
Table of Contents

Advertisement

Applications of Data Types
Data types set for symbols can be used for the following functions.
Application Using Automatic Address Allocation
Addresses can be allocated according to the data type set for the symbol when automatic address
allocation is used with the CX-Programmer.
Example: Setting the ULINT (4-word Unsigned Binary) Data Type
If a data type that uses four words is used, the address of the next
allocated symbol will be separated by four words.

Specifying Arrays

Arrays can be specified as symbol attributes (one-dimensional arrays only). Arrays can be specified for
all data types except for STRING and NUMBER.
Use an array specification if multiple symbols with the same data attribute are managed as one group.
Use the following procedure if array specification is used.
1
Enter the symbol name in the New Symbol Dialog Box or Edit Symbol Dialog Box, and then click
the Advanced Settings Button. The Advanced Settings Dialog Box will be displayed.
2
Select the Array Symbol Option in the Array Settings Field, and then enter the maximum number
of elements.
When writing an array variable, specify a suffix between brackets after the variable name.
Example: If the symbol name is PV and the maximum number of elements is 3, specify array variables
as PV[0], PV[1], and PV[2] in instruction operands.
The suffix of the array is specified with an element number starting from 0. The element number can be
entered directly, or it can also be specified indirectly by inputting a symbol or memory address.
If a symbol or memory address (only symbols are allowed for ST programming) is
specified for the suffix of an array variable in ladder or ST programming to indirectly
specify the element number, be sure that the element number does not exceed the
maximum memory area range.
Specifying a element number that exceeds the maximum range of the memory
area specified for the symbol will result accessing data in a different memory area,
and may result in unexpected operation.
Array variables with suffixes that are word addresses or symbols cannot be used as operands in the
immediate refresh version of an instruction.
CJ2 CPU Unit Software User's Manual
5 Understanding Programming
! Caution
5
5-57

Advertisement

Table of Contents
loading

Table of Contents