Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I use the NI USB-6259 BNC's internal clock for digital data acquisition in my own big software?

Solved!
Go to solution

I want to integrate the ANSI C Example program ReadDigPort-ExtClk.c into my own big software package.

I want to use the NI USB-6259 BNC's internal clock (80 kHz .. 120 kHz).

 

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.

How can I use the NI USB-6259 BNC's internal clock for digital data acquisition in my own big software?
With which other subsystem on the device can I generate a clock source? How?

 

 

It is possible to define a clock on an internal counter  (e.g. "Dev1/ctr0"):
// Creates channel(s) to generate digital pulses that freq and dutyCycle define and adds the channel to the task you specify with taskHandle.
DAQmxCreateCOPulseChanFreq(taskHandle, "Dev1/ctr0", clockName, units, idleState,
        initialDelay, freq, dutyCycle); // works

But it is not possible to drive this internal clock to a terminal (e.g. "/Dev1/PFI0"):
DAQmxErrChk (DAQmxCreateCOPulseChanFreq(taskHandle, "/Dev1/PFI0", clockName, units, idleState,
    initialDelay, freq, dutyCycle); // doesn't work: DAQmx Error: Measurements: I/O type of the physical channel does not match the I/O type required for the virtual channel you are creating. Physical Channel Name: PFI0 . Virtual Channel Name: Clock


The source of the Sample Clock may be derived from an external terminal (e.g. "/Dev1/PFI0"):
// Sets the source of the Sample Clock, the rate of the Sample Clock, and the number of samples to acquire or generate.
DAQmxCfgSampClkTiming(taskHandle, "/Dev1/PFI0", maximumExpectedSamplingRate, DAQmx_Val_Rising,
        DAQmx_Val_ContSamps, bufferSize); // works. Acquire or generate samples until you stop the task

But it is not possible to derive the clock from the internal counter (e.g. "Dev1/ctr0"):
DAQmxCfgSampClkTiming(taskHandle, "Dev1/ctr0", maximumExpectedSamplingRate, DAQmx_Val_Rising,
      DAQmx_Val_ContSamps, bufferSize); // doesn't work. Error: Acquire or generate samples until you stop the task : Make sure the terminal name is valid for the specified device. Refer to Measurement & Automation Explorer for valid terminal names. Property: DAQmx_SampClk_Src Property: DAQmx_SampClk_ActiveEdgeSource Device: Dev1 Source Terminal: Dev1/ctr0

0 Kudos
Message 1 of 3
(4,533 Views)
Solution
Accepted by topic author datafriend

Hi datafriend,

 

what the help says is correct:

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.

That means if you don't want to use an external signal as clock you can use the onboard AI Sample clock or the internal counter output.

There are also 2 ANSI C Examples for this:

http://zone.ni.com/devzone/cda/epd/p/id/4485

http://zone.ni.com/devzone/cda/epd/p/id/4488

So in both cases you have to use a dummy task which you only need for the generation of the internal clock (AI or CTR)

 

Regards
DianaS
Message 2 of 3
(4,519 Views)

Hello DianaS,

 

with your hint to the examples I could solve the problem.

Thank you very much.

 

Best regards

 

datafriend

0 Kudos
Message 3 of 3
(4,454 Views)