EasyManua.ls Logo

Omron NJ Series - Page 231

Omron NJ Series
668 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
6 Programming
6-44
NJ-series CPU Unit Software User’s Manual (W501)
Passing Values to System-defined Structure Input Variables for Certain
Instructions
Some instructions take a predefined structure variable as an input variable.
Example: The Port input variable for the Serial Communications Instructions (which specifies the tar-
get port) is a structure with a data type name of _sPORT. When you use one of these
instructions, follow the procedure provided below to create a user-defined structure vari-
able and specify that variable for the input parameter to the instruction.
1
The system-defined data type for the instruction is registered in the Sysmac Studio in advance.
Select that system-defined data type in the Sysmac Studio and add a user-defined structure
variable to the variable table.
2
Use the user program or initial values to set the member values of that structure.
3
Specify the structure variable for the input parameter to the instruction.
A union is a derivative data type that enables access to the same data with different data types. You can
specify different data types to access the data, such as a BOOL array with 16 elements, 16 BOOL vari-
ables, or a WORD variable.
Expressing Unions and Union Members
Specifying Members
When you define a union, you must name each data type that can be accessed. These names are
called members. You can express individual members of a union by putting a period after the vari-
able name that represents the entire union followed by the member name that you want to access.
Example:
Define the data type as a union as shown for My Union in the following example.
Data Type Definition
Unions
■Specifying Just One Member of a Structure
Transferring only the red member of the Color1 RGB structure to x.
Transferring all members of the Color1 RGB structure to x.
■Specifying the Entire Structure
MOVE
xColor1
EN
ENO
In
Out
MOVE
xColor1.red
EN
ENO
In
Out
Data Type Table
Variable Table
red
green
RGB
blue
Data type
MemberName
UINT
UINT
UINT
RGBColor1
Data typeVariable name

Table of Contents

Other manuals for Omron NJ Series

Related product manuals