2d raster scan photon counting optimizati​on

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
Attachments:
Galvo_Scan_Image 5.vi ‏92 KB

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
Attachments:
Loop times.vi ‏12 KB
Galvo_Scan_Image 5.2.vi ‏74 KB

Similar Messages

  • Counter issues with 2D raster scan and count acquisitio​n

    I am building a confocal laser scanning microscope and am currently attempting to develop labview controls for it. I have a fast steering mirror (FSM) which takes analog voltage inputs to control it's x and y angle and I have an avalanche photo diode (APD) which sends a TTL pulse for each photon detection event. For now, I am trying to create a program which will send out two analog signals to create a 2d raster scan with the FSM and count the number of pulses from the APD per pixel. I have been trying to make the program from https://decibel.ni.com/content/docs/DOC-5779 work, but I keep running into counter issues. I am using a generated pulse train from the other counter on my device (NI 6011E) as the period.term input, but I get a "Two consecutive input signals occurred without a counter timebase edge" error if I increase the frequency of the pulse train too high. Unfortunately, the number of pixels I can acquire seems to be limited to twice the frequency of the counter, so I cannot just use a lower frequency train. I believe that the error is occurring because the count rate from the APD is very low and that there are simply no photons hitting the detector in the time period between pulses.This is not a problem, but I would like to know how to simply record a 0 and continue with the scan, rather than have the entire program exit with an error.
    Alternatively, if this does not seem like the correct way to accomplish what I am trying to do, I am open to new directions.

    So simply ignoring the error did not work, because the DAQmx subroutine stops collection when the error is detected. I think I may need to come up with a different approach to synchronize the counting of TTL pulses with an analog output. Attached below is the code I have been working with.
    Attachments:
    Raster_2DOutput_wCounter_82.vi ‏45 KB

  • Raster scanning application

    Hi
    I have a PCI 6711 board with analog outputs and two digital inputs and a clock. I need to set up a simple raster scannig application on a microscope: move (0-10V) two axes and acquire a digital signal (TTL). I have written a double loop in LabView but I  do not understand how to syncronize the input (digital) with the output (analogic). Does anyone know of demo example on such an application as raster scanning? Typically used also in industrial applications.
    many thanks
    Giberto

    Hi, i have a pci 6711 and I have to make the same project of Chirico, with 1us ~ for a pixel. 
    I have tried the second example but some problem occur, I have to use an external clock for future setup compatibility; I wire my external clock in pfi4 and my signal to ctr0; the result is confusing, I can change the ctr0 frequency (for now is wired to a pulse generator) but the pulse is unchanged, if I change my external clock I can observe a change. 
    If I understand correctly I use ci input term as gate, with a 20mhz timebase, if I wire ao out clock to CI input term I count how many signal I have in a pixel time; my signal have to change if I change the pixel time (change external clock pfi4) or signal frequency (ctr0).  
    I'm stuck.
    Thanks for your help. 

  • Sr 400 photon counter (stanford research system)

    hi,
    i need help regarding sr400 two channel gated photon counter(SRS)
    my problem is:
    i open getting start wizard ,it shows.
    hardware presence verified
    software  "        ''          ' '
    interface sequential verified
    upto here it is ok .but when i goto max and open NI488.2 communicator and write string in send string(*IDN?), IT GIVE ERROR
    iberr=EABO
    i tried the same with interactive control and when i write
    GPIB0: ibwrt" *idn?"
    it gives
    [c100] <errtimo cmpl>
    error: EABO
    count : 0
    so can u plz tell how to tackle that problem.
    thanks

    You need to understand the difference between the GPIB bus commands and instrument commands. You seemed to have looked at the basic example that's in the manual. The first line in the example does some things to the GPIB bus's interface management lines like interface clear (IFC) and remote enable (REN). You do not issue these commands in MAX's communicator when you want to program the instrument. Those sort of commands are available but you don't normally have to do any of that. You do need to issue the commands that are listed in the section on remote programming. The very first example listed is the command "CM". As the manual states, if you send CM {j} where {j} is 0-3, you set the counter mode. If you send just "CM", the instrument returns the counting mode. You will not get a response back from the instrument when you set something. You will only get data back from the instrument when you issue a specific command that tells the instrument to return something. Instruments designed within the last 20 years have better command sets than what you have to work with. These "newer" instruments use a "?" at the end of every command that tell the instrument to return data.
    Before you do much more, I would recomend that you do a little studying on the GPIB bus. There are some tutorials and app notes at : http://zone.ni.com/devzone/devzone.nsf/webcategories/3992D796622FADB1862567BD006DBD98.

  • SR 400 gated photon counter

    I don't have a ton of experience with Labview, but I'm trying to get the Stanford Research Systems SR400 gated photon counter to use a fixed gate mode to count.  I looked at the example driver that I found and realized that it isn't capable of doing anything more than a cw sweep.  I found this driver in the forums (http://forums.ni.com/attachments/ni/40/1879/1/sub​vI.vi), but in the process of updating to labview 8.2 (from labview 7.1 it said), it is missing some connections somewhere.  I was wondering if anyone knew how to find the problem pieces in it and how to fix it.  I have another question about the SR400.  Is labview capable of trigging it through the software, or do I need to have an actual physical trigger going in to the trigger input.  Thanks for your help.
    JOn

    Hey Jon,
    I'm unsure if the SR400 is able to trigger externally, but if in the manual for the SR400, you're able to find the command for it, you should be able to easily implement it. If it's GPIB communication, just open labVIEW, and go to Help->Find Examples->and Search for GPIB, and you should find a nice example called "labVIEW<->GPIB.vi". If it's serial communicaiton, just search "Serial" and you should be able to find a nice example called "Basic Serial Write and Read.vi". Just copy the triggering command if it's found in the manual into the write field, and you should have no problem implementing it. I like these two examples a lot, because they're easy to build from.
    Regards,
    Nick D.

  • Unwanted drift in my 2d raster scan image

    My program will give two analog output signals (one is a triangle output voltage and other is  step voltage) to the two physical channels of NI DAQmx Analog Output block. By these two voltage; it will perform a 2D raster scan using a scanning stage. Now; during each scanning point; it will acquire input signal from the detector. And then it will generate a text image by reading voltage at each sample point. Though my program is working, but
    there is a drift(shows an incline line rather than a straight line) appears during the scan when I scan a straight line.
    I’ve attached you two scattering images; one was a scanning of a straight line. But the scattering image was showing a drift. And other image is single nanoparticle scattering where also you can see the drift in the point spread function (focal spot). I've also attached a screen shot of the block diagram of my program.
    I just can't solve this drift.
    What I'm doing is to try to recode the same code of an old version (labview 5) into a new version (2010).
    I'm not an expert in Labview and need an urgent help regarding this issue.
    Software Details: LabVIEW Base Development System  version 2010 SP1
    NI Hardware:  Multifunction DAQ (MIO) device PCIE-6363
    Driver Version :
    Operating System:  Windows 7
    Customer Information
    Arif Moinuddin Siddiquee
    swinburne university of technology
    Attachments:
    Drift image.jpg ‏29 KB
    scattering_784nm_pulsed_vertical_1p4mW_740V_50um_300sample points.jpg ‏70 KB
    block diagram.jpg ‏2409 KB

    Hi Taylor
    Yes, these channels are on the same device.
    Can you please suggest me what I should do to start and stop the task at the same time!
    I've attached the codes for you.
    Thanks
    Attachments:
    CSOM_arif_ben_peter_dru.vi ‏79 KB
    compute_waveform.vi ‏20 KB

  • 6310 / 7310 Scanned Page Count?

    We're using the HP6310 and HP7310 All-In-Ones for some of our field personnel and in a couple of cases we're having problems with the ADF rollers and, sometimes, tray breaking down more quickly, we think, than it should.
    I can't find any way to do a scanned page count on either of the machines.  Am I missing something?  And if not, if there is no built-in way to do a scanned page count, is there any sort of software solution that might make it possible (either through HP or some sort of independent software), or a higher-end All-in-One that does provide a scanned page count?

    I am working on a parser that was written several years ago by someone else. The only information that is required is the page count. I am adding new conditions to the pattern searches which rely on regular expressions. I know a text search is not possible if there is no unencrypted page tree to search for. My hope is that there is some way to automate 1)passing the pdf from unix to a windows workstation, 2) opening the pdf and resaving it (thus converting it to a linearized document), and 3) restaging the pdf on unix to be reprocessed (which would successfully find the page count within the "Linearized" object entry/tag.

  • PCI6602 to detect TTL output from single photon counter

    Dear all,
    I am learning how to use Labview.
    Here is the system I try to set up.
    1.   Single photon counting module, 2.5v TTL output, 20MHz light source
    2. BNC-2121 block
    3. PCI6602
    4. Labview 7.0, NI-DAQmx
    The aim of this system is to counts the number of the detected photons from the light source.
    I have problem to start this task. Can you guys help to creat a sample which i can start from?  
    Your help will be greatly appreciated.
    Frankie

    Hi Frankie,
    I would suggest using the NI-DAQmx counter shipping examples to get
    started.  The Count Digital Events VI would be a good starting
    point. 
    You can open it through:
     Help >>
    Find Examples >>
    Hardware Input and Output >>
    DAQmx >>
    Counter Measurements >>
    Count Digital Events >>
    Count Digital Events.
    Hope this helps!
    Micaela N
    National Instruments

  • NI 6259 photon counter min pulse detection

    Hello,
    I have a PCI 6259 DAQ card which I'm using as a counter. Is there a limit to the minimum pulse width it can count while operating as a counter? My photon counter gives out TTL pulses with widths of 50ns which I think is below what the counter can read unless I am mistaken. I'm using the 100kHz internal clock as the clock source. Is there anyway to get the counter to pick up such small pulses?
    Would the NI PCI 6120 DAQ card be a better choice for this type of measurement? I should be able to get my hands on one shortly.
    Thanks for your time,
    Mark.
    Solved!
    Go to Solution.

    A 50 ns pulse corresponds to a 20 MHz freq.  You should be able to capture/measure such a TTL pulse with a 6259, but I don't think you'll really want to be measuring pulse *widths*.   You'd only be able to get a nominal count of 4 timebase edges per width with a possible +/- 1 count uncertainty, i.e., 25% measurement error.
    More likely, you'd either want to:
            1. measure the period/frequency of successive rising edges of these 50 ns pulses, effectively timestamping every detected photon.   Brief fast bursts of photons may produce an unrecoverable FIFO error.   A newer X-series device with a bigger counter FIFO would be a better choice if this is an issue.
    OR
            2. perform "binning" by counting the # of these 50 ns pulses that occur during equal time intervals.   Here you are pretty immunce to brief bursts of photons, but you need to sustain long-term throughput over the PCI bus.  You're probably pretty safe sampling at <= 100 kHz or so, but if you need better precision on the bins & thus faster sustained throughput, I'd again recommend a PCIe X-series board. 
       You might also have to watch out for a feature known as "Duplicate Count Prevention" which could impact your measurement data if you ever have 0 photons in a given interval.  The faster you sample, the more likely this is to come up.
    -Kevin P

  • Photon counting

    Hi i am setting up a fluorescence correlation spectroscopy (FCS) experiment based on a home made confocal microscope coupled to a single avalanche photodiode (SAPD Perkin Elmer) that is able to count photon by delivering TTL pulses (2.5 V, 9 ns). To perform FCS or single molecule FRET experiment analysis I need to record photon count during several minutes. We have installed a PCIe 6361 with a connector box. I am a newbie in the labview "world" and I tried to record photon flux by using the attached vi. as you will see it is not really optimized in term of speed acquisition. it works well if i record 1 000 000 points with 1µs time resolution. unfortunatly for ma purpose it is definitively not enough moreover the NI card is a able to run 100Mhz.
    would it be possible to use some tricks ? like FIFO mode or a sliding buffer ?
    many thanks for your help.
    regards
    Attachments:
    essai_1.vi ‏26 KB

    Dear John,
    thanks for
    your answer. I apologize; I did not give enough information in my post. If
    fact, in our experiment the count rate is at maximum 1 MHz, moreover the APD is
    saturated when the count rate reach 10 MHz. Basically we perform two kind of
    experiments; in the FCS scheme, the photon flux is recorded and we have an
    algorithm that is computing the autocorrelation of the fluorescence signal. As
    you can see on the picture, we typically need a microsecond resolution on a
    time scale that covers several orders of magnitude. In this case we need to
    record the flux with µs resolution for let says 1 minute. I am wondering if it
    is possible instead of counting the photon to record the arrival time of the
    photon. Indeed when the count rate is low (10-50 kHz) we will have zero values
    most of the time so it is maybe more clever to record arrival time …. The
    second kind of experiment is the energy transfer scheme in which we monitor the
    interaction between two biomolecules by using two fluorophores. A laser is
    exciting the first one (donor) and if the second one (acceptor) is at less than
    10 nm you will observe an energy transfer from the donor to the acceptor. It is
    hugely used in biology to evidence molecular interaction. In this case you need
    to record with the detectors the fluorescence signal for several minutes with a
    time resolution of 1-100 µs. Again the size of the file can be very big.
    I hope this
    will help you in your answer.
    Regards,
    pascal

  • Device for photon counting system

    Hi
    I want  to design a photon counter for my optical measurement (very low intesnity). I need experiences of design and advice to choose a suitable  counter : low rate to high rate (up to 100M counts /sec), little dead time..., TLL input. I was told about such a PCI counter card.
    Thanks

    Hi hanh,
    The PCI counter/timer board that matches the specifications you have given would be the PCI-6602. You can find more detail about it in the NI 660x Specifications. The 100 counts/sec would be possible but you will have to use the prescaler. More information on this process can he found in this article which also has links to examples. Take a look at this device and see if it matches what you need.
    Regards,
    Kent
    Applications Engineer
    Digital Multimeter Home

  • Photon Counting with an Oscilloscope

    I am faily new to LabView, and I am trying to emulate a photon counter
    with a digital oscilloscope for determining fluorescence lifetimes. So
    far, the program downloads the waveform from the scope and determines
    the arrival time of each peak above the discriminator/threshold. But, I
    cannot figure out how to sum the counts for each time bin - ie add and
    store a count for each value in the "locations" array, and then store
    all the counts into a histogram. Any help is greatly appreciated.
    Attachments:
    Photon Counter.vi ‏247 KB

    The Replace array subset does nothing with an empty array. Do you fill the Total Counts array with the right number of elements before running the VI? I modified the VI to initialize the array with the number of elements in the peak location array. I also set the for loop to autoindex on the locations array and removed most of the coercion dots. Without any data I cannot test.
    To give us some data, run a sample of some data and Make the Current value default on the Current Waveform graph. Then remove the Instrument IO Assistant and convert the Current Waveform graph to a control. Save the modified VI and post it.
    Lynn
    Attachments:
    Photon Counter.2.vi ‏231 KB

  • Are AI single scan and counter control wait incompatible??

    System: LabVIEW RT on 8175 controller with 6052E PXI DAQ card. LabVIEW 6.1 on Win 2000 as the development environment.
    I have an application requiring GPS synchronized hardware loop timing for the time critical thread. The loop controls a variety of functions including analog output, simple event counting and analog inputs from several channels. Analog output and counter sub-vis work great in this type of loop.
    However, implementing AI single scan in a loop using counter control wait disrupts the loop timing counter. The loop completes only one iteration and then generates a timeout error. The attached vi represents a simple implementation that I think should work, but doesn't. Can anyone tell m
    e what I'm doing wrong?? I haven't yet located any specific information on this topic in the discussion forum.
    Thanks.
    Attachments:
    CntrCntrl_AI_LoopTest.vi ‏100 KB

    Thanks for your comments. Unfortunately, I can't open your attachment since it's version 7 and I only have version 6.1. But I know what you're saying.
    I'd really like to know why the test vi I submitted doesn't work. It crashes my system every time with a timeout error on the counter. Remove the AI single scan node and the loop runs fine. And of course, AI single scan works fine in a different loop using something like "wait till next ms multiple" timing. But when I put the two together they crash.
    I didn't mention much about the GPS sync, but you're correct that I'm using a disciplined 10 kHz pulse signal from my GPS timecode generator as the source for the loop control counter. I also have a 6608 counter card with a real time clock synched to I
    RIG-B providing timestamps for each loop iteration. Besides AI, other tasks which must occur within the loop are setting an analog output and reading/resetting an event counter. Everything except the AI works fine.
    I suppose I can use the same pulse train driving the loop timing for the AI scan clock. I'll give that a try and see what happens. It's just that the AI single scan seemed like an easier implementation.
    Maybe someone at NI can tell me why the AI and counter wait aren't working?? Do I have a hardware/driver problem or is this a fundamental incompatibility??
    Thanks again.

  • Need quick help, please!!! How do I scan the counter and analog channel in parallel, synchronized?

    Hi,
    I'm using LabView6.1 and a PCI6014 DAQ card.
    I have to scan simultaneously an analog channel and the counter on the card. My project requires me to measure in parallel a force (a voltage on an analog channel) in correspondence to a distance (measured with a counter) and I have to display a force-distance graph.
    So, can someone please tell me how can I program the counter and an analog channel to take 1000 measurements in parallel, and then, by reading the buffers to have two sets of corresponding measurements?
    I've tried some things and I've got only an error message, that says that there is no free DMA channel available (the error comes from configuring
    the analog channel). I attached one of these programs that gives this error, maybe somebody can tell me what I do wrong.
    If somebody could send me an example (in LabView6, I have no 7 :-( ), I would be grateful.
    Thank you,
    pixooxiq
    Attachments:
    Scan_Test_4.vi ‏177 KB

    Hi pixooxiq,
    unfortunately, your Card has only one DMA-Channel.
    If you want to use two Channels simutaneously, you have to tell one of them to use an Interrupt instead.
    This option can be set with the "Set DAQ Device Information.VI"
    Just see the Bitmap, I've attached.
    Perhaps, you now get Performance-problems, cause the IRQ does not directly write the Data but involves the CPU. In this case the only possibillity is to use an other card with more than 1 DMA-Channel...
    Regards
    Peter Weber
    NI Germany
    Attachments:
    Interrupt2.bmp ‏159 KB

  • Photon Counting on 6321

    I am attempting to count photons from 2 photomultiplier tubes (PMT) using Labview. I currently have written a program which will count from a single PMT. I was wondering if the manor in which I wrote the program will reliably count up to 1 MHz, which I believe the card can do, and if it is the best way to write this code. I am relatively new to LabView (esspecially counting).
    The program is designed to take a count every 10 - 100 ms and store them for analysis later. I will at somepoint require a program like this to run for up to an hour. It would also be nice if the counter reset evertime instead of reporting the summation of the counts.
    Using labview 2012.
    Thank you,
    A
    Attachments:
    Simple Count.vi ‏89 KB

    Your 6321 has a max samplerate of 250kSPS , so if you need to measure your pulse energy and assuming 5 samples per pulse you can go up to 50kHz ....
    (less since it's statistic)
    And you will need some pulse shaping .... (a 7 step RC,OP buffer chain? )
    Since it is a multiplexing card, make shure that your pulse shaping circuit has a low output impedance (more 1Ohm than 50Ohm and close to the DAQ)  (take a look at the settling time error in the spec)
    Crosstalk between the channels need to be investigated.
    Look at the examples about DAQ streaming TDMS data to file.
    Think about a producer-consumer architekture. One loop is reading (producer) and one loop is saving (consumer 1) and two more loops take copied slices of the data to make online monitoring ...
    If you just want to count the pulses, you can use the internal counter, up to 1Mhz shouldn't be a problem (again a fast pulse chaper, comparator needed)
    Greetings from Germany
    Henrik
    LV since v3.1
    “ground” is a convenient fantasy
    '˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'

Maybe you are looking for

  • Is there any way to receive Google Talk messages in the iPhone Messages (meaning the text messaging app)?

    I want to know if there's any way to receive incoming Google Talk messages in the iPhone Messages app? What I mean by this is the app your receive text messages in. The reason I ask is because in the new "Messages" app for the Mac, you can include yo

  • XI 7.0 - PI 7.1 EHP1

    Hi, we are going to upgrade XI 7.0 to PI 7.1 EHP1 We need to create a XML file and download additional SP'S But in MOPZ I see only Maintenance button, not Upgrade as in case of ERP upgrade. Anyone has experience with that ?

  • T 40 Yellow DC-in block on the system board part number

    The DC conncector mounted on the system brd where the AC Adapter connects to the laptop. Does anybody know the part number for that. It is a failure I see in many of the t40 series laptop but I have not been able to locate a part number. It does not

  • How to access storage link?!?

    Hello All, Well, I'm trying to access the storage link option on my WRT600N router without any luck!! i would really appreciate this if someone could tell me how to do it from the first step (choosing partition-should it be one letter only?-->display

  • Cant see uploaded info on web

    updating of my site in cs6 failing. dreamweaver indicates that i have updated but when i check the browse still the same old info. i have configured the servers with passwords but i just cant see updated info