Sign in to follow this  
Followers 0
slcman

Rockwell and C++

11 posts in this topic

Hi all, I want to start to learn C++ for build some apllication on window Xp. I check few info on MSDN microsoft web pages but still have question. - What is .NET framework ??? I see this expression everywhere! It is the new way to program in C? - It is possible to communicate with plc for get some data (thru serial or ethernet). Do I need driver or soft package? I know VB is more userfriendly but I earing C++ is more powerfull. Thanks

Share this post


Link to post
Share on other sites
G'day, The .net framework (http://en.wikipedia.org/wiki/.NET_Framework) is a common set of libraries that .net languages can all use and a runtime environment that once a .net application is compiled it can run on. >It is the new way to program in C? hmmm... the .net framework is not restricted to one language (vb.net and c# both use the same framework).. but yeah, if you like, c# is an evolution of C/C++ >- It is possible to communicate with plc for get some data (thru serial or ethernet). Yeah, to save a lot of hassle, build yourself something with an OPC client in it with source from here http://www.opcconnect.com/source.php > Do I need driver or soft package? Yeah, don't try and build your own drivers, get an OPC server like RSLinx or Kepware.. >I know VB is more userfriendly but I earing C++ is more powerfull. I don't like to be too subjective on forums so I'll limit myself to this: VB is the devil. The new languages do take a little learning but you can do amazing things quickly... especially by taking the tutorials/labs/videos on msdn. ~Mike Edited by MikeSmith

Share this post


Link to post
Share on other sites
There is nothing subjective at all about that statement. It is an honest objective undeniable hard fact.

Share this post


Link to post
Share on other sites
You can talk to AB PLC's via either Ethernet or serial port. One of the annoying problems with this is that Allen Bradley saw fit to develop slightly different command formats for every single PLC family. The basic protocol is DF-1, and Allen Bradley documents this pretty well. You can also use "PCCC" to talk to all of them, even ControlLogix (though you have to encapsulate it inside a CIP packet). PCCC is a variation on the DF-1 protocol adapted for Ethernet. Documentation is kind of rough. Finally, most of them (except the SLC's?) support Ethernet/IP which uses the CIP protocol. The CIP protocol is extremely well documented by the ODVA but unfortunately at this point I have no idea where you can get free documentation. The ODVA used to publish the specs for free but now it appears that you have to pay thousands to become a member and a few hundred dollars per spec. for the CD's. However, enough code has leaked out that I've seen at least one or two libraries that you could potentially use. I have successfully written my own protocol driver to talk PCCC in Python using just Allen Bradley's published documentation and Ron Gage's C++ code (no longer free but there are still copies floating around the Internet) as a template. It's not hard and works very well but it does take time. There are some other free libraries floating around the internet such as "TuxEIP" but for whatever reason, none of them seem to have quite the staying power of the much simpler Modbus and Modbus/TCP protocols with competitor PLC's. The easier way is to get someone else's library that is already written. There are a few free ones drifting around the internet. Rockwell USED to promote their "C library" for use with their own driver, aka RS-Linx. However in recent years apparently they have discontinued this. Instead, if you are working on a Windows PC (and only under Windows since it is based on COM, although there may be alternatives where say for instance the Jacob's ladder project duplicated the entire COM interface in Java), you can use OPC. The idea here is that the OPC protocol is a programming library with a standard interface. The underlying driver may be different for every PLC but all PLC's can be interfaced using the exact same protocol (OPC). The merits of OPC are great. There are two basic problems though. The first one I already mentioned: COM. With regard to this, the OPC group in frustration with Microsoft's official abandoning of COM is slowly publishing the details of OPC-UA which is their COM-free replacement for OPC. The second problem is that OPC is not an open protocol. Access to the specifications is tightly controller by the OPC Foundation and the only way to get access is by paying thousands to join, and this is true regardless of whether it is OPC or OPC-UA. Documentation on the XML implementation of OPC used to be freely available but this particular protocol is not very popular and not common. So..if you are willing to pay for at least the OEM version of RS-Linx or else buy an OPC server from Matrikon or Kepware (the two most popular vendors), then you are halfway there. All of these come with an OPC interface DLL that you can use from a DOS/Windows program with say standard C++. If you want to use a virtual machine though such as CLR, Java, or Parrot, there's a problem. You've got to somehow talk to the OPC driver which exists in the COM object model from within an entirely alien and foreign object system (CLR/Java/Parrot). This is no easy feat in itself even though you forked over money in the first place. Hence the reason that OPC-UA is so important, because among other things, it frees us from the COM object model which Microsoft has deprecated.

Share this post


Link to post
Share on other sites
+1 paul on your post; a good read.

Share this post


Link to post
Share on other sites
Great read Paul, appreciate the effort you put into your posts.

Share this post


Link to post
Share on other sites
Thanks everyone for the help and web site. Last question, it is a good idea to use C++ for build window based application? All documentation I see is for console (command window) it's hard to found documentation on where to start for do a project with windows, push button, textbox, ect... Suggestion for the Forum for administrator: The web site should have a C++, VB & JAVA section. We have a lot of member who know this code and they knowledge can be helpfull. Thanks again This forum is one of the most powerfull forum on the web...

Share this post


Link to post
Share on other sites
C++ was originally designed in the text world. It can certainly do graphical applications. Usually these days, you use an IDE for developing these because manually writing draw commands and such gets very tedious. A very popular one is Qt. Google it and you'll get several references immediately. I believe you can use netbeans and Eclipse the same way since both were originally conceived to support Java but now support almost any language. As an alternative, Microsoft Visual Studio can also support several languages if you are planning on buying an IDE, but there are some issues. First, you've just locked yourself into dotNET and you can't just recompile your program to run on a Mac or Linux down the road. Second, you have to deal with all the ugly details that programs written to run on dotNET 1.x will not run on dotNET 2.x or 3.x, and that simply installing the other versions to coexist won't fix the problem either, forever dooming you to a software troubleshooting/maintenance headache if you develop under dotNET. So if you do go down that road, prepare to have a permanent troubleshooting job dealing with installation issues.

Share this post


Link to post
Share on other sites
You can find a driver written in VB.NET that works nicely with AB PLCs over serial communication. You can find it here:http://sourceforge.net/projects/abdf1/ http://sourceforge.net/projects/advancedhmi/ The second project has the DF1 driver included into a larger package and it is a newer version of the driver. You can also find other open source PLC drivers on sourceforge. As for C++ being more powerful... on a windows based system, that is probably only true when you get down to low level hardware development. I've done a lot of VB.NET programming and have yet to run into anything that was not possible to do. Edited by arj3090

Share this post


Link to post
Share on other sites
If you are using Java, I have had success with JEasyOPC. Not the easiest implementation to setup, but the documentation isn't bad. --HandledException
1 person likes this

Share this post


Link to post
Share on other sites
El 15/9/2009 a las 2:06 PM, HandledException dijo:

Si está usando Java, he tenido éxito con JEasyOPC. No es la implementación más fácil de configurar, pero la documentación no está mal. --HandledException

Hola saldos, escribo desde Venezuela. Estoy desarrollando mi tesis y estoy tratando de comunicarme con SLC 500 mediante el servidor de OPC y con Java con JEasyOPC yo no he tenido éxito. usted comenta que sí lo ha hecho con éxito. usted me podría Orientar. gracias

Edited by williams ascanio

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0