Sign in to follow this  
Followers 0
lynchmob2000

Data Collection Using Dde/excel

9 posts in this topic

Hello all, A few months back I used the DDE/VB/Excel example floating around here to setup a data collection app. It is working great and a big thanks to chakorules for the example. I have now been asked if there is a way to not allow the machine to run cycles unless the PC is on and running the datalog spreadsheet. I think I can do this simply by using the Excel sheet to "hotlink" to a bit in the PLC then clear it in the PLC based on a timer (i.e. heartbeat). Question is, what is the syntax to write this bit from a cell? I don't use VB very much at all and figured one of you guys would know this and save me some time. The read syntax for a hotlinked cell is =RSLINX|'M1138'!'B3/161 Thanks, Chris

Share this post


Link to post
Share on other sites
Don't know about bits, but I know you can write a word, see below. From the RSLinx help files: The following macro writes a value to N7:0 in a PLC-5 using the RSLinx topic, testsol: This routine will write a word from Excel file RSLINXXL.XLS, DDE_Sheet tab, cell D7: Sub Word_Write() 'open dde link: testsol=DDE Topic RSIchan = DDEInitiate("RSLinx", "testsol") 'write data thru channel DDEPoke RSIchan, "N7:30", Range("[RSLINXXL.XLS]DDE_Sheet!D7") 'close dde channel DDETerminate (RSIchan) End Sub Using VB From the RSLinx help files: T Visual Basic examples: write a word The following program writes a user inputted number to N7:0 when the Write button (Command1) is clicked, and reads the value stored in N7:0 to verify that the number was actually sent. The inputted number is stored in the text property of the text box named txtWrite_val. The returned value is stored in the text property of the text box named txtRead_val. Sub Command1_Click () 'Write value to N7:0 txtWrite_val.LinkTopic = "RSLinx|testsol" 'Define DDE application & topic txtWrite_val.LinkItem = "N7:0" 'Define DDE item txtWrite_val.LinkMode = 2 'Open DDE link (manual) txtWrite_val.LinkPoke 'Poke Data to RSLinx txtWrite_val.LinkMode = 0 'Close DDE link 'Read value from N7:0 txtRead_val.LinkTopic = "RSLinx|testsol" 'Define DDE application & topic txtRead_val.LinkItem = "N7:0" 'Define DDE item txtRead_val.LinkMode = 2 'Open DDE link (manual) txtRead_val.LinkRequest 'Request data from RSLinx txtRead_val.LinkMode = 0 'Close DDE link End If End Sub

Share this post


Link to post
Share on other sites
i cant find this download could someone please put a link to it thanks david Edited by David Nelson

Share this post


Link to post
Share on other sites
Not sure if this is what you are looking for but http://forums.mrplc.com/index.php?autocom=downloads&showfile=46 http://forums.mrplc.com/index.php?autocom=downloads&showfile=431

Share this post


Link to post
Share on other sites
Thanks Mickey

Share this post


Link to post
Share on other sites
And the "Famous" Excel to SLC DDE logger sheet: http://forums.mrplc.com/index.php?autocom=downloads&showfile=134 You can do a download search here: http://forums.mrplc.com/index.php?act=downloads&do=search Change Category to: View All search for "DDE"

Share this post


Link to post
Share on other sites
thanks chakorules downloaded it and others i am going to see if this may be something i can use. first i have to see if i can learn how to use excel and visual basic. thanks again, david

Share this post


Link to post
Share on other sites
Thanks Ken. I was hoping to be able to hotlink directly from a cell, but I think I can work the VB as you suggest. If anyone knows if it can be hotlinked directly (or not), I would appreciate the help. Thanks, Chris

Share this post


Link to post
Share on other sites
I'm not trying to spoil the fun here, but doesn't some person own the patent on using MS Excel to PLCs via DDE? I'd really like a link/reference to that if anyone has it. My real question is why anyone uses this in the first place? ---- Nathan Boeger Integrator, Microsoft Certifed Systems Engineer http://www.inductiveautomation.com

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