Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronize pci-6254 and cDAQ-9174

Solved!
Go to solution

Dear All,

I hope that you are having fun!!Smiley Happy

 

I intend to synchronize two cDAQ-9174 chassis for an application where I need to acquire data from 8-Thermocouple, 3-Voltage, 1-Full Bridge (Strain gauge) and 2-counter channel at the same time. This application measurement is encoder based (quadrature with 1024 ticks per revolution) and I need to acquire very fast and synchronized data from all channels!!

 

I have bought the hardware and am going to configure 3-Voltage channels in NI-9221, 4-Thermocouples in NI-9211, 1-Strain gauge in NI-9237 and 2-counter in NI-9401 Modules of first cDAQ-9174 chassis. I will then put rest of the 4-Thermocouples in the Second cDAQ-9174 chassis.

 

The question is if it is going to work?

 

If yes! Then kindly help me on how to have synchronized data from these two cDAQ-9174 chassis with all the modules as mentioned above??

I hope that some one can help me on this and can guide me to do this task!! I am using Labview 2009 with NI-DAQmx 2009

Kind regards!

Tajim!

   

0 Kudos
Message 1 of 9
(6,214 Views)

Hello everyone!

Sorry for the typing errors in the title of this thread!! I wanted to synchronize two cDAQ-9174 chassis!!

I hope to have a prompt reply!!

Regards!

Tajim

0 Kudos
Message 2 of 9
(6,192 Views)

The short answer is to export the AI sample clock from the chassis with the NI 9237 to the other one over the NI 9401s and select that as your sample clock source for another task containing the the NI 9211s on the other chassis.

 

The long answer is that it is a bit more complicated depending on exactly what kind of synchronization you are looking for.

 

First, let's take a look at your analog input modules.  You are using the NI 9211, NI 9221 and NI 9237. The NI 9237 has a small set of discreet sample rates (50k/1..31).  The NI 9211's max rate is lower than the slowest rate of the NI 9237.  You have two options.  Option one is to run the NI 9211 at the same rate as the NI 9237 and receive repeated data (the NI 9211 will return new data as soon as it can).  Option two is to run the NI 9211 in a separate task at a slower rate.  You can synchronize the start easily enough.  The NI 9221 shouldn't be an issue.

 

Second, you want to export your sample clock to the other chassis.  If you are using option 1, you would use the sample clock as the sample clock source for your task in the second chassis.  If you are using option 2, you would use the sample clock as your start trigger.  You do not want to use the start trigger of a task with a NI 9237 as the start trigger for another task because you'll have a sample period of jitter.

 

The final difficulty is using the NI 9401s for both input (your encoder) and output (the sample clock).  The NI 9401 is nibble configurable which means that you can have 8 lines of input, 4 lines of input and 4 lines of output, or 8 lines of output but you must set the direction before using any of the lines.  You can get around this by using DAQmx Control Task to reserve all of your tasks before starting any of them.  The one thing I'm not sure about is how you want to synchronize the encoder task with the analog acquisition.  If you could expand on that I can help.

 

Let's see what that would look like.

 

Two chassis sync.JPG

 

You'll need to start the second task before the first, so you don't miss a sample clock.  I showed the reserve step, but not the encoder tasks.  What they look like depends on how you want to use them, but you need to call reserve on them, and task 1 before calling start on either.

Message 3 of 9
(6,179 Views)

Dear MarkGrot!!

I hope that you are doing fine!!

Please apologize me for replying late! I hope you will not mind it!!

Thank you very much for your reply. I have to say that I am not able to completely understand it as I have just started learning about cDAQ-9174 functioning with its modules!

I have some question and hoping that you (or anyone) could help !!

 

Q1:  How can I apply your short solution of **to export the AI sample clock from the chassis with the NI 9237 to the other one over the NI 9401s and select that as your sample clock source for another   

        task containing the the NI 9211s on the other chassis**??

        What do I need to do?? Does this solution require any physical connection of the two modules?? I mean, a physical wire connection??

 

Q2:  Why is it tricky to use this NI-9237 with other modules???

 

Q3:  **Option two is to run the NI 9211 in a separate task at a slower rate.  You can synchronize the start easily enough.** 

        Could this be done by using the same start task.VI ???

 

Q4: **how you want to synchronize the encoder task with the analog acquisition**

       I am running a Slider-Crank application where I have to acquire force, contact and temperature of the surfaces as a function of crank position (angle). For this, I am using an encoder to read the angular  

       displacement of the crank by configuring two counters in Labview program. Counter 0 is giving me the degree wise position of the crank and Counter 1 is given me the number of revolutions.

       I then have  configured three tasks in this program where Counter 0 is task one, counter 1 is task two and all other AI signals are configured as a task three.

       When I run the program, It first start the AI task and then start the counter tasks at the same time.

       This program started crashing when I switched to cDAQ-9178 but it was running perfect in M-series card with all the AI and Counter signals but it

 

I hope to have your help!

Regards!

