LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

spectrometer control

Hi!

I'm making a program to control a spectrometer. In few words, I have to apply a certain voltage to the spectrometer. I do that by sending the voltage value trough a 12bit number into a DAC. After I send that voltage I will gather the counts from the spectrometer, using a counter. It will collect the data for a specific amout of time. Then, I decrease the voltage and repeat the cycle. The problem is that, I want to collect data in 10ms interval or, in the worst cenario, 20 or 25ms. I dont know what more I can do to optimize my code so, if someone can help me, I would appreciate a lot. The program is not 100% functional, I have an option to make X scans before it stops, and its not working very well yet, but the important thing is the optimization...

Sorry for my english and thanks in advance.
0 Kudos
Message 1 of 5
(3,375 Views)
To optimise your application, you could start by using an event structure. You may want to view the execution of your code in debugging mode and than ask yourself the question whether it's really doing what you want it to do.

regards,
Marcel
0 Kudos
Message 2 of 5
(3,369 Views)
One obvious thing would be to get rid of all those local variables. Every time you use one, it makes a copy of the data. Use shift registers. You could also try calling the counter start task only once instead of with every iteration of the loop.
0 Kudos
Message 3 of 5
(3,363 Views)
Hi!

The counter start task only runs once when I press the aquisition button. I think there's no problem, but I will put it outside. You're right about local variables but, the problem is, I dont know how to use shift registers. I've tried to use it but I don't know how. For example, in sequence 0 of the inner stacked sequence I use the local variable "Current Voltage". That value is changed in sequence 2 of the stacked sequence. For this particular example, how can I use shift registers?

Thanks
0 Kudos
Message 4 of 5
(3,361 Views)

I can't modify your VI right now but here's an illustration of a simple shift register with a stacked sequence structure. You could simplify things by eliminating the sequence structures completely and just use dataflow. This wouldn't make the VI run any faster but it would make it easier to view and update.

0 Kudos
Message 5 of 5
(3,339 Views)