EasyManuals Logo

Omron NJ Series User Manual

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
Page #232 background imageLoading...
Page #232 background image
6-45
6 Programming
NJ-series CPU Unit Software User’s Manual (W501)
6-3 Variables
6
6-3-6 Derivative Data Types
Variable Table
Specifying the Union
The union represents all members that make up the union. Unions are expressed by the name of the
union variable. In the example above, you would write Output.
Creating Unions
1
Create a union data type in the Union Table.
Specify the data type names and different data types of the members of the union.
2
Specify the union data type from above as the data type and register the variable in the variable
table.
Example:
Here, OUT16_ACCESS is defined as the data type of a union. The members of this union are a
BOOL array with 16 elements and a WORD variable. The variable Output is registered with a data
type of OUT16_ACCESS. You can now read/write variable Output as a BOOL value for any of the 16
bits and as a WORD value.
Name Member Data type
My Union data WORD
bit ARRAY [0..15] OF BOOL
Variable name Data type
Output My Union
Output.bit[0]: This notation specifies the 0th element, or value at bit 00, of union Output when it is treated
as a 16-bit BOOL array variable.
Output.data: This notation specifies the value when union Output is treated as a single WORD variable.
Data Type Definitions
BoolData
[15]
BoolData
[8]
BoolData
[7]
BoolData
[0]
ByteData
[1]
ByteData
[0]
WordData
BoolData ARRAY[0..15] of BOOL
ByteData ARRAY[0..1] of BYTE
WordData WORD
OUT16ACCESS
Member Data type
Name
Output.WordData := WORD#16#1234;
BoolData
0
15
ByteData 16#12 16#34
WordData 16#1234
0
14
0
13
1
12
0
11
0
10
1
9
0
8
0
7
0
6
1
5
1
4
0
3
1
2
0
1
0
0
Output.BoolData[11] :=TRUE;
BoolData *
15
ByteData Bit 04 of ByteData[1] is TRUE No change
WordData Bit 11 of WordData is TRUE
*
14
*
13
*
12
1
11
*
10
*
9
*
8
*
7
*
6
*
5
*
4
*
3
*
2
*
1
*
0
OUT16ACCESSOutput
Data type
Variable name

Table of Contents

Other manuals for Omron NJ Series

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Omron NJ Series and is the answer not in the manual?

Omron NJ Series Specifications

General IconGeneral
Program CapacityUp to 128 MB
SD Card SlotYes
Power Supply Voltage24 VDC
Motion ControlYes
USB Ports1
Operating Temperature0°C to 55°C
Communication InterfacesEthernet/IP, EtherCAT, USB
Safety FunctionOptional
Storage Temperature-20°C to 75°C
Communication PortsUSB
DimensionsVaries by model
WeightVaries by model

Related product manuals