Real-Time Measurement and Control

Showing results for 
Search instead for 
Did you mean: 

Photon Count on LabVIEW FPGA


I am new to LabVIEW and FPGAs, and I have a assignment where I need to do photon counter on LabVEIW to collect counts from APDs. In my lab, I have a NI USB-7856R Module. I would appreciate any initial guidance or ideas since I am very new. I visited/read several LabVIEW forums about FPGAs, but I didn't learn much of them. 



0 Kudos
Message 1 of 13

I'm not sure you actually need an FPGA. It sounds like a regular multifunction DAQ device would work and would probably be a little easier to develop. Still, if that's all you have, maybe start here?


Do you have your signal conditioning well defined? If your signals are coming in really fast you might be able to connect it to a digital input and just detect transitions from false to true or vice versa. Otherwise, if it's slow enough, you can probably just set a threshold voltage and count how many times the voltage goes over or below that threshold.

0 Kudos
Message 2 of 13

Thank you for your reply! 


I know the signal is a TTL pulse where I am required to pick it up on my Module (NI USB-7856R). I have attached a vi that is clearly wrong and missing things, but I gave it a shot. 


I am still new to this, but I know that I will have to use this LabVIEW FPGA Module that will be connected to APDs to pick up signals (1 for signal, 0 for nothing).

0 Kudos
Message 3 of 13

Actually you look like you aren't too far off. You need to maintain a count on the FPGA which should look like this code:

FPGA Event Counter.png


All your other code can run on the general purpose computer. For example:

GP Counter.png

0 Kudos
Message 4 of 13

Better would be to have the FPGA reset the loop counter on the rising edge as well.  You should also only update the indicator on the rising edge.  So a case structure should be used 

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 13

Thank you so much for your reply. Could you explain the second vi for me? What is the counters box and all the other components? 



0 Kudos
Message 6 of 13

The counters box is a read write control node. Its job is to transfer the value that's on the FPGA to the general purpose computer. Events is the number of times the FPGA went from false to true. Stamp is the number of fpga loops that have occurred. We're subtracting so that we compare how many events and how many clock cycles have occurred since 100 ms ago. Then we divide events by seconds to get events per second.. You can use the context help to hover over any other functions you're not clear on.

0 Kudos
Message 7 of 13

Thank you so much for your help. I have one thing remaining which is adding a time stamp for the counts and binning the data. Would you be able to help me with this? 

0 Kudos
Message 8 of 13

I'm not clear on the requirement. You want to record a timestamp for every event? Isn't that potentially a huge amount of data?

0 Kudos
Message 9 of 13

Yes, that will be a huge amount of data, but our scans are very short (micro seconds). 

0 Kudos
Message 10 of 13