LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ActiveX and Winspec

Hello fellow labView users,
I have recently started at an internship at a company which relies heavily on labView. I am new to the program and my first project is to develop a program that uses activeX to control a CCD spectroscopy camera through WinSpec. I have read the activeX tutorials and based on that I wrote a simple program. Does anyone have experience similar to my project and could lend some advice or know of any useful resources. It would be greatly appreciated.  
Thanks,
William
0 Kudos
Message 1 of 4
(3,955 Views)

You need to learn a little patience, as you created 3 threads for this subject. MikeS81 has provided links to this thread so all discussion can take place in one spot. I had seen your thread this morning but did not have time to respond, and was planning to do so later. Remember: these forums are not a venue for instant responses - if you need more immediate help then you should contact NI Tech Support directly. 

 

With respect to your project: It seems you started writing some "driver" functions for the camera using the ActiveX control. This is a good place to start as it provides modularity and easy coding. It's not clear whether you have a top-level VI, unless "CamRun_wb" is supposed to be the top-level. If it is, it's not clear how it's supposed to work, or what it is that you need to be able to do. I would suggest doing some reading on using event structures and architectures such as state machines and the producer-consumer

 

A few specific comments about your code:

 

  • Read the Style Guide (it's in the LabVIEW Help file). 
  • Lose the splashy VI icons. Smiley Wink
  • Use clusters rather than invidual controls when the parameters are really part of a group. For example, the "top", "left", "bottom", "right" are good candidates for being placed into a "rect" cluster. That way you have one wire instead of 4.
  • Use error clusters. None of your VIs are using error I/O. Do not rely on the automatic error handling option in LabVIEW. This will also help to eliminate most (if not all) of your sequence structures as you can use the error cluster to enforce execution order via data dependency. 
  • You are constantly opening references, but not closing them. This leads to memory leaks. Most of those Automation Open functions aren't even necessary anyway.
Message 2 of 4
(3,929 Views)
Sorry about posting it multiple times, the first time I forgot to attach the Vi and I could not find the delete post option. With respect to the top level Vi, the CamRun will be integrated into an already writen vi which controls the entire experiment set up. With respect to using clusters, how can you use one wire when there are 4 seperate connection nodes. I was trying to figure out how to close references but i could not find the funtion. Like I said, I am new to labview.
0 Kudos
Message 3 of 4
(3,917 Views)

I don't really see how CamRun_wb can be integrated into anything. It's set up as an infinite loop, and it seems designed to be a top level. Perhaps this is a prototype.

 

In terms of your question about the "1 wire". What I meant was that you would only need to have one connection terminal rather than 4. Your "SetRegion" VI would accept a cluster that is the rectangle. This cluster consists of 4 numbers (top, left, bottom, right). Use Bundle/Unbundle/Bundle By Name/Unbundle by Name to access the cluster elements. Makes for cleaner code.

 

If you haven't already done so you should go through the tutorial(s) and look over the material in the NI Developer Zone's Learning Center which provides links to other materials and other tutorials. You can also take the online courses for free.

Message 4 of 4
(3,891 Views)