Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

cDAQ 9178 sync between NI9403 and NI9222

Hello everyone,

 

I come to you with the following problem/question:

I have a cDAQ-9178 chassis equipped with an NI9403 DIO module and an NI9222 analog input module.

On the 9403 module I measure the output of an digital encoder (on the first 14 bits, the rest are free) and on the 9222 module I measure a back EMF voltage.

For this I have defined two separate tasks in NI-MAX, both at a sampling rate of 10kHz.

After I started the measurement I observed that the encoder signal of 9403 module has a start delay of ~26ms compared with voltage of 9222. Also, between the acquired samples on both modules, I have a delay of ~57us. Increasing the sampling rate, both delays are increased.

How can I synchronize the data read by both NI card?

Please be aware that I do not have any Labview software beside NI-MAX and I am not familiar at all with the Labview software and for data visualization I use some Vector tools (CANape) that supports cDAQ devices.

 

Thank you!   

 

0 Kudos
Message 1 of 7
(1,909 Views)

Hi,

 

According with National Instruments support page, if you have only NI-MAX software, there is not possible to synchronize two ore more tasks.

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000P8b6SAC&l=de-DE

For this you have to use Labview software.

 

As a temporary solution, after starting the measurement, I send to both cards,to the MSB of NI9304 and ai3 channel of NI9222, an external 3v3 sync pulse before starting my test maneuver. This is how I know that starting from the pulse I can software manipulate(python) the acquired signals and synchronize them.

 

I'm not 100% sure if this is the right way but seems to work for me until now.

0 Kudos
Message 2 of 7
(1,826 Views)

Careful, that KB article may *emphasize* that LabVIEW would make sync possible, but it does not state that *only* LabVIEW can do it.  And in fact, many people have sync'ed up DAQmx tasks using C-family languages, Matlab, python, and more.

 

I don't typically define tasks in MAX so I may be out of date on some MAX features and capabilities.  But both the linked article and my own (limited) experience tell me that MAX only lets you test out 1 task at a time.  How exactly are you doing 2, even if not explicitly sync'ed?

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 3 of 7
(1,818 Views)

Hi Kevin,

 

You are right, the info in the KB link states that MAX lets you handle only a task at a time. Although, it seems that I can create at least 2 task and run them in the same time. Maybe I have a wrong understanding of what a MAX task means.

Please see the attached picture where you can see both defined tasks. One for the digital input from the encoder(BEI_Encoder) and one for the voltages(AI).

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

That screenshot shows 1 AI task that contains many AI channels.  On the left panel, only the AI task is selected.  On the right panel is a list of AI channels configured to be part of the 1 AI task.  The graph seems to show AI channel data. 

 

There's nothing there to suggest that the Encoder task is running at the same time, and I'm still inclined to think it can't.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 5 of 7
(1,799 Views)

I have to admit that the previous attached picture was not the most relevant in this situation. I'll attach a two new pics where you can clearly see that I started both task and they are running in the same time.  In the AI task you can see the bench speed of 10rpm and in the Encoder one some activity on the digital channels.

 

Thanks.

Download All
0 Kudos
Message 6 of 7
(1,781 Views)

Not trying to be merely pedantic, but those are 2 distinct screenshots, where each one appears to show 1 task running.  It isn't clear that they're running simultaneously.

 

But I'll take your word for it -- perhaps these are 2 distinct MAX windows running simultaneously, with window-based screenshots?   I wasn't aware this was possible, but just tried it and found that I could open 2 distinct MAX windows.  (MAX 20.0 after installing the LV 2020 Community Edition, DAQmx still at 18.5 so I can support work projects based on LV 2016).

 

I pretty much always set up DAQ tasks from scratch using code.  I don't know that I could troubleshoot your observations and methods when doing things only from within MAX.

 

Since you mentioned python, I'd suggest you do some further searching for python-specific information.  I've occasionally hopped in on threads where people have been doing more raw DAQ programming from within python using the DAQmx API for python.

 

I think you'll be able to sync your tasks with a common start trigger, and after that you also need to be a little careful that the way your read data from the tasks keeps the retrieved data in sync.  It isn't hard to get it right, but it also isn't hard to get it wrong.  There's really no way for me to know how MAX alone is dealing with all this stuff, raw code provides the possibility of more explicit control.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 7 of 7
(1,773 Views)