LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview OPC error

Solved!
Go to solution

Hi,

 

I am trying to link boolean buttons on a Labview front panel to items on an OPC server. (I am running LabVIEW Professional Develompent System version 9.0)

 

I am hoping to use Labview as a client for a SCADA application for a customer.

 

I can browse to, and see all of my OPC tags when using the Datasocket as the method of Data Binding.

 

When I run the VI, I can see a red indicator beside the buttons on the front panel, giving the following error message: "Error: Can't add item to OPC Group."

 

I have tried several other OPC test clients to test if the problem is with the server or the client. I have been able to add (and read/write) the items in every test client that I have tried, apart from Labview.

 

I did note however that I had to define an access path for the OPC items when using a Kepware OPC Quick Client, otherwise they would not add. I am guessing that I may have to do the same in LabVIEW, but I cannot figure out how to do this.

 

Can you please advise.

 

Thank you.

 

 

0 Kudos
Message 1 of 9
(4,758 Views)

Could you post a snippet/example of how you are addressing the opc server?

I have always had success like this:

opcSnippet.png

_____________________________
- Cheers, Ed
0 Kudos
Message 2 of 9
(4,749 Views)

Hi Ed,

 

Thanks for your reply.

 

Below is an example of how I am addressing the OPC server. It is running on the local machine. I was able to browse for, and see the tag shown below.

 

Error 1

 

I am simply tring to link boolean buttons to the specific tags. (See below)

 

Error 2

 

I also tried doing it using your soultion below, but had no luck. I received the error message "Err (42)" after the Datasocket Open function.

 

I am really puzzled because I can browse all of the tags on the server, but it just will not connect to them properly.

 

Any more advice would be greatly appreciated...

 

 

 

0 Kudos
Message 3 of 9
(4,744 Views)

Hello SysEng123,

 

I would like to try and help you with your issue.  Please answer the following questions:

 

  1. Which version of LabVIEW are you using?
  2. Do you have the LabVIEW Datalogging and Supervisory Control (DSC) Module?
  3. Is this VI part of a LabVIEW project?
  4. Have you tried this with your Windows Firewall switched off?

Best Regards,

George T.
Senior Applications Engineer
National Instruments UK and Ireland
0 Kudos
Message 4 of 9
(4,720 Views)

Error 42 is usually returned when LabVIEW can't find the location. 

Looking at the path in you last post, opc:/ is with a single forward slash, and I have never seen commas in an address before.

Try running this snippet, and try browsing to the opc item to see what its address is. Then try talking to it with the code in my first post. If all is good, then try binding it.

 

browse opc.png

_____________________________
- Cheers, Ed
0 Kudos
Message 5 of 9
(4,715 Views)
Hi George, Below are my responses to your questions: 1. Which version of LabVIEW are you using? Labview Professional Development System Version 9.0 (32-bit) 2. Do you have the LabVIEW Datalogging and Supervisory Control (DSC) Module? No, I don't have this module. I am thinking that this may be my only option if it won't work with what I have. 3. Is this VI part of a LabVIEW project? No, it is not part of a project yet. I have simply tried to create a VI with just a single BOOL in order to test the connectivity to the OPC variables over Datasocket. 4. Have you tried this with your Windows Firewall switched off? Yes, I have tried this with no luck. Do you think the DSC module is my only option?
0 Kudos
Message 6 of 9
(4,709 Views)
Hi Ed, When I run that snippet of code and browse to the OPC item, it gives me the same address that I have shown in my previous post. I also had noticed the double forward slash after "opc". However, this is the address that the server gives me. When I manually change it to a single forward slash I get an error saying it "can't connect to the opc server. server not found". My only conclusion from this is that the OPC server is based on a newer version of OPC which Labview will not support.
0 Kudos
Message 7 of 9
(4,700 Views)

What is the OPC version of the server you're trying to connect to?

 

For versions 2.x and below, you can only write a LabVIEW client using Data Socket.

For version 3.0, you can only only write a LabVIEW client using the DSC module.

 

See more here.

Message 8 of 9
(4,689 Views)
Solution
Accepted by topic author SysEng123

Thanks for the info. I had actualy heard that before. I know that the server did work with OPC clients that only supported OPC 2.0 because I tested this, so therefore I presumed it would work with Labview.

 

However, after further investigation into this problem I have since found out that there is a known bug with the version of OPC server I am using and Labview. I suppose this explains all the problems I was having.

 

Thanks for all the replies.

Message 9 of 9
(4,684 Views)