NI Labs Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

EtherNet/IP and Raw Data Type

I am trying to figure out how to read and write to raw data types aka AB UDT (AB custom data type) inside a PLC.  I have no problem reading and decoding the byte array from the tool kit vi “EthernetIP Tag Read Raw”.

I have problems when I try to write to the Raw data type.  So does anyone have experience writing to an AB UDT and how to structure the byte array?

One thing I did try and was surprised when produced an error was create a vi with just the Raw Read and the Raw Write vi’s.  I wired the byte array output of the read vi to the input byte array of the write vi and got this error. 

Code -251723760

EthernetIP Tag Write Raw.vi;

Details: CIP Error - Extended status may be available

CIP Status: 0xff (General error)

CIP Extended Status: 0x2105 (Address and count out of range)

0 Kudos
Message 1 of 3
(8,508 Views)

Hello. I was hoping you could help me. I am trying to read a set of user defined tags using “EthernetIP Tag Read Raw” and I am getting a array of unsigned 8bit integers. Do you know how to decode this? Thank you.

0 Kudos
Message 2 of 3
(5,420 Views)

I came a crossed the same problem while trying to write to all data of a UDT.  I was able to solve it with the following information:

 

1) Refer to link: https://forums.ni.com/t5/NI-Labs/Welcome-to-EtherNet-IP-Driver-for-Communication-to-Allen-Bradley/m-...

2) Refer to: Rockwell Automation Publication 1756-PM020E-EN-P

3) The Data has to be written as raw

4) The Tag name is the name of the UDT 

5) The first byte of data has to be  0xA0

6) The second byte of data has to be 0x02

7) The third byte of data has to be 0x01    (I haven't figured this one out, it seems like it always has to be 1)

😎 The fourth byte of data has to be 0x00

9) The remaining data is the actually data that you need to write to the UDT.  HOWEVER, because the PLC has rules on how it packs data the actually length is probably going to longer than you expect.  It's basically on 4 byte boundaries but be careful when mixing data it' will pad data between tags of different types to maintain the 4 byte boundaries.  The length of the data has to be correct or your get an error.

 

 

0 Kudos
Message 3 of 3
(4,613 Views)