Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Taking advantage of a PXI-6608 for timestamping measured counts

Hello,

I am working on a project that involves measuring edges from a photon counter and timestamping these events.  I am running LabVIEW 8.0 and have a PXI-6608.  The main requirement is there must be a user control on the front panel to input how often a measurement is taken.  I have attached a copy of what I have so far.  It works as is, but I would like to take advantage of the oscillator in the 6608 rather than using "Wait until next ms multiple" to control when the current count and timestamp are read.  I think I need to use buffered event counting, but I am stuck on how to implement it without getting the "Data was overwritten before it could be read by the system" error that I have seen.  I have been following this thread:

http://forums.ni.com/ni/board/message?board.id=40&message.id=4734

But I am still not sure what to do. 
I believe I have it set up so that the reading of the counts and timestamp are synchronized, and I am also using a producer/consumer system with a queue so that the data can be written to a file outside of the data acquisition loop.  I am open to suggestions on improving these two parts as well.

I appreciate any suggestions.

Travis
0 Kudos
Message 1 of 8
(4,846 Views)
I need to clarify one thing.  The VI I posted should be using buffered event counting, but it seems to be ignoring the source of the clock and instead updates every time the "Wait until next ms multiple" finishes.  In fact the first time I was trying this I did not have the GPS timestamping and had the clock source set to a PFI line connected to a switch, and the counts would update when I flipped the switch to 5V.  It was after I added the timestamping task that this stopped working, and that is the main problem I am working on.


Travis
0 Kudos
Message 2 of 8
(4,838 Views)
Hello Travis,

You have the right idea with the producer/consumer architecture.

What is the purpose of the GPS timestamp? You want to know exactly when the measurement is made?
As I understand from your post, you were able to get the buffered event counting without the timestamp working?
When you were referring to the "user control", do you mean you want to have the user control the sampling rate?
What were you hoping to do with the oscillator of the 6608? Please elaborate.

For more information on buffered event counter refer to the following resource:

Buffered Event Counting

I am trying to get a better understanding of what you are trying to do, so I can better offer you suggestions.

Regards,
  Sandra T.

Applications Engineer | National Instruments

0 Kudos
Message 3 of 8
(4,816 Views)
Hello Sandra,

Thank you for the reply.  The user is going to input an "integration time" which will control how long between measurements are taken.  So if they put a value of 1 here then every 1 second I want to get the current counter value for each detector, as well as a highly accurate timestamp from my GPS clock.  The timestamp and current counts need to be synchronized as best as possible.  The best idea I have is to use the 6608 to generate a pulse train to use as a clock for both the timestamping and counter reading.  I hope this better describes what I am trying to do.

Travis
0 Kudos
Message 4 of 8
(4,803 Views)
Hello Travis,

From my understanding you want to synchronize the counter task with the GPS timestamp task. You can add a sample clock to your GPS timestamp task and synchronize the two task with the sample clock. Take a look at the following example that demonstrates how to use a continuous buffered task to measure the time using a GPS Timestamp Channel and synchronize this timestamp data with an analog input task.

DAQmx: Continuous Analog Input with GPS Timestamps from the NI PXI-6008

Is this what you are looking for?

Regards,
  Sandra T.

Applications Engineer | National Instruments



0 Kudos
Message 5 of 8
(4,786 Views)
Hello Travis

I am interested in talking to you about your application since there may be a better way to go about it. Is it okay for me to look up your email address and contact you directly?

Please let me know,

Thanks,

Tica T
PXI/VXI Product Support Engineer
0 Kudos
Message 6 of 8
(4,750 Views)
Yes feel free to contact me directly.  I am working on this right now and currently I have it reading 5 photon counters and GPS timestamping each reading. I am using the 6608 also to generate a timing signal used to control the reads, and it seems to keep an accuracy of .000001 seconds, which is far far better than I had it working before using "Wait until next ms multiple". 

And thank you again Sandra, that link helped.


-Travis
0 Kudos
Message 7 of 8
(4,747 Views)
Here is program I have working right now.  I split it into sub-VIs so setting up and reading the 5 counters doesn't make the main program messy.
0 Kudos
Message 8 of 8
(4,738 Views)