From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabView connection to the device and automatization

Dear communitiy,

So, I am operating a device and would like to automatize more the process of using it with the LabView.
Thing is I used LabView multiple times before, but never programmed new device into the LabView, only did the measuring and stuff like that, when someone already did all of the work. So, I would like just someone to briefly guide me trough the steps if I caught the full process

 

  1. So, first connection needs to be established via device and PC. Device is connected to PC via network cable. And connection is to be established by TCP/IP protocol using MAX. Had some troubles doing that, but it ill work.
  2.  Next step I guess is programming the device with the VIs. I have the DLL file and header file from the manufacturer, so I successfully implemented the VIs into the LabView. Now I have VIs like connect, disconnect, set value, get status. Overall I got everything I need as it seems.
    So would like to ask now, does anyone has link or something how to proceed with programming those VIs to operate my device?


    Thanks and cheers!

 

 

0 Kudos
Message 1 of 9
(3,112 Views)

Hi Johnywoo,

 

I would say that always depends on the hardware you are working on. Usually when you use NI hardware it comes with examples, so it is easier. From what you are telling, it sounds that this is a non-NI instrument, but still could you give us a little more information about it?

Before trying to run a routine with all your low level VIs where you call the DLL, I would verify that the connection is properly established, here it also depends on the instruments, but if your setup is through a network cable, I would try first pinging it and also check the user manual for setup instructions.

Many instruments provide an executable with a simple UI to control their instrument, I would try this after verifying the communication is established properly. This applications usually uses the same methods that you will be calling from the dll, that way you can familiarize with how the instrument works(order and instrument behavior) and then try to replicated it using LabVIEW.

As I mentioned before, it always depends on the instrument, in my experiences some instruments even come with a small LabVIEW API that you can download, so it would be worthy to search for an already existing API in the web, or directly in the VIPM (VI Package Manager).

 

I hope this information helps. Fell free to tell us which instrument you are trying to use, so maybe we can give you a little more guidance.

 

Cheers.

Guillermo Oviedo
R&D Software Engineer
CLA | CTD
0 Kudos
Message 2 of 9
(2,948 Views)

Dear Guillermo,

thank you for the nice answer before all.

I am trying to operate the laser, it is not an NI hardware. The laser already has a software that came from manufacturer, but LabView offers a lot more flexibility to improve the laser performance and measurement (and also automatize it).

I have instructions how to connect with TCP/IP using MAX. And I think I established the connection properly.
Also, manufacturer gave the instructions how to get the VIs. 
So, when I went in LabView  Tools > Import > Shared library(.dll), I have put in the .dll file and the header file that manufacturer sent and then all of the VI were then created in the LabView. Then I am able to put the VIs in the front Panel and use the Block diagram also.
The VIs are basically to connect and disconnect the laser, to set on some wavelength, literally all I need to use the laser.

So, what is confusing me the most. What is the next step to start programming it and using all of the VIs to create full operation on the device with the LabView.?

I do not have LabView API unfortunately, but hopefully will be able to create something.
I hope I made it more clear now, if you need more informations, let me know.


0 Kudos
Message 3 of 9
(2,926 Views)

Hi Johny,

 

Sound good that you have your setup ready to be programmed.

I think I would start creating a test VI where you can test all the methods you already imported from the dll. Sometimes what I do to test them, specially the order where you should call them, is creating a simple VI, where you trigger each of the dll methods with an specific button. That way you can manually initialize the communication, configure, activate, disconnect, etc. After you get familiarize with the purpose of each VI, you could abstract them into a higher level, and maybe create your own API for that instruments. After that it will depend on the requirements you have for the application, but I think the next step would be choosing an architecture to cover all those requirements, but first you need to understand how the low level methods work.

 

Are you familiarized on programming in LabVIEW? I'm not sure if you were asking for a step by step instructions on creating a VI with the methods you imported from the dll.

Guillermo Oviedo
R&D Software Engineer
CLA | CTD
0 Kudos
Message 4 of 9
(2,913 Views)

