Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

period measurement .NET

Hi Kenn

  Thanks for the information about the source of the ArmTrigger.

Regarding One Counter Period Measurement as specified by you in your previous posting

Route your the output of the counter you want to use to a RTSI line.  Then route from that down to each of the gates.  This should work in a one counter period measurement. Or simply connect them externally with wires.

  I have routed the counter 7 output internally to the RTSI0 . Then the RTSI 0 is routed internally to the gate of the 3 other counters . FYI : Each of the 3 counters have a One counter low frequency period measurement. The source for the 3 counters will the APD. The RTSI0 will be internally connected to the gate of the 3 counters .

 

But still I get the error specified in the previous posting. 

I get an error in the callback while reading the data .Status code -89137 . Specified route cannot be satisfied,because it requires resources that are currently in use by another route

 COChannel PulseTerminal

Dest Device ev1

Dest Terminal : ctr5gate

 Resources are used by Source Terminal : Ctr7InternalOutput  Destination Terminal :Ctr5Gate 

 

Why doesnt it work even for one counter low frequency period measurement?

Thanks

Murugan

 


 

 

0 Kudos
Message 21 of 53
(2,200 Views)
Murugan,

This is expected behavior since you are using the 3 other counters in Period measurement task already DAQmx will give priority to that counter task before the RTSI line.  The resources are being used as the error explains. You could try physically routing the signals externally or using a second card, but you would still need to route the signal externally.

Regards,

Kenn North
Principal Product Manager - Search, Digital Analytics
http://ni.com/search
0 Kudos
Message 22 of 53
(2,181 Views)
Hi
 
  I even tried routing it externally but I get weird numbers intead of event counts using one counter low frequency measurement.
 

--I have externally connected the signal generator (which simulates the APD) to PFI 19 (ctr 5 source) and routed the input externally from Ctr 5 to Ctr 2,Ctr1 and Ctr 6 source.

- Each Ctr 1,2,5, and 6 generates a one counter period measurement

//i is the number of tasks

measurementTasks[i].CIChannels.CreatePeriodChannel(inCtr, "BufferedEventCounting"+i,.000000025,53.6, CIPeriodStartingEdge.Rising, CIPeriodMeasurementMethod.LowFrequencyOneCounter,.0001, 4, CIPeriodUnits.Ticks);

- I have Ctr 7 which generates the Pulse train frequency .

gateTask.COChannels.CreatePulseChannelFrequency(

"/Dev1/Ctr7", "GateSignal", COPulseFrequencyUnits.Hertz, COPulseIdleState.Low, 0,10000, .5);

- I have externally connected  the Ctr7 output to the gate of Ctr1,Ctr2,Ctr5 and Ctr6.

- Timing for the Ctr7 is configured implicitly to get continuous sample

- Duplicate count prevention is set for Ctr1,Ctr2,Ctr5,Ctr6

- Timing is configured implicitly to get continuous sample for the rest of the Counter input

- I have aslo set one of the counters to use interrupts and others to use DMA

-I'm using an Arm StartTrigger to start the acquisition at the same time.

measurementTasks[i].Triggers.ArmStartTrigger.ConfigureDigitalEdgeTrigger(

"/Dev1/PFI0", DigitalEdgeArmStartTriggerEdge.Rising);

-Then I set the bit to true and then to false . So that all the counters read the data at the same time.

 

 The event counts I get are  809,889,888 instead 3 4 4 etc.

 So I have tried both the ways. If I internally connect through the RTSI I get the error specified in my previous post.

 If I connect it externally I get the wierd count as specified above. Please explain.

 

Thanks

Murugan

 
 
 
 
0 Kudos
Message 23 of 53
(2,177 Views)
Murugan,,

Sounds as though we are making some progress.  The only thing that doesn't work is that actual count, but the setup seems to be getting much closer.  Have you tried minimizing the number of connected counters and trying to see if we can get the correct count with fewer counters.  This may give some insight as where the problem is occurring and how we can fix it.  Also, try to connect a scope to the signal that is supposed to be counted and see if it matches either what you think it should look like or what is actually being counted.

Regards,

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

Hi Kenn

  I disconnected all the connection and tried with a single counter .

Counter 0:

-Source - APD 30 KHZ (signal generator)

-Gate - output of  Ctr6 (10 KHZ continuous pulse train)

  But still I get the same results.  I connected the signals from the source and the gate of Counter 0 to the oscilloscope and verified the signal. It appears to be correct. The count is supposed to be 2 or 3.  But using a period measurement with single counter low frequency  I get the counts to be 2667 2666 2667 2667 2666 2667 2667 2666

  I'm getting stuck with this for a long time. Any early help will be appreciated.

 

Thank you

Mullai JK

0 Kudos
Message 25 of 53
(2,151 Views)
Mullai JK,

Those numbers make sense if you assume a 20MHz timebase that is used by default if another timebase is not specified.  You need to specify the source of the counter timebase and it's rate.  The source will be the PFI line of the timebase you want to use, for example the 30kHz signal you are using and the rate will be 30kHz.  Using the CString CounterTimebaseSource you can specify the terminal and the double  CounterTimebaseRate to specify the rate should get your count right and we can go  on from there.  You will have to do this for each of your counters.


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

Hi Kenn

 Thank you very much for the quick reply.

 Your suggestion worked out . I specified the Counter time base source to counter 0 source (PFI39)  . But I didnt specify the counter time base rate as it will be unknown (APD).

 I also set the PeriodTerminal for the Counter 0 to be the output of Counter 6 /PFI12 . I got the  correct counts.

I also did the same with 6 other counters . It was able to get the correct counts.

By setting up the period terminal to be the output of the Counter 6/PFI12 to all other counters I didnt have the need to externally connect the wires to all the counter gates.

 Thanks a lot Kenn. I really appreciate your help.Now I'm able to move forward with the next step.

Thank you

Murugan

 

0 Kudos
Message 27 of 53
(2,139 Views)

Hi Kenn

 I have a quick question.

 I am acquiring the continous data asynchronously by specifiying the Available Samples Per Channel  in the BeginReadMultiSampleInt32.

 I get the AvailableSamplesPerChannel in my read call back .It acquires data first time. When I stop the acquisition and try to acquire data next time I get an error specifying

"You only can get the specified property while the task is reserved, committed or while the task is running. Reserve, commit or start the task prior to getting the property. Property: NationalInstruments.DAQmx.DaqStream.AvailableSamplesPerChannel Task Name: _unnamedTask Status Code: -200983 "

 Why do I get this error ? I dispose each task before I start teh next one.

Thanks

Murugan

0 Kudos
Message 28 of 53
(2,133 Views)
Murugan,

This is actually proof that you are disposing your task before you start the next one.  You can only access this property node while a task is running and it is telling you that you are trying to access it when it isn't running.  Make sure you call this function while the task is running.

Regards,

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

Hi Kenn

  I'm through with the error I specified in my earlier posting.

Thank you

Murugan

 

0 Kudos
Message 30 of 53
(2,126 Views)