Sign in to follow this  
Followers 0
Guest modesto

Getting data from plc

2 posts in this topic

How can I get data from a Alle Bradley PLC Data Table and write it to an Excell table. Thanks.

Share this post


Link to post
Share on other sites
You'll need RS Linx FULL version or RS Linux Single Node if you are only doing one connection to the PLC. The easiest way is to use DDE. Configure RS Linx Full version with a DDE topic to your PLC. Open up RS Logix and browse to the DATA TABLE. Pick any address or bit you want to appear in Excel. On your keyboard press "CTRL+C" for the copy command. Then go to Excel and click in any cell, press "CTRL+V" for the paste command. That will create an instant "HOT Topic" in DDE terms. When the value in the PLC changes, so will the Excel Sheet. Or if you want just open a DDE channel and read the values, then close the channel, you might want to download the code called: Allen Bradley SLC500 DDE Link to Excel Logger 1.3 Found here: http://www.mrplc.com/cgi-bin/code/filedisplay.cgi?category=excel Look at the code in the MACRO's section. You'll see how to open and close a "COLD DDE Link"        'opens a COLD DDE link        RSIchan = DDEInitiate("RSLinx", "M1138")                                                                  'read word F8:10 and load into a VB variant variable        f810data = DDERequest(RSIchan, "F8:10")        'read word F8:11 and load into a VB variant variable        f811data = DDERequest(RSIchan, "F8:11")        'read word F8:12 and load into a VB variant variable        f812data = DDERequest(RSIchan, "F8:12")        'read word F8:16 and load into a VB variant variable        f816data = DDERequest(RSIchan, "F8:16")        'read word F8:18 and load into a VB variant variable        f818data = DDERequest(RSIchan, "F8:18")        'read word F8:17 and load into a VB variant variable        f817data = DDERequest(RSIchan, "F8:17")        'read word F8:20 force check #1 and load into a VB variant variable        f820data = DDERequest(RSIchan, "F8:20")        'read word F8:21 force check #2 and load into a VB variant variable        f821data = DDERequest(RSIchan, "F8:21")        'read word F8:22 force check #3 and load into a VB variant variable        f822data = DDERequest(RSIchan, "F8:22")        'read word F8:23 force check #4 and load into a VB variant variable        f823data = DDERequest(RSIchan, "F8:23")        'read word F8:25, get PASS or FAIL status from PLC and load into a VB variant variable        varResults = DDERequest(RSIchan, "F8:25")                'close COLD DDE link        DDETerminate (RSIchan)                'write all values to cells        Cells(1, 1).Value = f810data        Cells(1, 2).Value = f811data        Cells(1, 3).Value = f812data        Cells(1, 4).Value = f816data        Cells(1, 5).Value = f818data        Cells(1, 6).Value = f817data        Cells(1, 7).Value = f820data        Cells(1, 8).Value = f821data        Cells(1, 9).Value = f822data        Cells(1, 10).Value = f823data

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