Hi Guillermo,

I have basic knowledge of programming in LabView and I think I am getting the picture slowly. End goal is to create my own API.
I think I understand how the device works and should even go more deeply to understand its work, which will make the programming more easier. So, I guess I will just be putting the VIs together and calling some fucntions and parameters (this also came from manufacturer).

But even for the easiest communication to connect and start the laser I do not get the response.
Now, I am afraid you are right and maybe connection is not established properly.

I did the TCP/IP connection via MAX. My device is connected via network, so I put in the IP address of the laser. But the thing is when I tried to RUN the visa test I get this notification Hex 0xBFFF0011. I already looked around the forum, because others were getting this message, but still did not come up with solution.

My laser is connected to local common network. I am 100% sure that connection is ok, because the laser is working when I tried to work with it trough the software that came with manufacturer, but does not work with LabView.

I can programme in LabView, especially this easier things, as I did that before.
But before, I never needed to establish connections and stuff. Everything was prepared. So that is why I am a bit confused with all of those midsteps.

0 Kudos
Message 5 of 9
(2,904 Views)

Ok, now I understand a little bit more.

 

I got confused, so did you added the instrument as a VISA resource?

Usually if the manufacturer is providing a dll, this dll should handle the communication with the instrument, then you wouldn't need to use any VISA at all.

But if the manufacturer is also suggesting you to add the instrument as a VISA resource on NI MAX, then something tells me that you will need to use the VISA API to handle the communication with your device.

When you say that you ran the VISA test, do you meant that you used the NI MAX VISA test panel?

I think without seeing the documentation the manufacturer has provided to you, it is hard for me to guess the next steps.

Still I hope this comments help you.

Guillermo Oviedo
R&D Software Engineer
CLA | CTD
0 Kudos
Message 6 of 9
(2,886 Views)

Dear Guillermo,

although I was not specific, your replies were really of big help to me! I really appreciate it, because it help to know how to troubleshoot my problems and mistakes I did. I can now connect the device without a problem and already managed to get some VIs and operate my device. But, the path is still long. 🙂

I have question now about, how to put in specific value and send it to device. For example, I am operating a laser and would like to set it to the specific wavelength, to type it in.

I have some VIs from the manufacturer which make this to get the wavelength (to read it) and to set the wavelegnth. They have also added specific arguments I put in this functions., about how to set a wavelength.

Anyway, I put in get int value function to read what is the wavelength, and set in value to choose the wavelength and tune my laser to that specific wavelength.

Should both function be returning the numeric constant or something else. The thing is when I run my program, I am not able to put in any number in those. Do I miss something here?

So,  I am wondering how to set specific number and send to my device via VI. Should be done trough the control or indicator?

If you have any link or previous topic reference, I did not manage to find it!

Thanks a lot for help!

Message 7 of 9
(2,783 Views)

Hi Johny,

 


@johnywoo wrote:

Should both function be returning the numeric constant or something else. The thing is when I run my program, I am not able to put in any number in those. Do I miss something here?

So,  I am wondering how to set specific number and send to my device via VI. Should be done trough the control or indicator?


If you want to change a value during execution, you need to use a Control rather than a block diagram Constant.

We use Indicators to display values (e.g. perhaps the wavelength you read).

 

If you need to update the value of a Control (for example, you want to read the wavelength, place the current value in the control, then allow the user to change the value) you can use a Local Variable - but please be careful using these because overuse/abuse often leads to problems like race conditions and difficult to read/understand VIs!

 

To get more context on this possible problem, the new videos/training materials on the topic of dataflow (Module 5) linked at the top of the forum will probably be helpful.


GCentral
0 Kudos
Message 8 of 9
(2,775 Views)

I'm glad I was able to help you Johny!

And yes, you should use a control for that.

 

Greetings 

Guillermo Oviedo
R&D Software Engineer
CLA | CTD
0 Kudos
Message 9 of 9
(2,766 Views)