Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Create AI Start using counter with .NET

I am using a system in which I am acquiring a number of analogue input channels and I wish to get accurate time information for the data samples. I will be sampling at a fixed rate using the on board clock so I just really need to find out what time the first sample was taken.

 

First of all, I do not want to use the waveform method as I prefer to acquire data in integer format to create a smaller file. Also, having scoured the discussion forums it would appear that the t0 value for a waveform is not as straightforward as it would seem.

 

One method mentioned on the forums sounds like it might be what I need – use the counter on the same card (it will probably be an M series PCI-6254) to get the information I need to calculate the time of my first sample. The method involves setting up the counter for buffered event counting with the “ai/StartTrigger” as the counter gate signal and an internal clock source for the counter source. I believe that the first counter value stored will then be the number of clock pulses between the counter being armed and the “ai/StartTrigger” switching levels.

 

Now, I understand that method and could probably have written the code to do it using the Traditional NI-DAQ functions but I am really struggling to do this in Measurement Studio using C#. Could someone please help me with the following:

 
  1. Should I be using the “CreateCountEdgesChannel()” function to create the counter channel or one of the other methods?
  2. How do I set the source to be a clock?
  3. How do I set the gate to be the “ai/StartTrigger” signal?
  4. What clocks are available to me? (I think that 20MHz will be too fast as the maximum time before the 24-bit counter will wrap around will be 0.8s – not sure about that).
 

Or perhaps there’s a simpler/better method of getting the time information?

 

Thanks for any help.

CAS
0 Kudos
Message 1 of 2
(3,558 Views)

Hi Cas,

 

I believe this forum post should be of some assistance to you - it documents how to configure the clock source and has some useful links.

 

This Knowledgebase gives links to solutions of known questions in Measurement Studio, including a section on Data Acquisition.

 

I hope these two resources help in your application.

 

Best wishes,

 

 

Mike W
Applications Engineer
National Instruments UK&Ireland
0 Kudos
Message 2 of 2
(3,521 Views)