Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Adding analogue inputs to a logging task with digital inputs

Solved!
Go to solution

Hi,

 

I have been using digital inputs on a USB-6343 and using a task running with python nidaqmx. Now I want to add analogue ins but I can't because you can't mix line types. I could use a second task for analogue data, but I call configure_logging to record my digital data and if I did that for the the analogue data it would presumably produce a data file that is not in sync.

 

Is there any good way of synchronizing the two, or do I just need to rewire and recode the digital lines so they are analogue ins? Or is there something else to do in this situation?

 

Thanks,

Tristan

0 Kudos
Message 1 of 7
(1,273 Views)
Solution
Accepted by topic author tristan256

I don't know any of the Python DAQmx syntax.  Is "configure_logging" a DAQmx function that automatically logs your task's data to a .tdms file?

 

If so, then you don't need to worry about the file(s).  Your main *real* issue is to sync the hardware.  You can do that by sharing a sample clock.  For example, configure the new analog task in a normal way but configure the digital task to use something like "/Dev1/ai/SampleClock" as its own sample clock.  Then be sure to start the digital task before starting the analog (so it's ready to receive the 1st sample clock signal and be sync'ed in hardware to the analog samples).

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy coming to an end (finally!). Permanent license pricing remains WIP. Tread carefully.
Message 2 of 7
(1,229 Views)

Thanks Kevin, I believe I have it working by setting the source parameter as follows:

 

di_task.timing.cfg_samp_clk_timing(rate=daq_sf,
source="ai/SampleClock",
active_edge=nidaqmx.constants.Edge.RISING,
sample_mode=nidaqmx.constants.AcquisitionType.CONTINUOUS)

I will have to do some testing to confirm but it seems to be correct. 

0 Kudos
Message 3 of 7
(1,221 Views)

Do I have to run the digital task with the analogue task or can it be the other way around?

0 Kudos
Message 4 of 7
(1,155 Views)

Unsure what you mean.  It isn't about with vs. without.   It's about before vs. after.

 

The code section you posted shows that you configured your DI task to "borrow" a sample clock from the AI task.  With this configuration, it's important to start the DI task *before* starting the AI task.  That way the DI task is armed and ready to do its sampling before the AI task starts producing a sample clock signal.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy coming to an end (finally!). Permanent license pricing remains WIP. Tread carefully.
0 Kudos
Message 5 of 7
(1,151 Views)

Sorry that was a mistake, I meant 'before'. Or more precisely, can the AI task use the DI clock, rather than the DI task having to use the AI clock?

0 Kudos
Message 6 of 7
(1,148 Views)

From what I understand, all X-series devices (63xx, as far as I know) allow you to derive a sample clock internally for DI and DO tasks.  Previous generations (M-series, others) required digital tasks to borrow a shared sample clock from elsewhere, such as an AI or AO task.

 

So, with your X-series device, I *believe* you can go either way.  Either DI or AI can configure their clock independently, and then either AI or DI can borrow it (and be started *first*).

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy coming to an end (finally!). Permanent license pricing remains WIP. Tread carefully.
Message 7 of 7
(1,145 Views)