09-28-2010 04:52 AM - edited 09-28-2010 04:53 AM
VB code:
' Add a counter input channel to the 6601 task.
' DAQmxErrChk DAQmxCreateCICountEdgesChan(taskHandle_6601, "Dev2/ctr0", "" , DAQmx_Val_Edge1_Rising, 0, DAQmx_Val_CountDirection1_CountUp)
'
' 'set the source timebase of 6601
' DAQmxErrChk DAQmxSetCICountEdgesTerm(taskHandle_6601, "Dev2/ctr0", "20MHzTimebase")
'
' 'set the sample clock of 6601
' DAQmxErrChk DAQmxCfgSampClkTiming(taskHandle_6601, "/Dev2/PFI38", 20000#, DAQmx_Val_Rising, DAQmx_Val_AcquisitionType_ContSamps, 1000)
C# code:
counterReadTask.CIChannels.CreateCountEdgesChannel(counterComboBox.Text, "", edgeType, Convert.ToInt64(initialCountTextBox.Text), countDirection);
'set the source timebase of 6601
how to transfer this line ???
counterReadTask.Timing.ConfigureSampleClock(sampleClockTextBox.Text,
Convert.ToDouble(rateTextBox.Text), SampleClockActiveEdge.Rising,
SampleQuantityMode.ContinuousSamples, 1000);
thank you very much!
Solved! Go to Solution.
09-29-2010 02:12 AM
Please refer to the explanation of this parameter:
public string CounterTimebaseSource { set; get; }
Member of NationalInstruments.DAQmx.CIChannel
Summary:
Specifies the terminal of the timebase to use for the counter.
Exceptions:
NationalInstruments.DAQmx.DaqException: The NI-DAQmx driver returned an error.
This is a property configuration for DAQ counter task.
NI Application Engineer
Ben
09-29-2010 03:05 AM
hi ben, thank you for your reply.
I have tried it, but it doesn't work.
my code :
counterReadTask.CIChannels.CreateCountEdgesChannel(counterComboBox.Text, "", edgeType, Convert.ToInt64(initialCountTextBox.Text), countDirection);
counterReadTask.CIChannels.All.CounterTimebaseSource = "20MHzTimebase";
counterReadTask.Timing.ConfigureSampleClock(sampleClockTextBox.Text,Convert.ToDouble(rateTextBox.Text), SampleClockActiveEdge.Rising,SampleQuantityMode.ContinuousSamples, 1000);
result:
09-29-2010 03:15 AM - edited 09-29-2010 03:16 AM
counter card: PCI-6601
task: Buffered Event Counting (6601user manual P3-11-P3-12)Figure 3-12. Buffered Event Counting
gete: Dev2/PFI38 source:20MHzTimebase
hope you can give me a example code, thank you
09-29-2010 03:16 AM
This property value is not supported. You can change the timebase source.
NI Application Engineer
Ben
09-29-2010 03:35 AM
Ben
the VB code which I have given above can run correctly.
so, that means there must be a way to use 20MHzTimebase as timebase source, right?
I think you can help me to solve it
09-29-2010 04:19 AM
I have solve it
CountEdgesTerminal =20MHztimebase
thank you Ben