ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Combining/Synchronizing Digital and Analog Data

Hi Everyone!

 

I am using a NI 9189 with the NI9205 and NI9425 to measure analog and digital data respectively. 

What I want to do is create an array with both the analog value and digital data. The problem I am having is the I am doing NChannels NSamples for the Analog Read Task and NChannels 1Sample for the digital task. Due to this difference, when I concatenate the arrays it only shows the digital state once per loop iteration. I want them synchronized. Does anyone know how to fix this?  I tried messing around with NChannels NSamples with the digital task, but I was having difficulty. 

 

Any help would be appreciated!

1234.PNG

 

C56.PNG

 

0 Kudos
Message 1 of 3
(2,815 Views)

So I just found this example online, but I am still having problems. It errors saying DAQmx read does not match the type of channels in the task. 

 

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019PBVSA2&l=en-US

 

error.PNGbuh.PNG

 

 

0 Kudos
Message 2 of 3
(2,800 Views)

I don't have experience with Compact DAQ, but have used USB and PXI DAQ devices.  What happens if you write a routine that does just one of these?  Does Analog alone work?  Does Digital alone work?  If both work stand-alone, then the problem is combining them.

 

When I've configured DAQ input, I always wired the Number of Samples in the Timing function (rather than assume a default).  I also wired this to the Read function (to force it to read all of the points) -- I never used -1 (and so far haven't had a problem doing this).

 

So do some experiments, see precisely where the error is occurring, and see if specifying # of samples and using the same value for the Timing and the Reads helps.

 

Bob Schor

0 Kudos
Message 3 of 3
(2,793 Views)