-
Feb 4th, 2012, 04:39 AM
#1
Thread Starter
New Member
serial Communication between PLC and C#
Hi All
I am working on a project where I have to design a front end(on C#) and have to display the data coming from PLC.
Can you all please let me know that
1. What name space I have to used.
2. What function I have to used for Serial communication.
3. What .dll file I have to add in my project.
4. Any more idea if you have then please let me know.
Waiting for your reply its urgent.
-
Feb 4th, 2012, 04:58 AM
#2
Re: serial Communication between PLC and C#
Originally Posted by bksingh
I am working on a project where I have to design a front end(on C#)
Then why have you posted in the VB.NET forum? I've asked the mods to move this to the C# forum.
-
Feb 4th, 2012, 05:04 AM
#3
Thread Starter
New Member
Re: serial Communication between PLC and C#
Originally Posted by jmcilhinney
Then why have you posted in the VB.NET forum? I've asked the mods to move this to the C# forum.
I wanted to do in both i.e. vb.net and asp.net also.
So can you plz help me in vb.net....
-
Feb 4th, 2012, 07:24 PM
#4
Re: serial Communication between PLC and C#
This is better to be posted on the API forum.You will have to manipulate the exposed methods of the specific PLC dll(that we know nothing about).Look at the manual for the file you are using.If no exposed methods exists we probably can't help you at all.
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
-
Feb 6th, 2012, 01:03 PM
#5
Re: serial Communication between PLC and C#
Hello,
You are not going to get an out of the box namespace to do this for you.
In order to be vendor agnostic, you would be better looking for an OPC Server to provide the data from the PLC, and then have your ASP.Net Application, talk via an OPC Client to grab the data that you want to display.
Gary
-
Feb 6th, 2012, 04:08 PM
#6
Fanatic Member
Re: serial Communication between PLC and C#
1. The SerialPort control in the Toolbox (System.IO.Ports.SerialPort)
2. Send data using a Write method; use the Read method or a variation to receive data.
3. SerialPort is part of the .NET Framework, thus you do not have to use a separate dll.
4. There are lots of examples available online. For example, you can download the EnhancedSerialPort example from my website (www.hardandsoftware.net). This does use a dll, which is included (because of the "enhancements"), but the code that is included will work with the built-in SerialPort object.
I cannot offer any specifics for your PLC. The manufacturer should provide information on the protocol to be used. This might be ModBus, which is often used, though the PLC might employ its own serial protocol.
Dick
Richard Grier, Consultant, Hard & Software
Microsoft MVP (Visual Basic)
-
Feb 7th, 2012, 02:34 AM
#7
Re: serial Communication between PLC and C#
Hello,
I have merged the two threads that were created for this topic, and I have placed the result into the ASP.Net forum.
bksingh, please do not create two threads for the same question.
Thanks
Gary
-
Feb 20th, 2012, 01:35 PM
#8
Junior Member
Re: serial Communication between PLC and C#
-
Feb 21st, 2012, 02:01 AM
#9
Re: serial Communication between PLC and C#
Originally Posted by arj3090
What make and model PLC?
Although a valid question, I would have said that at this point, that doesn't really matter. In order to be useful, any application that talks to a PLC, or any form of DCS, needs to be vendor agnostic. If you connect directly to a particular PLC, using any form of their API, you are limiting yourself only to that vendor going forward.
That is why it would be much better to move up a level to OPC, or even OPC UA, and have your application communicate using this protocol, that way your application can talk to any vendor.
Gary
-
Feb 21st, 2012, 04:07 AM
#10
Junior Member
Re: serial Communication between PLC and C#
Originally Posted by gep13
That is why it would be much better to move up a level to OPC, or even OPC UA, and have your application communicate using this protocol, that way your application can talk to any vendor.
OPC DA may give the most options in the way of various vendor's PLCs, but is by no means the easiest to use. It is based on ActiveX technology which is not ideal for .NET languages. It also requires 3rd party software installation with run time fees for every deployment. The requirement to install a 3rd party software then takes away the option to XCOPY deploy a .NET app.
OPC UA can be more .NET friendly, but lacks in the number of available drivers and wide acceptance when compared to DA.
There are many driver options available that are natively .NET including some that are open source and/or free. Some PLCs use open and published protocols that give the option of developing your own driver although this can get very involved.
-
Feb 22nd, 2012, 07:44 AM
#11
Re: serial Communication between PLC and C#
Originally Posted by arj3090
OPC UA can be more .NET friendly, but lacks in the number of available drivers and wide acceptance when compared to DA.
Agreed, but the OPC UA Foundation provide a OPC UA Server which can expose any COM OPC Server to OPC UA. I have spoken to at least one vendor who is spefically NOT creating their own OPC UA Server, since there is already a system in place to "translate" from COM OPC to OPC UA.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|