› PLCGurus.NET Live & Interactive Forum › PLC Questions and Answers › Rockwell, Allen-Bradley, Stratix › Communication of Allen Bradley PLC and Visual Studio C#
Tagged: Allen Bradley, C#, INGEAR
- This topic has 9 replies, 2 voices, and was last updated 5 years, 3 months ago by
PLCGuru.
- AuthorPosts
- February 20, 2018 at 1:29 pm #1356
sefa sanbay
ParticipantKarma: 11Rank: PadawanHi
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)
February 20, 2018 at 3:47 pm #1360PLCGuru
KeymasterHi 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!
February 21, 2018 at 12:28 am #1362sefa sanbay
ParticipantKarma: 11Rank: PadawanThanks 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??
February 21, 2018 at 8:38 am #1363PLCGuru
KeymasterHi 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.February 21, 2018 at 9:06 am #1365sefa sanbay
ParticipantKarma: 11Rank: PadawanSir, 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 ?
February 21, 2018 at 9:26 am #1366PLCGuru
KeymasterHi 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.
February 21, 2018 at 9:31 am #1367PLCGuru
KeymasterHi 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.February 21, 2018 at 11:13 am #1369sefa sanbay
ParticipantKarma: 11Rank: PadawanSir, 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
February 22, 2018 at 9:43 am #1371sefa sanbay
ParticipantKarma: 11Rank: PadawanSir, 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 ??
February 22, 2018 at 11:34 am #1372PLCGuru
KeymasterLooks like you’ve answered your own question…for more indepth information and insight regarding this topic be sure to check out my article and YouTube videos here: https://plcgurus.net/c-hmi/
Good Luck!
- AuthorPosts
- You must be logged in to reply to this topic.