VRPilot

ControlLogix String Access via EIP/CIP

5 posts in this topic

Greetings AB guys!

I am the principle programmer for a SCADA server ControlLogix driver. I implemented an Explicit Connected Messaging solution using the EIP/CIP message protocol that generates the byte stream for the TCPIP buffer. Driver is unmanaged C++ code. We are successfully reading and writing all data types except strings. The public documentation from AB on Data Access 5000, does not address accessing strings however we have customers that need to. So far my attempts are not working as I thought they would with some trial and error.

Using the Write Service (0x4D), I attempt to write HELLO to the tag called Z_PRD_NM[3].DATA

4D 09 91 08 5A 5F 50 52 44 5F 4E 4D 28 03 91 04 44 41 54 41
C2 00 
52 00 
48 45 4C 4C 4F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

The PLC responds with a error 5.

If I attempt to read the same tag (Z_PRD_NM[3]), the PLC returns a data type of C4 and an Int32 value. I would appreciate any help here. ;)

Edited by VRPilot

Share this post


Link to post
Share on other sites

When writing a string, you need to consider that it is a UDT defined like this:

Length : DINT

Data : SINT[81]

It is necessary to write both values and it can be done at the same time. In your packet address only Z_PRD_NM[3] and insert 4 bytes prior to the character data to represent a DINT for the length.

Edited by arj3090

Share this post


Link to post
Share on other sites

All of the drivers I've encountered work in a similar way to was arj3090 said.  They get the .LEN of the string, then just loop-read the .DATA[0 to LEN-1] of the string and assemble the string like that.

 

Share this post


Link to post
Share on other sites

Hello,

IIRC, to write a string the data format is parameter count, structure code, element count, length count and then characters (as bytes).

You write to the tag name.

Download the PeakHMI demo installer and install it.

Create an AB Logix port, create one string, execute a point test and capture the request/response in Wireshark.  That will give you the read exchange.

For a write, create a screen with a button, add the write command, start runtime, activate the button and view the Wireshark capture.

Contact support if you need any help.

Edited by Mark-

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