From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use multiple DAQ Assistant with digital and analog signal input simultaneously for logging

Hi everyone,

 

I have been working on this and I cannot find a good example or topic related to the problem I am having.

 

My goal is to visualize digital and analog signals in real time with indicator, loggin at the same time a TDMS file and then open the log file at the end of the acquisition.

 

In version GEN v4 (Assistant): I have tried many ways but I always encounter a problem with the timing. The analog signal keeps the good timestamp but not the digital signal. I am using continuous sampling.  I have tried sample on demand but it doesn't work, the timing are all off.

 

In version GEN v5 (DAQmx): I begun working with DAQmx but I don't know how to merge the signal for logging. I am getting this error : File specified is already opened for output. NI-DAQmx requires exclusive write access.

 

I am joining my 2 vi projects so maybe someone could help me with this.

 

Thank you

 

Download All
0 Kudos
Message 1 of 11
(4,769 Views)

Hi Grabov,

 

Gen4: you lose the timing of the digital waveforms because YOU do convert from waveform to U32 array to DDT wire. Solution: Get rid of ExpressVIs and DDT wires and keep using waveforms…

 

Gen5: You try to use the very same file name for two different DAQmx tasks with enabled logging. As the error tells you this isn't allowed: one file per task!

Why do you use local variables for the filename? Why not use the control and some wires?

Why do you still use ExpressVIs in the loop? Why not use IndexArray when you want to get the elements of an array???

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 11
(4,734 Views)

Hi GerdW,

first of all, thank you for your reply!

 

About Gen4: I did the convert because I did not find any way of entering the Express VI Write to Measurment File. I know it is best to avoid Express VI, but I am new at using LabView..

 

About Gen5: I know about the error, but my question was how to merge my measurement in the same file then? It seems like I can't merge my digital task (digital type) to my analog task and then use the loggin.

I used variable for path because I initially try to use a sequence for the reading (after firsts task are over).

I will use array for the signal as you suggest me.

I will also make changes based on this for sampling

https://forums.ni.com/t5/Example-Programs/Synchronize-Correlated-Digital-Output-with-Analog-Input-Us....

Thank you again

 

 

0 Kudos
Message 3 of 11
(4,715 Views)

Hi Grabov,

 

About Gen5: I know about the error, but my question was how to merge my measurement in the same file then?

You cannot use that approach and still write all data into one file as:

- you cannot write to the file from two different DAQmx tasks

- you cannot merge digital with analog channels in one task

 

On Gen4:

check.png

This should keep the timestamps of the digital waveforms intact…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 11
(4,713 Views)

Great, I am going to try this.

 

I think it is kind of odd that we can't log two different type of signal in the same file with Daqmx... I mean isn't LabView made for data aquisition. Why this is so cumbersome?

 

Maybe merging the signals into a waveform and then output the waveform to a logging task will do the job? This might be hard job on buffering.

 

What do you think about this?

 

Thanks

0 Kudos
Message 5 of 11
(4,696 Views)

Hi Grabov,

 

I think it is kind of odd that we can't log two different type of signal in the same file with Daqmx.

No, it's not odd.

The file is a shared resource here - and two DAQmx tasks cannot access the very same file at the same time.

So there is a simple rule: one TDMS file per DAQmx task!

 

Maybe merging the signals into a waveform and then output the waveform to a logging task will do the job?

I would rather get rid of ExpressVIs and all those dark-blue DDT wires to gain control over all those data!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 11
(4,692 Views)

So I just made GEN V4 working using digital to analog waveform..

Still working on the Daqmx version without success, I get a Error -200278, reading a simple beyond. I cant figure why. I tried different ways with sequence frame without success.

 

Download All
0 Kudos
Message 7 of 11
(4,669 Views)

Hi Grabov,

 

unfortunately we still can't debug images using LabVIEW…

(You better attach VIs instead of just images!)

 

I get a Error -200278, reading a simple beyond. I cant figure why.

We can't neither as all settings are hidden in all those ExpressVIs…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 11
(4,654 Views)

Yes of course.

0 Kudos
Message 9 of 11
(4,645 Views)

Hi Grabov,

 

where exactly does the error occur?

 

- I would set atleast one of the tasks (AI) to read a fixed amount of samples per DAQmxRead call. This way you can enforce a better loop timing…

- Do you really want ElapsedTime to wait for 10 hours?

- Why do you need SplitSignal to index the elements of your waveform array? Why not use IndexArray?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 11
(4,641 Views)