13.07.2015 Views

CJ2 CPU Unit Software User's Manual - CIP ETI

CJ2 CPU Unit Software User's Manual - CIP ETI

CJ2 CPU Unit Software User's Manual - CIP ETI

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

5 Understanding ProgrammingUser-defined Data Types (Data Structures)When using CX-Programmer version 9.0 or higher with a <strong>CJ2</strong> <strong>CPU</strong> <strong>Unit</strong>, you can create data structuresas user-defined data types. Data StructuresA data structure is a user-defined data type that groups more than one data type. Names can beassigned to the data types. The name of the variable that uses a user-defined data type is specifiedalong with the name of one of the variables within the data structure. The overall data structure iscalled a structure variable and the variables within the data structure are called members.Additional Information• Arrays can also be used to handle multiple pieces of data. An array data type, however, is differentfrom a data structure in that it contains data with the same data type that is accessed byspecifying an offset from the beginning of the array. With a data structure, data with the sameor with different data types is accessed using member names. Also, with the CX-Programmer,structure data types can be assigned names.• Structure variables can be placed in arrays.• Also, array variables can be used as members of data structures. Ladder Program Notation and Input for Structure VariablesIn a Ladder Program, the structure variable name and member name are separated by a period.Example:S1 . AMeans "member A of S1."Member namePeriodStructure variable name Applications of Data StructuresWhen you specify data that is grouped, you specify a member of a specific group. In other words,you can specify data in a hierarchy in the form "main - sub."Using Data Structures without ArraysExample for Structure Variables S1, S2, and S3 Each with Members A, B, and CA of S1 A of S2 A of S3Structure variable S1 Structure variable S2 Structure variable S3Member Member MemberAAABCBCBCCCC5-56 <strong>CJ2</strong> <strong>CPU</strong> <strong>Unit</strong> <strong>Software</strong> User’s <strong>Manual</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!