Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

period measurement .NET

Hi Kenn

  I have given a thread sleep of few milliseconds in the Read thread so that it gives some more time for the callback to be called . This solves the Stop task problem. Thanks for your time and effort.

 

 I have another quick question. For coninuous acquisition is it ok if we specify the number of samples as specified below

BeginReadMultiSampleInt32(4500, myCallBack,

null);

But  in the Timing I have specified

task[i].Timing.ConfigureImplicit(

SampleQuantityMode.ContinuousSamples);

I have configured the buffer size ot be 10000

task[i].Stream.ConfigureInputBuffer(10000);

 I assume  it will acquire 4500 samples continuously.

Is my assumption correct? If we specify the number of samples and set the timing to be Continuous samples It soesnt mean its a finite acquisition right ?

Please confirm/explain.

Thanks

Murugan

0 Kudos
Message 41 of 53
(2,040 Views)
Murugan,

Yes whatever number you specify in your read function is how many samples it will take off the buffer each iteration.  It should still be continuous.  Are you seeing otherwise.

Regards,
Kenn North
Principal Product Manager - Search, Digital Analytics
http://ni.com/search
0 Kudos
Message 42 of 53
(2,036 Views)

Hi Kenn

 I have another question. If I change my gate frquency to 30 KHZ I get a buffer overwrite error.

 

What will be the ideal buffer size and number of samples to acquire to get away from the buffer overwrite error?

 

Thank you

Murugan

0 Kudos
Message 43 of 53
(2,015 Views)
Murugan,

This is not a cut and dry answer.  It depends on your application and speeds of your pc and other factors.  You will have to adjust the buffer size and # of samples to acquire until you no longer receive the error.

Regards,
Kenn North
Principal Product Manager - Search, Digital Analytics
http://ni.com/search
0 Kudos
Message 44 of 53
(2,010 Views)

Hi Kenn

 If the user is going to vary the gate frequency  how will the buffer size and the number of samples can be varied based on the gate frequency/sample rate? Is there a reference?

Any ideas/ suggestions

Thank you

Mururgan

 

0 Kudos
Message 45 of 53
(2,007 Views)
Murugan,

There are some other considerations to consider with this as well since the source must be faster than the source in a one counter configuration.  So allowing a user to change things will need to limited.  Be sure you really need this functionality before you allow it.

Regards,
Kenn North
Principal Product Manager - Search, Digital Analytics
http://ni.com/search
0 Kudos
Message 46 of 53
(1,995 Views)
Hi Kenn
 
   I get a buffer overwrite error if I count edges from 5 counters using 1 NIDAQ 6602 board.  I'm now going for 2 boards.So that I use DMA's for all the 5 counters instead of interrupts.
 
  Is it not enough if I change Ctr5 and Ctr6 Device name from "Dev1" to "Dev2" while creating the period measurement for Ctr5 and Ctr6
 

_tasks[i].CIChannels.CreatePeriodChannel(inCtr,

"BufferedEventCounting" + i, 1.19/*.000000025*/, 10000000.0/*53.6*/, CIPeriodStartingEdge.Rising, CIPeriodMeasurementMethod.LowFrequencyOneCounter, _measurementTime, 4, CIPeriodUnits.Ticks);

_tasks[i].CIChannels[0].CounterTimebaseSource =

"/Dev1/PFI39";(source)

_tasks[i].CIChannels[0].PeriodTerminal =

"/Dev1/PFI12"; (gate)

 I'm also using a ArmsTrigger with "/Dev1/PFI0" to synchronize the counters fo the devices.

Please let me know if I'm missing something.  I read in the discussion sites if I just specify the device name along with the pin the RTSI will internally communicate between the devices.

  Any early help will be appreciated.

 

Thanks

Murugan

 

 

 

 
 
0 Kudos
Message 47 of 53
(1,943 Views)
Murugan,

The only things to consider in this regard are to be sure you can trigger at the same time and that you can export the needed clocks over RTSI to provide any sort of synchronization.

Regards,

Kenn North
Principal Product Manager - Search, Digital Analytics
http://ni.com/search
0 Kudos
Message 48 of 53
(1,939 Views)

Hi Kenn

  Thanks for the quick response.Can you please explain more. I'm not clear .

 Q1)  Do we have to export the trigger and the clocks  ? Or is it ok if we just specify the Dev1/PFI0 terminal or DEV1/RTSI0 as terminal for the starttrigger?

Q2)  I could see that if I just change the device name alone the available sample for the counters in  the device 2 is always 0 . But when the call to EndReadMultiSample is made I get the data  from all the 5 counters from Dev1 and Dev2. It sounds wierd.

 Q3) If the ArmsStartTrigger source is "/Dev1/RTSI0" for all the 5 counters in Dev1 and Dev2 . What will be the digiatal line used to start the trigger ?

_firstTask.DOChannels.CreateChannel(

"/Dev1/port0/line0", "DigitalTrigger",ChannelLineGrouping.OneChannelForAllLines);

   

 Waiting for the reply,

Murugan.

 

    

 

 

0 Kudos
Message 49 of 53
(1,935 Views)
Murugan,

Q1)  Do we have to export the trigger and the clocks  ? Or is it ok if we just specify the Dev1/PFI0 terminal or DEV1/RTSI0 as terminal for the starttrigger?
   
    This can be a bit more complicated than my first post.  The best way to accomplish synchronization would be to PLL the internal timebase, but this can only be easily done on a PXI chassis, otherwise you would have to implement your own PLL to sync your timebases between your  boards.  As far the trigger goes just connect your trigger to PFI o of each card and trigger each task off of it.  They will start at the same time.

Q2)  I could see that if I just change the device name alone the available sample for the counters in  the device 2 is always 0 . But when the call to EndReadMultiSample is made I get the data  from all the 5 counters from Dev1 and Dev2. It sounds wierd.

    This is a bit confusing, I'm not sure what you are saying here.  But, you will need two seperate tasks to accomplish this application.  One for each device.  There are only certain devices that can use one task and multiple devices.

Q3) If the ArmsStartTrigger source is "/Dev1/RTSI0" for all the 5 counters in Dev1 and Dev2 . What will be the digiatal line used to start the trigger ?
    _firstTask.DOChannels.CreateChannel(
"/Dev1/port0/line0", "DigitalTrigger",ChannelLineGrouping.OneChannelForAllLines);

       You should be able to just use the same signal for both devices and specify the trigger in each task and that's it.

Regards,
Kenn North
Principal Product Manager - Search, Digital Analytics
http://ni.com/search
0 Kudos
Message 50 of 53
(1,931 Views)