Why Use Structures Instead of Byte Arrays for EtherNet/IP I/O in Sysmac Studio
Why Use Structures Instead of Byte Arrays for EtherNet/IP in Sysmac Studio
EtherNet/IP cyclic I/O data is exchanged using assemblies, which at the network level are simply fixed-length blocks of bytes. While Sysmac Studio allows these assemblies to be handled as byte arrays, this approach quickly becomes difficult to read and maintain once the data layout is known.
A byte array provides no information about what the data represents. Application code must rely on hard-coded byte indexes and manual type conversions, making it harder to understand, easier to break, and more prone to subtle errors. Any change to the assembly layout typically requires remapping the offsets for potentially many variables.
Using a structure (STRUCT) allows the EtherNet/IP assembly layout to be defined once using meaningful names and correct data types. Sysmac Studio then handles byte offsets and sizing automatically, allowing the application to work with named variables instead of raw bytes.
This improves:
- Readability and troubleshooting
- Consistency of data handling
- Robustness when device assemblies change
Although EtherNet/IP transports data as bytes, Sysmac applications do not need to operate at the byte level. For most EtherNet/IP integrations, mapping assemblies to structures is the clearer, safer, and more maintainable engineering approach.
We will show a comparison of the setup between structs and bytes arrays. They struct method does require more initial setup but we will benefit later if we make changes to the NX IO.
NX IO Configuration
The following examples use the below NX IO Configuration to show how you might use structures or byte arrays to read data from a NX-EIC202.

![]() |
![]() |

Byte Array Method
Below is an example of how you might access data when using byte arrays:
Variable Definition:

LD Code:
Referencing the first two inputs, an analog output and digital output in our program. We must use functions according to the type of variable we wish to address. In this case TestABit to read a BOOL status and INT_TO_BYTE to set the integer value of an analogue output. Accessing data is complex as we need to track where the data is stored in the byte array and perform the data type conversions manually.

Struct Method
Below is an example showing how data can be accessed using structures. In this example, a simple structure with named members is used to identify the individual elements within the data. More detailed or complex structures can be defined as required to provide additional clarity and organisation.
Structure Definition:

Variable Definition:

LD Code:
Referencing the first two inputs, an analog output and digital output in our program - note comments added to describe the input/output function.


