How can I use the NI USB-6259 BNC for digital data generation, sampled with the internal clock, with my own C program software?
I want to use the NI USB-6259 BNC to generate digital data, sampled with the internal clock (80 kHz .. 120 kHz). I want to extend my Microsoft Visual Studio 2005 C++ control program.
I have checked the examples 4672 and 4673. They describe only data acquisition, not data generation.
Furthermore I tried the following:
1. DAQmxErrChk(DAQmxCfgSampClkTiming(taskHandleDigitalOut, "/Dev1/Ctr0InternalOutput", maximumExpectedSamplingRate,
DAQmx_Val_Rising, DAQmx_Val_ContSamps, bufferSize));
result:
DAQmx Error: Measurements: Generation cannot be started, because the output buffer is empty.
Before starting a buffered generation, write data. Unreserving a task empties the buffer. Changing the size
of the buffer or setting the Regeneration Mode property will result in the buffer being unreserved and emptied.
Task Name: _unnamedTask<1>
Status Code: -200462
2. DAQmxErrChk(DAQmxCfgBurstHandshakingTimingExportClock(taskHandleDigitalOut, DAQmx_Val_FiniteSamps,\
bufferSize, outputSampleClkRate, "/Dev1/PFI4", DAQmx_Val_ActiveHigh, DAQmx_Val_Low, DAQmx_Val_ActiveHigh));
or
DAQmxErrChk(DAQmxCfgBurstHandshakingTimingExportClock(taskHandleDigitalOut, DAQmx_Val_ContSamps,\
bufferSize, outputSampleClkRate, "/Dev1/PFI4", DAQmx_Val_ActiveHigh, DAQmx_Val_Low, DAQmx_Val_ActiveHigh));
result:
DAQmx Error: Measurements: Requested value is not a supported value for this property.
Property: DAQmx_SampTimingType
You Have Requested: DAQmx_Val_BurstHandshake
You Can Select: DAQmx_Val_SampClk, DAQmx_Val_OnDemand, DAQmx_Val_ChangeDetection
3. DAQmxErrChk(DAQmxCfgPipelinedSampClkTiming(taskHandleDigitalOut, "", outputSampleClkRate,\
DAQmx_Val_Rising, DAQmx_Val_ContSamps, sampsPerChanToGenerate));
result:
DAQmx Error: Measurements: Requested value is not a supported value for this property.
Property: DAQmx_SampTimingType
You Have Requested: DAQmx_Val_PipelinedSampClk
You Can Select: DAQmx_Val_SampClk, DAQmx_Val_OnDemand, DAQmx_Val_ChangeDetection
In document:
High-Speed M Series Multifunction DAQ for USB - 16-Bit, up to 1.25 MS/s, Integrated BNC Connectivity
is written:
DO or DI Sample Clock source: Any PFI, RTSI, AI Sample or Convert Clock, AO Sample Clock, Ctr n Internal Output, and many other signals
The digital subsystem does not have its own dedicated internal timing engine. Therefore, a sample clock must be provided from another subsystem on the device or an external source.
It is possible to define a clock on an internal counter (e.g. "Dev1/ctr0") and sample data with the internal clock:
DAQmxErrChk(DAQmxCreateCOPulseChanFreq(taskHandleCounter, "Dev1/ctr0","", DAQmx_Val_Hz, DAQmx_Val_Low,
initialDelay, _internalSamplingFreq, dutyCycle));
// Sets only the number of samples to acquire or generate without specifying timing.
DAQmxErrChk(DAQmxCfgImplicitTiming(taskHandleCounter, DAQmx_Val_ContSamps, bufferSize));
//Configures the task to start acquiring or generating samples on a rising or falling edge of a digital signal.
DAQmxErrChk (DAQmxCfgDigEdgeStartTrig(taskHandleCounter, "/Dev1/PFI0", DAQmx_Val_Rising));
// Sets the source of the Sample Clock, the rate of the Sample Clock, and the number of samples to acquire or generate.
DAQmxErrChk(DAQmxCfgSampClkTiming(taskHandleDigitalIn, "/Dev1/Ctr0InternalOutput", maximumExpectedSamplingRate,
DAQmx_Val_Rising, DAQmx_Val_ContSamps, bufferSize));
/*********************************************/
// DAQmx Start Code
/*********************************************/
DAQmxErrChk(DAQmxStartTask(taskHandleDigitalIn));
DAQmxErrChk(DAQmxStartTask(taskHandleCounter));
/*********************************************/
// DAQmx Read Code
/*********************************************/
// Reads multiple 32-bit integer samples from a task that contains one or more digital input channels.
DAQmxErrChk (DAQmxReadDigitalU32(taskHandleDigitalIn, numSampsPerChanToRead, timeout, DAQmx_Val_GroupByChannel,
acquiredData, RECEIVEARRAY_SIZE_IN_SAMPLES, &sampsRead, NULL));
With which function can I connect the internal clock with the data generation?
Kind regards
datafriend