High-performance EtherNet/IP CIP communication library for Omron NX/NJ PLCs
The OmronEipReader.dll is a .NET Standard 2.0 library designed for dynamic interaction with Omron Sysmac controllers. It uses CIP Explicit Messaging to read and write variables directly by their Tag Names, eliminating the need for hardcoded memory addresses.
Key Capabilities:
Add the OmronEipReader.dll as a reference to your C# project. The library targets netstandard2.0, compatible with .NET Framework 4.6.1+ and .NET Core / .NET 5+.
using OmronEipReader;
// Create an instance
var reader = new OmronTagReader("192.168.250.1");
Establishes TCP connection and registers an EtherNet/IP session.
await reader.ConnectAsync();
if (reader.IsConnected) {
Console.WriteLine("Connected!");
}
Gracefully closes the session and TCP socket.
reader.Disconnect();
Reads a single tag and returns a TagValue object.
TagValue result = reader.ReadTag("MyVariable");
if (result.Success) {
Console.WriteLine($"Value: {result.Value}");
Console.WriteLine($"Type: {result.DataTypeName}");
}
Reads multiple tags sequentially.
var names = new[] { "StartBtn", "MotorSpeed" };
List<TagValue> results = reader.ReadTags(names);
Writes a boolean value. Handles Omron's 2-byte alignment requirement automatically.
reader.WriteBool("CMD_Start", true);
Type-specific helpers for common numeric types.
reader.WriteInt("SetPoint", 1500);
reader.WriteReal("TargetTemp", 25.5f);
Generic write method for any supported CIP type.
reader.WriteTag("MyTag", CipDataType.DINT, 12345);
The library includes an event-driven polling engine that runs on a background thread.
// 1. Subscribe to events
reader.OnTagsUpdated += (s, e) => {
foreach (var val in e.Values) {
Console.WriteLine($"{val.TagName}: {val.Value}");
}
};
// 2. Start polling
var tagsToWatch = new[] { "Sensor1", "Sensor2" };
reader.StartPolling(tagsToWatch, 500); // 500ms interval
// 3. Stop when done
reader.StopPolling();
You can load tags directly from Sysmac Studio export files (CX-Designer .txt or Network Configurator .csv).
List<TagDefinition> tags = OmronTagReader.ParseVariableFile("Export.txt");
foreach (var t in tags) {
Console.WriteLine($"Found: {t.Name} ({t.DataTypeName})");
}