Sign in to follow this  
Followers 0
Bob O

Writing to ML1500 from the Network

26 posts in this topic

Could anyone give me a shove in the right direction on how to or where to look about writing or reading an inter and a string into my ML1500 hooked up to a1761-NET-ENI. I would like to get this integer and string from my MSAccess database that is on the network. Thanks, Bob O.

Share this post


Link to post
Share on other sites
I only played around with this capability once or twice many years ago, but I believe you must create a "hot link" with RSLinx to the data element in the micro, and then paste the hot link into the database. Come to think of it, I only tried doing this with an Excel spreadsheet but I'm assuming the processis ismilar. Others are sure to offer more first-hand knowledge of what to do, I assume many here have tried it!

Share this post


Link to post
Share on other sites
You could write application for PC where database resides and use ActiveX to connect to PLC.

Share this post


Link to post
Share on other sites
Is this the same Bob O as over at PLCS.net? If so, I presume you've got RSView32 in the mix? If so, use VBA to get the info from MSAccess and write to the PLC. Last time I checked, Access didn't support hot links.

Share this post


Link to post
Share on other sites
Thanks for all the replies and this is the same Bob O. from at PLCs.net Being the bad poster I didn’t mention all the software that is or could be in the mix if needed. I do have the following if needed: RSView32, RSLinx Gateway, RSLogix500 (assumed) and what ever else may be needed. I have never done Active X [That I know of] so I will have to look into that and any pointers or an example would be appreciated. Using VBA within RSView32, I have snooped around VBA but again, any examples that would get me started reading from MS Access and writing to the ML1500 through our Ethernet would also be appreciated. Here is what I’m trying to do on this project. Our scheduling software [custom written by another company] will send me an integer and a string for the job that I need to inspect for. I would then like this integer and string to get sent automatically to the ML1500 and then change jobs in my camera. I have the ML1500 changing jobs in the camera right now on the test bench when I enter a new value but would now like to take in to the next level and try doing it automatically. I’m trying to eliminate the human involvement as much as possible. I do have a back up set up for when my network cable is unplugged/goes down or is taken out by the fork truck with a HMI that the operator will have to select the job. Thanks, Bob O.

Share this post


Link to post
Share on other sites
Update I have set up a cold link to my ML1500 and I’m able to write a valve to the controller using a macro in Excel and pushing the command button. Now to make this automatic without the command button would be a plus and then next to figure out how to do this in Access [since it was requested using SQL]. Thanks, Bob O.

Share this post


Link to post
Share on other sites
You can update automatically using the OnTime Event In the VBA tree you will see "This WorkBook" under Microsoft Excel objects. If you add the line Application.OnTime TimeValue("05:00:00"), "MySub" this will execute the Subroutine MYSub at 5:00. Simply create a subroutine and add you code to it from your command button and it will automatically run the code at the specified time. As far as Access is concerned I would interface Excel or VB to talk with Access and use Excel or a Visual Basic program to Interface to your PLC, as I am not sure of Access's ability to do DDE or OPC comms with RsLinx. Retrieving information from a database using VB6 or Excel is relatively simple and may actually save some time. Edited by TechJunki

Share this post


Link to post
Share on other sites
Thank you but I am looking to get it to run like every 5 sec. Sorry for not saying that. Thanks, Bob O.

Share this post


Link to post
Share on other sites
I got it to run using the Sheet change in VBA. So when any of my cells change it will update the ML1500. Now to still figure out Access or see if they can populate the Excel sheet. Thanks again, Bob O. Edited by Bob O

Share this post


Link to post
Share on other sites
This should help you get started, this is som basic code, it will take 4 fields in an access database and transfer them to an excel sheet from A1 to A4. I have included the Access DataBase, And the Excel/Vba code. The database must be in C:\Databases\ folder to work properly Edited by TechJunki

Share this post


Link to post
Share on other sites
Tech, Thank you. I am out doing some landscaping work taking a break you might say so I will play with this later today or in the morning and report back. Thanks Again, Bob O.

Share this post


Link to post
Share on other sites
Ok, I couldn't wait. I tried it but get a compile error: Can't find project or Library. Any ideas or hints? Thanks Again, Bob O

Share this post


Link to post
Share on other sites
Under Tools --> References verify that Microsoft ActiveX Data Objects 2.8 Library is checked, and Microsoft Forms 2.0 object Library, if not scroll down and check it Your References should look something like this........ Edited by TechJunki

Share this post


Link to post
Share on other sites
Tech, It was check. The error highlights Sub ADOImportFromAccessTable(DBFullName As String, TableName As String) adOpenStatic in the ‘open the recordset and also Any ideas and Thanks for your Help. Bob O.

Share this post


Link to post
Share on other sites
Both References are checked??.. Can you do a PrintScreen and attach the error? Might be of some more help Edited by TechJunki

Share this post


Link to post
Share on other sites
Let see if this works. Print_Screen.pdf

Share this post


Link to post
Share on other sites
I see you are MISSING the Data Object Wizard, not sure if that is is but go back to references and click the browse button and Import this .dll file it is for the Data Object that you are missing. Could you also send a print screen of the error you recieve, and show the line number. MSDATOBJ.DLL

Share this post


Link to post
Share on other sites
Tech, Here is three more print screens. Thanks Again, Bob O Print_Screen_Errors.zip

Share this post


Link to post
Share on other sites
Did you remember to create the C:\Databases folder on your hard drive and copy the Access database file to it?? I think you maybe forgot the last "s" on Databases?? Edited by TechJunki

Share this post


Link to post
Share on other sites
Tech, It was that little "s". Thanks Again, Bob O.

Share this post


Link to post
Share on other sites
Tech, If you don’t mind another question, Should I look into using something like Application.Ontime……. to get the macro to run on say 5 sec. intervals instead of using the Command button? Thanks again for your help, Bob O.

Share this post


Link to post
Share on other sites
You could use that to run the macro automatically although it will obviously take a lot of lines of code to fire the event every 5 sec Personaly I would use an DDE Hotlink in Excel and have the PLC request an update from Excel by toggling the value of a cell from say 0 to 1 and then use the Worksheet_Calculate() function to fire the Macro.

Share this post


Link to post
Share on other sites
Tech, Got it. With your help, searching and hacking as I would call it since I don't know anything about VBA. I have it set up to update every 5 sec. Here is the Excel file. Thanks, Bob O. Acess.zip

Share this post


Link to post
Share on other sites
Good luck with putting the entire project together, hope it all works out!! If you have any other questions you know where to look. Edited by TechJunki

Share this post


Link to post
Share on other sites
Tech, After taking another break from this I am back. Do you know of a way to use vba to simulate the enter button being pressed? I realized that I was still having to hit enter for the updates to work. Thanks, Bob O

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