Sign in to follow this  
Followers 0
Guest modesto

How Can I Read Data From Serial Port

6 posts in this topic

I saw in an equipment on the facility where I work a software capable of get data from a serial db 25 port in a PLC5 CPU. A PC running a simple software generate some bar graphs based in data from PLC5 data table. This software was made in visual basic. If you have any idea how it works and how can I program this interface that read the PLC data table, please tell me. Thanks.

Share this post


Link to post
Share on other sites
They were PROBABLY using RSLinx to communicate with the PLC - and then using VB to get the data from RSLinx - then VB displays the data. The RSLinx version cannot be the LITE version which comes free with RSLogix software. There is another thread about "DDE" that came up a few days ago on this same forum. Reading it should give you some ideas. The big difference is that the person posting the first thread wanted to use Excel to display the data - you want to use VB instead. If you're not going to use RSLinx (which already KNOWS how to talk to a PLC-5) then you will have to program your VB application to retrieve the PLC information itself. This would be a BIG-BIG-BIG VB programming project - and certainly not for the feint of heart. Have you ever worked with VB before? Also, I'm sure that other programs besides RSLinx are available which can retrieve information from a PLC-5. Other responders can probably give you some leads on where to find them - and on how much they will cost. Incidentally - once the data has been retrieved into Excel (as detailed in the earlier thread) then setting up a bar graph to display the data would be a very simple task. Are you SURE that you need to use VB for your application? Maybe Excel would answer your purposes. Good luck, Ron

Share this post


Link to post
Share on other sites
There are some different options when using VB to communicate to an AB PLC. As already mentioned, RSLinx can be used (must be RSLinx professional) to set up the communications between the PLC and the computer. I have briefly played around with using DDE and RSLinx with VB6. I even have a download on this web site that explains a simple example. What I noticed with DDE is that it is very slow. I understand that another option is to use OPC, and AB has some sort of software development kit (that you must order) to figure out how to do it. I have seen some code examples of it, and frankly, I don't know how to do it. I just have not spent the time to figure it out. I have been recently playing around with a driver that I was able to buy for about $50 from www.vhmiautomation.com. This is an Active X DLL that eliminates much of the tedious work trying to program your own DF1 protocol driver. I am really just now begining to figure out how it works. I have seen what it takes to write your own DF1 driver (not to mention ethernet), and you don't want to have to write your own driver unless you have lots of spare time. If you want to see examples of writing a DF1 driver for an AB PLC, check out the book Home Automation Basics - Practical Applications Using Visual Basic 6.0 by Thomas Leonik, P.E. It is a good book explaining how to communicate with VB6 to a Micrologix 1000 PLC. I have also used the trial versions of Cimquest's INGEAR driver for AB. It is quite a bit more expensive thatn Vhmiautomation's driver. The biggest advantage to INGEAR that I have noticed so far is that their documentation is far more complete. I have used INGEAR previously with Modicon PLCs, and have been happy with the product. You can get more info at www.cimquest.com. There are other software vendors that have similar products. I cannot say much about them since I have not used them. There is kepware, parijat and others. I am assuming that you have a good background in VB. I really got my baptism of fire when I had to pick up a project using INGEAR with a Modicon PLC and VB4.0. I had played around with VB3 some previously, but did not have much VB experience. I made a lot of mistakes before I got the application working, but eventually was able to do several more applications using VB5 and VB6.

Share this post


Link to post
Share on other sites
You will need to: 1. Get spec of DF1 protocall 2. Understand protocall such as header, data, & chek sum 3. VB developer 4. Use mscomm32.dll to comunicate to comport. This guy seems to be willing to share his "C" code. Eng-Tips

Share this post


Link to post
Share on other sites
You can find the document on DF1 Protocol at the MrPLC.com download site. Here's the link. Allen_Bradley_DF1_Protocol-17706516

Share this post


Link to post
Share on other sites
well it all depends on what exactly you need to do. i didn't use PLC5 in a long time and even then i didn't try to play with com port. on the other hand i do use quite frequently slc (don't like micrologix since it has no online editing capabilities) is to do ASCII messaging to/from plc. unlike using rslinx or third party drivers, this makes it possible to control other piece of equipment or transfer values in either direction (pc<>plc) but requires dedicated RS232 port and some code in the plc as well (few rungs would do).

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