Visual Studio 2013 & AB PLC

chrome4ever

Member
Join Date
Jul 2014
Location
NC
Posts
16
I have an existing vb project created in Visual Studio 2013 that our maintenance techs used for misc day-day things. I would like to be able to read a few tags out of a MicroLogix 1100 that is on Ethernet. The pc that runs vb project has RSlinx installed. Does anyone have any sample code of how to read an address in my vb project from the plc?
 
You can easily do this with AdvancedHMI (using VS2013) and not need to write any code.

- Add an EthernetIPforPLCSLCMicroCom to the form
- In the properties window, set the IPAddress to that of your PLC
- Add a BasicLabel to the form
- Set PLCAddressValue to your address such as N7:0
- Set PLCAddressKeypad to the same address (e.g. N7:0)
- Run the application
- The label will show the current value in the PLC
- Click on the label to get a keypad to enter a new value.

If you want to write code to modify the value, it would be like this:

EthernetIPforPLCSLCMicroCom1.Write("N7:0","99)

AdvancedHMI does not need RSLinx, so your finished app can run on any PC.
 
Thanks for the reply Archie. I looked at the AdvanceHMI but reading through the FAQs on their site you must use the advancedhmi project. I want to be able to keep the project I already have and add reading of plc addresses into it.
 
I looked at the AdvanceHMI but reading through the FAQs on their site you must use the advancedhmi project. I want to be able to keep the project I already have and add reading of plc addresses into it.
You can add your existing project to the AdvancedHMI solution, then set your project as the primary project. This will then let you use the drivers and controls with your existing project.

If you open the AdvancedHMI solution, then right click the top Solution in then Solution Explorer window and select Add Existing project and browse to your .vbproj file.

That gives you the best of both worlds. I think you will find the AdvancedHMI drivers are much easier to use than trying to use an OPC interface with RSLinx. Most read/writes with AdvancedHMI drivers only require 1 line of code versus about 5-10 for RSLinx.
 
Archie I did as you suggested and added my existing project to the advancehmi project. I set my project as the startup project then I made a new reference in my existing project to the advancedhmi project. My problem now is I cannot open a form from the advanced hmi project from a form on my existing project.I looked through several vb forums and they show the same lines of code to be able to do this but it isn't working.

I created a button on my existing project's startup page and put the below code in it.
Dim hmi As MfgControl.AdvancedHMI.MainForm
hmi.show()

It tells me it's not defined.

I created 2 test projects and put them under one solution and did the exact same thing and it worked. Any ideas why it doesn't work with the advancedhmi project?
 
Try this.... after adding your project to the solution, add references to the AdvancedHMIDrivers and AdvancedHMIControls projects. Then also add references to the files AdvancedHMIDrivers\Support\MfgControl.AdvancedHMI.Drivers.dll and AdvancedHMIControls\Support\MfgControl.AdvancedHMI.Controls.dll

Essentially you will only be using your project, AdvancedHMIDrivers, and AdvancedHMIControls projects, but not the AdvancedHMI project.

When you have one of the forms open from your project, you should have all of the drivers and controls showing the Toolbox. You can then add a driver to your form.
 
Thought I was onto something there. I tried what you suggested. I got all references added and was able see the drivers & controls in the toolbox when I had one of my forms opened. I added a control and set the plc address. When I went to start the application in debug I get an error saying that the control is not defined. It really seems like it is designed so their controls and drivers can only be used in their project.
 
I'll try this as soon as I get back to my computer. Did you add a driver first, then one of the controls. Some of the controls will give an error if it doesn't find a driver already on the form.
 
I just tried this out by adding a new project to the solution, then adding the 4 references. I then added a driver, set the IPAddress, etc, then added a BasicLabel. Ran the added project and everything worked as expected.
 
I had the driver setup for each control that I added. I went back in and tried to add just one control and made sure I had the driver setup for it and got the same result.
 
What are the details of the error you are seeing? Does it point to a particular line of code? What control is it saying that is not defined?

If you are able to add the AdvancedHMI drivers and controls to a form, that should verify all of the references are correct.
 

Similar Topics

I am having difficulty finding documentation or examples on integrating Visual Studio with iX Developer in order to develop custom objects...
Replies
0
Views
538
Hello, I am working on a project currently that uses a windows application on a PC to communicate with an NX1P2 controller to read and write...
Replies
2
Views
996
Hi I'm currently doing a college course in robotics and automation and a question we were asked was. A software application used by production...
Replies
10
Views
3,646
Wizards, I have an application that is built in Visual Studio 2019. I have been getting an error from the program that is very generic. The...
Replies
20
Views
3,978
Hi All I have been switching between 2017 and 2019, all depending on which one i found more stable, at the moment I use 2019 I was just...
Replies
1
Views
1,478
Back
Top Bottom