Communication of Allen Bradley PLC and Visual Studio C#

Best VPN

This topic contains 9 replies, has 2 voices, and was last updated by Fred Graham Fred (a.k.a. PLCGuru) 7 months ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1356
    Sefa Sanbay
    sefa sanbay
    Participant
    Karma Points: 10
    Rank: Padawan

    Hi

    I will have to communicate with Allen Bradley PLC using C# in a short time. I need step by step explanations.

    I know that the first step is to have  Visual Studio IDE, INGEAR software and Rockwell software. 🙂 So apart of these, how should I pass the second step?

    (Assume that for now I want to give digital output and to read analog input from Allen Bradley PLC or drivers with my C# WPF application)

    #1360

    Hi Sefa and welcome to the forums!

    Okay, you’ve decided on Ingear drivers to access a PLC directly versus OPC (I’m assuming Logix here as you’ve not stated). I’m sure as you can imagine the “second step” you’ve listed here is a little bit too broad for any forum. Perhaps I can get you going at least on the reading and writing of a tag. The following code sample will show you a basic workflow for reading/writing a tag regardless if you’re using WinForms, WPF, ASP.NET etc.

    // Simple Read Tag Logic

    // create instance of Tag class and immediately read
    Tag ControlLogixTag = new Tag(ControlLogix, tagname);

    if (ControlLogixTag.QualityCode == Logix.ResultCode.QUAL_GOOD)
    {
    string Value = ControlLogixTag.Value.ToString());
    }
    else
    // display the error
    string errorString = ControlLogixTag.ErrorString;

    //Simple Write Tag Logic

    // create instance of Tag class and immediately read
    Tag ControlLogixTag = new Tag(ControlLogix, tagname);

    /// update the .Value property
    ControlLogixTag.Value = someValueYouWantToAssign;

    ControlLogixTag.Length = 1;

    if (Logix.WriteTag(ControlLogixTag) !=ResultCode.E_SUCCESS)
    {
    // Throw a failed to write message – only enters this “if statement” if the PLC write fails
    }

    Hope that helps!

     

    #1362
    Sefa Sanbay
    sefa sanbay
    Participant
    Karma Points: 10
    Rank: Padawan

    Thanks for your reply, Sir.

    Actually I have not decided anything yet. Just after watching your video ( Advanced HMI Using C# and Visual Studio – Part 1 ), I thought that I should use INGEAR software. Thus I can say that I did not hear anything about INGEAR software until watching your video.

    I want you to assume that I just know C# programming and Allen Bradley PLC programming. But these knowladges are not enough. There should be some settings for communication of hardware or softwares.

    Oke, I know that the direction of flow will be like : Visual Studio C# => INGEAR Software => Allen Bradley PLC Program => Allen Bradley PLC hardwares.

    But at each part of these software, what settings should be done??

    There are any tutorial that explains what I want step by step??

    #1363

    Hi Sefa, I see and yes we are planning a doing a series on exactly that – essentially step-by-step nuggets to get you up and running and proficient with these tools…it is in the queue to do this!

    It sounds like you have the necessary background to make this work. What you will need to do is install the InGear software. This will add the necessary Assembly References to your development machine that is running VS. You’ll want to create a project and then add the required .dll’s to your project. I’ve uploaded an image that shows you this. Once you’ve done this step add the “Logix” namespace to your class and you will have access to the full NET.LOGIX methods and types.

    Let me know how you make out.

    Attachments:
    You must be logged in to view attached files.
    #1365
    Sefa Sanbay
    sefa sanbay
    Participant
    Karma Points: 10
    Rank: Padawan

    Sir, you explained perfect. Let me tell you what I will do;

    I will buy Ingear NET.Logix.6.0 software. And I install this software to my computer. As you showed, I will add the required dlls from references. So I will be ready to write C# codes.

    At Allen Bradley side, I will write a simple MicroLogix5000 program that will give digital output and analog input. If assumed that the tag name of digital output is TagDO and the tag name of analog input is TagAI, I will just try to access to these TagDO and TagAI tags from my C# application.

    That is it? Do I have to do some settings on MicroLogix5000 side? I mean about communication settings or allow access or something else ?

    #1366

    Hi Seta, great! Just a small detail, there is no MicroLogix5000, it’s either a full blown ControlLogix or a CompactLogix (RSLogix5000). If you are in fact using a MicroLogix (RSLogix 500 platform) it requires the ABLink.NET driver package. Please ensure you clarify your controller type before purchasing the InGear drivers.

    Whatever controller you buy, I would recommend it supports Ethernet for ease of connectivity. The other tip (if your using RSLogix5000 platform) is to ensure the syntax of your tags are correct (i.e., Controller versus Program scoped tags).

    I’m excited for you…this is fun stuff! Let me know if you get stuck.

    #1367

    Hi Sefa,

    I should clarify, if it’s a Micro800 series controller you are using it is supported by NET.Logix drivers. See attachment of supported controllers. Note, I am using version 5 so version 6 will have additional controller support.

    PLCGuru

    Attachments:
    You must be logged in to view attached files.
    #1369
    Sefa Sanbay
    sefa sanbay
    Participant
    Karma Points: 10
    Rank: Padawan

    Sir, again thanks for your reply,

    What I will do is that I will ask our PLC expert what we are using as a controller and software. After finding out these two questions, I will share with you the answers. And then according to your suggestion, I will buy NET.Logix.6 or something else.

    This seems the best way

    #1371
    Sefa Sanbay
    sefa sanbay
    Participant
    Karma Points: 10
    Rank: Padawan

    Sir, our controller is ControlLogix 1756-L71 which is in the list you sent. Our PLC program is RS Logix 5000.

    So if you confirm, I will buy NET.Logix.6.0 software ??

    #1372

    Looks like you’ve answered your own question…good luck!

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.