Issue in connecting CompactLogix 5380 controller

116 views
Skip to first unread message

Brajesh Srivastava

unread,
Nov 26, 2024, 8:46:16 AM11/26/24
to libplctag
Hi All,

Can somebody help in connecting plc using libplctag.ddl, in visual studio 2022.
returning error -32

Regards
Brajesh

Kyle

unread,
Dec 2, 2024, 10:44:43 AM12/2/24
to libplctag
HI Brajesh,

Thanks for using libplctag.   Usually that error means that there was a timeout.   That usually means that the PLC is not reachable or that you are using the wrong IP address.   Check those first and see if that helps.

Best,
Kyle

Brajesh Srivastava

unread,
Dec 2, 2024, 10:59:09 PM12/2/24
to Kyle, libplctag
Hi Kyle,

But the same IP address was connecting with python code.

How would you rate your experience with us?


Best Regards,
 


Brajesh Kumar Srivastava

Technical Manager Software

M:  +91 8800334819

W:  www.barcodeindia.com

     



--
You received this message because you are subscribed to the Google Groups "libplctag" group.
To unsubscribe from this group and stop receiving emails from it, send an email to libplctag+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/libplctag/417aa8ba-4035-426e-a2c7-1d0e5cee1810n%40googlegroups.com.

Kyle

unread,
Dec 2, 2024, 10:59:53 PM12/2/24
to libplctag
Can you provide the entire set of settings that you use to initialize the tag handle?   The IP, the path, the PLC type etc.

Best,
Kyle

Brajesh Srivastava

unread,
Dec 2, 2024, 11:36:13 PM12/2/24
to Kyle, libplctag
Yes sure.. Please check the code.

private void Form1_Load(object sender, EventArgs e)
{
    try
    {
        var tag = new Tag("192.168.56.1","1,0", CpuType.SLC, "read1", DataType.Int16, 1);
        using (var client1 = new Libplctag())
        {
            client1.AddTag(tag);
            while (client1.GetStatus(tag) == Libplctag.PLCTAG_STATUS_PENDING)
            {
                Thread.Sleep(100);
            }
            //if (client1.GetStatus(tag) != Libplctag.PLCTAG_STATUS_OK)
            //{
            //    //Console.WriteLine($"Error setting up tag internal state. Error{ client.DecodeError(client.GetStatus(tag))}\n");
            //    MessageBox.Show($"Error setting up tag internal state. Error{client1.DecodeError(client1.GetStatus(tag))}\n");
            //    return;
            //}

            var result = client1.ReadTag(tag, DataTimeout);

            // Check the read operation result
            if (result != Libplctag.PLCTAG_STATUS_OK)
            {
                Console.WriteLine($"ERROR: Unable to read the data! Got error code {result}: {client1.DecodeError(result)}\n");
                return;
            }
            // Convert the data
            var TestDintArray0 = client1.GetInt32Value(tag, 0 * tag.ElementSize);
        }
    }
    finally
    {
        MessageBox.Show("Hello");
    }
}

How would you rate your experience with us?


Best Regards,
 


Brajesh Kumar Srivastava

Technical Manager Software

M:  +91 8800334819

W:  www.barcodeindia.com

     


Kyle

unread,
Dec 2, 2024, 11:39:41 PM12/2/24
to libplctag
There are a couple problems with that code.

- you are using SLC as the PLC type.   A CompactLogix is not an SLC.   Use CompactLogix or ControlLogix if that is really what you have.
- I do not have a CompactLogix on which to test, but I think the path needs to be "0,0" instead of "1,0".  I am not sure though.

Double check the PLC type.  

Best,
Kyle

Pete Huish

unread,
Dec 3, 2024, 12:06:40 AM12/3/24
to libplctag
In our setup accessing several ControlLogix PLCs path "1,0" works

Brajesh Srivastava

unread,
Dec 3, 2024, 12:19:21 AM12/3/24
to Kyle, libplctag
I have checked with CompacLogix and Control Logix as well but not working 

Kyle

unread,
Dec 3, 2024, 12:23:02 AM12/3/24
to libplctag
ControlLogix need the path as the CPU module could be in any slot.   CompactLogix does not have a movable CPU so the path is not really needed but in testing I did a long time ago (more than ten years) I found that 0,0 worked.

Brajesh, please turn on debugging to level 4 and capture the log output and post it here.   The error just means a timeout.   There are a number of possible causes for that.   The usual ones do not seem to be a problem so we'll have to dig more.  We need to see what is happening within the library to determine where the problem is. 

Best,
Kyle

Brajesh Srivastava

unread,
Dec 3, 2024, 1:04:23 AM12/3/24
to Kyle, libplctag
Ok sure Kyle, let me checked it out share the details with you
Thank

How would you rate your experience with us?


Best Regards,
 


Brajesh Kumar Srivastava

Technical Manager Software

M:  +91 8800334819

W:  www.barcodeindia.com

     


Reply all
Reply to author
Forward
0 new messages