LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2d raster scan photon counting optimization

Solved!
Go to solution

I have written a VI for a 2-D raster scan and counting TTL pulses from a photon counter at every pixel.

It seems to be working fine and is serving its purpose for the time being. However there are a couple of thing I want to improve

 

Currently, I have 2 loops, on within the other for each of the axes (x and y) for the scan. Then within the inner loop, I am counting the pulses. Now, the problem I am facing is that I have not figured out how to start the counter from 0 at every iteration. Instead, what I am doing is running the counter twice in a for loop and outputting the difference between these two iterations using shift registers.

 

What I would like to do is avoid having to count twice for each iteration. I tried the start task and stop task vi but they seem to be doing nothing. 

 

The other thing that would be nice is to avoid having the loops. I have heard that it is "expensive" to use the loops and they cause some overhead time in the program. I don't really think it is bothering me at this point but I think if I have to do faster scanning rates then it might. Currently I am scanning at >100ms per pixel. 

 

(And also, just FYI, my raster wavefrom is slightly different in that in is a "triangle"instead of sawtooth. i.e. it goes to the end of the fast axis, then starts the next line from the end rather than the beginning to avoid sudden jerks to my hardware.)

 

I have attached my VI. thanks

 

Aditi

0 Kudos
Message 1 of 14
(4,890 Views)
Solution
Accepted by IUCHEM

I cannot help with your counter issues.

 

The loops do have some overhead. It is on the order of a few nanoseconds. While loops are probably slightly slower than for loops because of the extra testing. Compared to your DAQ timing the loop time is completely negligible. Look at the test program below.

 

Since you know (or can calculate) the number of steps, for loops are probably the better choice. I think the conditional for loop is available in LV 2011.

 

You should probably move the AO Create channels VIs and associated Clear Task VIs outside the loops. Connect the task ID wires via shift register so that the value will be passed in the event someone enters start and end values which result in zero iterations of the loops.

 

Generally to speed things up you want to move any calculations and any displays (indicators) outside the loops when it can be done without adverse impact on functionality.  For example the divide by two can be moved to the outer loop; the inputs do not change within the inner loop.  If you do not need to see every update immediately, reducing the number of writes to the Intensity graph amy speed things up a bit.

 

Avoid right to left wires and wires behind other objects. These have no effect on program performance but they make it much harder to understand what is going on and to fine problems. I have attached a cleaned up version of your program.

 

Lynn

Download All
Message 2 of 14
(4,874 Views)

Hi, thanks for your reply and your improvements. You version is running well. 

I am still looking for solutions to my counter problem . Should I leave this thread open or post another question?

 

Thanks

 

Aditi

 

0 Kudos
Message 3 of 14
(4,821 Views)

Just drop a Channel property node in there.

Capture1.PNG


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 14
(4,814 Views)

Hi,

 

I am working on project where I have to make laser scan device which can scan the sample in line by line manner or raster scan.

 

For the same I am using small beam galvano mirror device from Thorlab (https://www.thorlabs.de/newgrouppage9.cfm?objectgroup_id=3770), USB DAQ 6361(National Instrument) and Labview software.

 

Galvano mirror has input range +-10V, sinewave(250Hz) or Triangular Wave(175Hz) or Sawtooth wave(175Hz) or Square Wave(100Hz). using two inputs one for X mirrror and second for Y mirror.

 

Mirror is configured to rotate 0.8V/1 Degree,

 

I have made one labview design by using that I can operate the mirror, but now I have to make graphical programme which can control the scanning of the beam through galvano mirrors on to the sample.

 

So do you know how to control the laser beam while scanning?

control the X and Y mirror analog input voltage.

 

I have attached the prepared Labview design for better understanding.

 

Thank you.

 

Download All
0 Kudos
Message 5 of 14
(4,226 Views)

This message has been crossposted 3 places.  Rather than start a new thread to create a 4th, I think that right here is the best of the 3 places to continue discussion.

 

I'll start.

 

You need a better starting point than your existing code.  It's not terrible, but there are many reasons it isn't ready to work right, and the massive diagram size makes it difficult to communicate about.

 

One such starting point would be the example code posted by John_P1 over in one of the threads where you crossposted.  It's probably worthwhile to follow and inspect the links he put there too.  Basically, anything he posts I automatically consider a good starting point for the job in question.  His track record around here is outstanding.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 6 of 14
(4,214 Views)

Hi,

 

Thank you very much for the information and reply,

 

As I am new in Labview, I am facing problems to understand the programme, also have some questions,

 

1) Where is the analog input channels to see the response of the galvano mirror?

 

2) Could you explain the two parts of the programme which I have attached?(second part and end part)

 

First part of the programme I got perfectly. 

 

 

Download All
0 Kudos
Message 7 of 14
(4,201 Views)

The example I linked corresponded to the *title* of the posting (AO to control a pair of galvos, Counter task for photon counting.) 

 

The questions you posted relate to code used to do photo counting.  Do you need to do photon counting?  Or do you just need to sync the AO galvo control with some kind of AI acquisition? 

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 8 of 14
(4,195 Views)

Hi,

 

I do not need to count the photon,

 

I just need to control the two axis galvano mirrors in a way so they can scan the sample in raster pattern.

max input range is +-10 V for both mirrors and they configure to rotate 0.8v/1 degree and input signal can be sine(250Hz) or sawtooth(175Hz) or Triangular (175Hz).

 

I have made the Vi which can operate the X and Y mirrors, but the question how to control the mirrors so they can scan the sample.

 

Yes I am looking for the solution of same kind of problem.

do you just need to sync the AO galvo control with some kind of AI acquisition? 

 

 

0 Kudos
Message 9 of 14
(4,191 Views)

I've never worked a similar app, only taken part in some discussions here related to the configuration of DAQ tasks.  So I don't really know what you mean when you say:


@mi

I have made the Vi which can operate the X and Y mirrors, but the question how to control the mirrors so they can scan the sample.


Operating and controlling sound like the same kind of thing to me, so I think you might need help from someone with more specific knowledge about raster scanning, galvos, and the applications that need such things.

 

Meanwhile, there have been a number of discussions around here about raster scanning and galvo mirror control via AO.   To get started, here are a couple I've gotten in on, but there are plenty of others that might answer even more of your questions.

AO output limit, PCIe-6363, BNC-2110

NI 6211 - running 2 AO channels simultaneously

 

 

-Kevin P

 

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 10 of 14
(4,187 Views)