Sign in to follow this  
Followers 0
Guest kevin

dde opc

17 posts in this topic

I am trying to figure out a way to use the dde opc and excel to record different integers and various times. But I need it to post to different cells each time it records. I know its a macro visual basic setup any help would be great thanks

Share this post


Link to post
Share on other sites
Would you like to use DDE or OPC communications, these are two diiferent formats. What type of PLC are you using, you will need an RSLinx activation for Single Node, OEM, SDK, Pro, or Gateway, Rslinx Lite does not support DDE or OPC. You can paste a Hot Link in excel using the following format-- replacing "TopicName" with the name of your topic in Rslinx. =RSLINX|TopicName!'N7:41,L1,C1' I have some examples I could send you using Macros in Excel using OPC but you will need to be a little more specific of what Hardware/Software you are using and what exactly you want to do with the data in excel. I assume you want to take a value from the PLC at certain time intervals and log the data in an Excel column after each sample taken?? JJ

Share this post


Link to post
Share on other sites
Sorry wasn't logged in........... Would you like to use DDE or OPC communications, these are two diiferent formats. What type of PLC are you using, you will need an RSLinx activation for Single Node, OEM, SDK, Pro, or Gateway, Rslinx Lite does not support DDE or OPC. You can paste a Hot Link in excel using the following format-- replacing "TopicName" with the name of your topic in Rslinx. This will report the integer N7:41 in excel. =RSLINX|TopicName!'N7:41,L1,C1' I have some examples I could send you using Macros in Excel using OPC but you will need to be a little more specific of what Hardware/Software you are using and what exactly you want to do with the data in excel. I assume you want to take a value from the PLC at certain time intervals and log the data in an Excel column after each sample taken?? JJ

Share this post


Link to post
Share on other sites
I am using a slc 5/04 and i have linx oem. I can bring the data to my laptop or desktop. What I am trying to do is reord freezer temps every hour and view them in a spreadsheet layout. I am very unfamiliar with macros.

Share this post


Link to post
Share on other sites
This example will take a sample at the top of every hour and store the value from cell "A2" in the next available cell in column "D". It will also log the time of the record in column "E" Cell A2 is the Hotlink to Rslinx in the form of =RSLINX|TopicName!'N7:0,L1,C1'. There is also a manual button, which runs the same code as the top of the hour will run. This logger is limited to 5000 recordings. Let me know if this helps, the code is located in Sheet1 and in ThisWokbook object, and Module1 in the VB Editor. You may get an error when opening (Can not Start RsLinx) because you must have the topic in rslinx set up to match the topic in cell A2 of the Excel sheet. You will also need Macros Enabled in Excel. JJ TempLog.zip Edited by TechJunki

Share this post


Link to post
Share on other sites
i am still confused I am in seattle i will give you my number and if you could walk me thru that would be great

Share this post


Link to post
Share on other sites
What is the confusion, I can see if I can explain in better detail?? JJ

Share this post


Link to post
Share on other sites
well i opened the file and when i tried to change the link it would error #ref. It was also locked. I went and bought a book today hoping to help me. Ishowed the file to someone else and we played with it. And it seems that after saving the file and reopening it worked. Now before we save it we made a N11:0 file and pasted the link same address. but it would not change the value of 17413 until after it was saved, closed and opened later. Then the address was able to be changed and data was shared. very confused about how you even set this up.

Share this post


Link to post
Share on other sites
Sorry if i dont understand the problem quite right, but Why not using the "Copy DDE-link" feature in the edit menu of RSLinX? Browse to the wanted tag, copy and paste special in Excel?

Share this post


Link to post
Share on other sites
Put together a document to explain the sheet and the macros used, hopefully this wiil help you get started, any other questions feel free to ask. JJ CodeExplanation.doc

Share this post


Link to post
Share on other sites
I knew how to copy and paste the link its the macro setup that is new to me. I have a micro 1000 connected to my laptop with just a clock running. I got the link to post to excel on the file you made, by saving and re opening app. but know if i click manual button i get a compile error: cant find project or library??????

Share this post


Link to post
Share on other sites
What version of excel are you using.. 97, 2000, XP?? Can you send me a screenshot of the error you are getting?? Not sure why it would give you that error when clicking the manual button.... You do have Macros enabled correct?? Verify the References look like this, goto Tools>References on the Visual Basic Editor Toolbar JJ

Share this post


Link to post
Share on other sites
I removed the "On Error Resume Next" lines, this will hopefully bring you to what line in the Maco code is generating the error. This statement ignores code errors by just continuing to the next line of code. Without this line in the program anymore, use this new file to help track down where the trouble is. It will hopefully Highlight a line of code in yellow, this will be the line where the trouble is JJ LogNoErrorhandling.zip Edited by TechJunki

Share this post


Link to post
Share on other sites
thanks I downloaded the no error and loaded it and it works fine and now so does the other one. something must have happened during transfer. how do you do screenshots?

Share this post


Link to post
Share on other sites
i spoke to soon the templog works at work but still will not work on my laptop. I get a compile error and it opens v.b. general sheet 1 my macro and highlights i the other one works fine???

Share this post


Link to post
Share on other sites
Did you verify the references look the same as the screenshot I posted?? Obviously must be the config of the laptop, same ver. of softwares?? To do a screenshot, do a printscreen paste in MS Paint and save as .jpg then attach to post using the File Attachments options. JJ

Share this post


Link to post
Share on other sites
it has to be a compatibility problem. I have xp on my desktop and 98 on my laptop. I finally got linx to work on my desktop. and tried them and they work. thanx for your help. maybe sometime i can help you thanx again.

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