Tajim

 

 

0 Kudos
Message 4 of 9
(6,135 Views)

Q1:  Yes, you need a physicial wire connecting the chassis to share a sample clock.  In the sample code I posted, the master chassis exports its sample clock to a a PFI line on the NI 9401.  You need to wire this line to the NI 9401 on the other chassis.  I put comments that specify where you select which line to export to and where to import from.

 

Q2:   The NI 9237 can be a little tricky.  First, it has an input delay of 38.4/fs + 4.8us (see the manual).  This means you need to shift your data if you want to correlate it with other signals.  Second is the limited number of discrete sample rates which I mentioned above.  Finally, the sample clock timebase for the module is sourced by the module itself, not the chassis.  Normally this isn't an issue at all unless you are trying to synchronize start triggers from multiple tasks.  These are characteristics of the ADC and not limited to the NI 9237.  I mention them because they are common issues when using the NI 9237 for the first time and are more likely in your use case.

 

Q3:   No, you wouldn't use the same start vi.  In the example code I posted, I created two tasks which shared a sample clock.  If you go with Option 2, your second task will use a start trigger (there are many examples of this).  This means that each chassis will generate its own sample clock but you can arrange it so both start at the same time.  Because you are using the NI 9237, you want to use the AI sample clock as your start trigger source (normally you would either use some external signal or share the start trigger from the first task).  In the example code I posted, task 1 would not change.  In task 2, do not specify a sample clock source to the timing vi.   Instead, configure a start trigger for digital edge using the signal you are going to import with your NI 9401.  Again there are many good examples that ship with DAQmx that explain how to use a start trigger.

 

Q4:  It's been a while since I've done much with counters.  I believe you should be able to configure an arm start trigger similarly to how you are configuring your second analog input task.

 

This is a little tricky because you are synchronizing multiple devices but the end result should be very similar to what you have seen with an M-Series card.

 

You said your program crashes.  How?

Message 5 of 9
(6,118 Views)

Dear Mark!

Thank you very much for your support and prompt replies!!

What I meant by program crashing is that this program does not respond if I use cDAQ2Mod3/PFI0 line (or any other sample clock) as a sample clock for my all AI signals which was not the case with M-series. I am attaching a block diagram picture of my code which was working perfect with M-series card as I mentioned in my previous message.

Further, the program works okay upon selecting sample clock of NI-9237 (cDAQ2Mod4/ai/SampleClock) as a sample clock of all AI-signals. But!! I do not see my AI-signals changing as I expect them to be changed!! I mean there is no relation between the physical motion of the slider-crank mechanism and signal changing in Labview (see the front panel diagram)!!

Once again Thanks for listening!!

Regards!

Tajim

0 Kudos
Message 6 of 9
(6,100 Views)
Solution
Accepted by topic author tajim

A few comments after looking at your code:

 

I don't understand what you are doing with the unreserve in the counter task.

 

Are you trying to use the encoder as your sample clock?  You can do that for the NI 9221 and NI 9211, but it will not work with the NI 9237 as I mentioned above.  You could move the NI 9237 into a separate task and from there you have some options depending on how you want to synchronize.

 

How often do you expect to get your clock on cDAQ2Mod3/PFI0?

Message 7 of 9
(6,072 Views)

Hello Mark!

I hope that you are doing fine!

Well! I was trying option one of your suggested solution in order to synchronize the acquisition. I used the reserve VI so that I could do counter and clock events on NI-9401. It did not work and I  had removed this reserve VI from the program. Upon running the program without reserve VI, I have started getting an error message for counter tasks saying that *resources you are trying to access are reserved by another task* . I then used this unreserve VI in the program (attached image in my previous message) and did not get this error message for counter tasks.

Yes!! I am using one of encoder out put as a clock for my data acquisition. This encoder has a resolution of 1024 pulses per revolution of the crank therefore all my data acquisition is sampled by this cDAQ2Mod3/PFI0. Also, I am acquiring data as fast as possible and continuous since there will 1024 ticks from this encoder per revolution and I need to run my experiments for 100 cycles!!

I hope I have answered you queries!!

After this discussion, I am thinking to go back to M-series DAQ system and will then try to use and synchronize cDAQ-9174 chassis with two thermocouple NI-9211 modules!! What do you say about this system!! Will it work since I have excluded this NI-9237???

Also, could you please guide me on how to export this clock signal Dev1/PFI0 (encoder input) from M-series card to this NI-9401 inserted in cDAQ-9174 chassis??

Looking forward to hear from you!!

Have a nice week end!

Regards!

Tajim

0 Kudos
Message 8 of 9
(6,047 Views)

Hello guys,

I am using cDAQ 9178 and I am using digital IO module 9401. I am trying to measure pulses from a flow meter sensor. The output of the sensor is basically pulses.

My question is how can I use labview to measure the number of these pulses from the flow rate meter?

 

Thank you for your help.

 

 

0 Kudos
Message 9 of 9
(5,513 Views)