Urko

Conect to NPX1P2 using Ethernet/IP in C#

1 post in this topic

Hi all,

First i apologise for my english, but it's not my main language.

I am very new at this world so sorry if my question is too newbie but i have been for several hours trying to get some data from an Omrom NPX1P2 DT-100 using Ethernet/IP and now i am a bit desperate.

I am trying to connect this PLC using a C# Library provided by steffan rossman and it seems to be very easy,  i can manage to connect it but every try i do to request data it fails.

As i can see there are several ways to get the data, for example:

Quote

EEIPClient eeipClient = new EEIPClient();

            //Register Session (Wago-Device 750-352 IP-Address: 192.168.178.66)
            //we use the Standard Port for Ethernet/IP TCP-connections 0xAF12
            eeipClient.RegisterSession("192.168.1.3");

            //Get the State of Analog Inputs According to the Manual
            //Instance 0x6D of the Assembly Object contains the Analog Input data
            //The Documentation can be found at: http://www.wago.de/download.esm?file=%5Cdownload%5C00368362_0.pdf&name=m07500352_xxxxxxxx_0en.pdf
            //Page 202 shows the documentation for instance 6D hex
            byte[] analogInputs = eeipClient.AssemblyObject.getInstance(0x6D);

            Console.WriteLine("Temperature of Analog Input 1: " + (EEIPClient.ToUshort(new byte[] { analogInputs[0], analogInputs[1] }) / 10.0) + "°C");
            Console.WriteLine("Temperature of Analog Input 2: " + (EEIPClient.ToUshort(new byte[] { analogInputs[2], analogInputs[3] }) / 10.0) + "°C");
            //When done, we unregister the session
            eeipClient.UnRegisterSession();
            Console.ReadKey();

As you can see in this code the only information needed to connect os the instance, for that wago plc it's 6D, but i can't find any documentation to know what is the instance for the NPX1P2 DT-1400

 

Another way to get that information, as far i can see, is the following:

Quote

EEIPClient eeipClient = new EEIPClient();
            eeipClient.IPAddress = "192.168.1.3";
            eeipClient.RegisterSession();
            byte[] response = eeipClient.GetAttributeSingle(0x66, 1, 0x325);
            Console.WriteLine("Current Value Sensor 1: " + (response[1] * 255 + response[0]).ToString());
            response = eeipClient.GetAttributeSingle(0x66, 2, 0x325);
            Console.WriteLine("Current Value Sensor 2: " + (response[1] * 255 + response[0]).ToString());

In this example the function GetAttributeSinglec(ClassID, instanceID, attributeID) i need the ClassID, wich i don't know what is, the instanceID, i think in my case is 100, and the attributeID wich i don't know what is or where to define.

If someone could help me about how to request data it will be very appreciated.

Thx in advance

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now