Author Topic: STAND-ALONE CONTROLLOGIX/COMPACTLOGIX COMMUNICATION DRIVER  (Read 3935 times)

Homie

  • Newbie
  • *
  • Posts: 22
    • View Profile
STAND-ALONE CONTROLLOGIX/COMPACTLOGIX COMMUNICATION DRIVER
« on: October 09, 2016, 12:08:21 PM »
Hello
I saw on the product page, that this driver is available for purchase.
But there is no information about it's capabillity, or any documentation.
Just one little axample.

I assume now, that this driver has similar functionality and syntax as the one bundled with newer versions of advancedHMI.
Is that true?
When buying the driver at this early stage, am I than entitled for updates?

What about PLC5 communications (through 1756 backplane i.e.)? Is there a second driver needed?

Thanks for all the support in this forum!
Thomas

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: STAND-ALONE CONTROLLOGIX/COMPACTLOGIX COMMUNICATION DRIVER
« Reply #1 on: October 09, 2016, 12:22:32 PM »
This driver is essentially the same driver in the AdvancedHMI software with minor modifications to allow it to be used outside of the AdvancedHMI package. Included with the purchase of this driver license is a manual that has several code samples on how to use the various features. It is also delivered as part of a Visual Studio solution with code samples in both VB and C#.

The purchaser is entitled to all minor updates and the next major version update which is expected to be available within the next year.

This driver only supports ControlLogix/CompactLogix. The SLC/Micro/PLC5 will be part of another driver.

Please Note this is currently considered a pre-release because the documentation is not complete and sample projects for WPF and ASP.NET are not currently included. Because of this it is listed at a discounted price which will increase once the documentation and samples are completed.

Homie

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: STAND-ALONE CONTROLLOGIX/COMPACTLOGIX COMMUNICATION DRIVER
« Reply #2 on: October 10, 2016, 12:10:36 PM »
Hi
I purchassed the driver today, and wanted to attach it to my project as shown in the manual.

But I get a fault message that there are no components in CLXDriver.dll (That's the only DLL I could find in the downloaded zip) that can be positioned in the toolbox.

I am using a german version of VS2013 Express. So the fault message above is a translation from german to english.
Is the Express version the problem, or do I miss something else?

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: STAND-ALONE CONTROLLOGIX/COMPACTLOGIX COMMUNICATION DRIVER
« Reply #3 on: October 10, 2016, 12:23:26 PM »
It is nothing you are doing wrong, but one of the pre-release document issues. The first few pages of the manual were for a previous version of the driver. The architecture of the driver has been changed to allow it to work with more than Winform applications.

To get the driver in your Toolbox for a Winform application, along with adding a reference to the DLL, you will also need to add the EhernetIPforCLXCom.vb file to your project. After that, build the project and the driver will automatically show up in the Toolbox.

This file acts as a layer to make integration with a Winform application easier. For console and web applications this file is not needed.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: STAND-ALONE CONTROLLOGIX/COMPACTLOGIX COMMUNICATION DRIVER
« Reply #4 on: October 10, 2016, 07:33:12 PM »
Here are more specific steps of how to create your own WinForms project from scratch using the stand-alone driver:

1) Open Visual Studio or Visual Basic Express
2) File->New->Project
3) From the list select Templates->Visual Basic->Windows->Classic Desktop->Windows Forms Applications
4) Give a name to the application and click OK
5) In Solution Explorer, Right click the project and select Add->Existing Item
6) Change the File Type selection to All Files
7) Browse to and select the ClxDriver.dll
8 ) In Solution Explorer, Right click the project and select Add->Reference
9) Browse to the ClxDriver.dll that is in the same directory as the new project
10) In Solution Explorer, Right click the project and select Add->Existing Item
11) Browse to and select EthernetIPforCLXCom.vb
12) Build the solution
13) In Solution Explorer, Double click Form1.vb

You should now see the EthernetIPforCLXCom in the Toolbox.

Homie

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: STAND-ALONE CONTROLLOGIX/COMPACTLOGIX COMMUNICATION DRIVER
« Reply #5 on: October 11, 2016, 10:41:14 AM »
Sorry for not replying sooner.
I already got the driver included, but I wanted to test if it is really talking.
And it is. :-)

I found another bug in the document. The document mentions a poll rate in the subscription syntax.

SubscriptionID = EthernetIPforCLXCom1.Subscribe(PLCAddress,NumberOfConsectutiveElements,
PollRateInMilliseconds,
AddressOf CallBackSubroutineNameForDataReceived)


But in fact, there is no pollrate to be set.
My code lokks like this:
Subscription_ID(0) = EthernetIPforCLXCom1.Subscribe("C_Out.Alive_Bit", 1, AddressOf CLX_Alive_Bit_Comm)


I saw that there are some functions like Beginwrite and BeginReadMultiple in the driver.
Are they working, and only not yet documented (so I can try to use them), or is that not recommended?

A function like write multiple would be nice.
Putting the tags and values to write into an output buffer, and then write them at once, using a kind of flush function.
Or is the driver combinig writes anyway to save bandwidth?
 
Thanks again,
Thomas


Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: STAND-ALONE CONTROLLOGIX/COMPACTLOGIX COMMUNICATION DRIVER
« Reply #6 on: October 11, 2016, 04:32:00 PM »
The BeginWrite and Write are similar in functionality, except the BeginWrite is asynchronous. If using BeginWrite, it will queue the write packet, then immediately return to the calling code. This is useful if you are calling from the UI thread (e.g. Button Click event) and do not want to hold up the UI thread waiting for the PLC to respond. There is a potential issue you can create by using the asynchronous methods. The queue has a limited size and you can quickly fill it up. A call to BeginWrite may take less than 1ms, but it may take the PLC 10ms to process the packet. So let's say you use BeginWrite in a loop to do 100 writes, The loop will complete in less than 10ms, which only gives enough time for the PLC to process 1 write. The BeginWrite will start throwing an exception at about write 30 because the queue will be full.

Homie

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: STAND-ALONE CONTROLLOGIX/COMPACTLOGIX COMMUNICATION DRIVER
« Reply #7 on: October 13, 2016, 08:56:05 AM »
I had some issues, writing strings to the PLC.
But I don't know if that's a bug, or a feature in the driver.
I tried to reset some CLX tags to "", and I used a stringvariable which was not set before (void).
What happened was, that the CLX tag was not updated. The driver just ignored the line, without throwing an exception or so.
After setting the string to "" in the Form.load, the CLX tags were updated when writing.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: STAND-ALONE CONTROLLOGIX/COMPACTLOGIX COMMUNICATION DRIVER
« Reply #8 on: October 13, 2016, 04:16:01 PM »
The first thing the write does is check if the data is null. If so, it immediately returns "0", otherwise a transaction number will be returned. This is the sample code I used for testing:

        Dim s As String
        Try
            Dim result As String = CLXDriver1.Write("NewString", s)
            If result = 0 Then
                MsgBox("Failed to write")
            End If
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try



This will be changed in the next update to throw an exception if the string is null.
« Last Edit: October 13, 2016, 04:22:33 PM by Archie »