Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Need Urgent Help in sample through cDAQ-9172 for my Data Aquisition

Hi,

 

This is my first time posting here, I am really would appreciate your support for my case. 

 

I have a cDAQ 9172 with a NI 9215, NI 3211, NI 9401, NI 9205. I am working on a project to have 3 Analog signals (pressure), 2 Temperature signals and speed measurment signal generated by an encoder.

 

I need to have all analog signal aquired simultaneously  using digital trigger from the encoder so that every certain degree rotation I would have set of data for all signals and speed.

 

Sampling rate for analog signals are varying, but for the time being we would consider it as 100 KS/s for all signals. 

 

can you please help me in this application?

 

Looking to hear from you soon

Thnaks

0 Kudos
Message 1 of 6
(3,854 Views)

Hi Thunder,

 

Thanks for your post and I hope your well today. Welcome to the NI Forum! 

 

So have you started programming yet? and are you new to LabVIEW?.. are you using LabVIEW should I ask 🙂 If so, what version?

 

Firstly, the cDAQ only has one Analog Input sample clock. This means all your acquisition which are analog based (temperature and pressure) have to be setup in the SAME Analog Input task.  (However rate wise, the Temperature modules don't sample at this MAX rate by design - but this won't slow down the rate your other acquisitions happen).. in different works,

 

"Since all modules inside a given cDAQ chassis share a common backplane clock (for a given type of task such as analog input), the fastest configured sample clock in your cDAQ chassis will actually be used for all modules. Any modules configured for a slower sample rate will show repeated samples; these samples can be discarded within your application."

Source: 

How to Set the Sampling Rate of the NI-9217/9219

http://digital.ni.com/public.nsf/allkb/1015F4182FB8A805862572D1006B4CC1?OpenDocument

 

Within LabVIEW there are pre-made examples of programs. You can find a list of the examples by going to Help>>Find Examples..Hardware Input/Output>>DAQmx>>...

 

The best method to synchronize your tasks based on the encoder readings would be to use the general purpose counters in the cDAQ backplane (you have two!). I would firstly have a DAQmx task to count digital events (number of pulses). Then using an output task I would generate my own sample clock for the Analog Input taks to use as their source.

 

There is a fair few complex aspects to this method, and if your new to LabVIEW I would suggest a good place to learn more is the,

Getting Start: DAQmx

http://zone.ni.com/devzone/cda/tut/p/id/5434

 

Will the encoder be rotating at the same rate once the acquisition has started? As you use the words digital trigger - was this just to start the acqusition or as the source to collect samples on?

 

If you do have some example code, then I don't mind discussing/helping you to develop it further - or if you haven't started, then I don't mind answering any questions you have (more questions you have).

 

Hope this helps, 

 

Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
Message 2 of 6
(3,846 Views)
Thank You Hillman for your reply, Actually I am new to lavbiew stuff. I just completed some basic courses at NI facility. for this reason I have not started officially my program structure. I have just built some scattered codes. My labview version is 8.5 with developer suite package. I have some points for clarification from your valuable reply: I did not understand your explanation regarding discarding the repeated samples. would this effect the other high sampling rates frequency. This means when averaging value from the repeated samples I will lose some readings from the high sapling that share the timing. Also,  in how to synchronize the signals reading, I did not get you very well in the set up exactly. So, I am kindly looking for stepwise help  procedure to set up my hardware so that I can pursue my code development easily.  The encoder will be rotating at the same rate all the time. I will be just used to trigger the data acquisition and record the position and hence the speed. I appreciate your help in this issue.  Best Regards,
0 Kudos
Message 3 of 6
(3,833 Views)

Hi Thunder,

 

Good afternoon and I hope your well today.

 

Thanks for your reply.

 

I have attached an example piece of code in LabVIEW 8.6 to help explain aspects you need to consider,

 

Main VI - DAQmx Multi AI with encoder sample clock.vi

SubVI - DAQmx Task Example_Configuration.vi

 

1. Firstly the main code setups a counter output DAQmx task to divide down the encoder pulses - say you get a pulses at 10kHz you can generate a new pulse train to clock the AI DAQmx tasks at say 10Hz (or whatever you wish). To consider the divide down you just need to alter the number of ticks high and low the counter output task is configured.

 

Note: When using the cDAQ the counter can only be accessed in slots 5 and 6. Thus the module you use to access the encoder signal must sit in slot 5 or 6.

Note: The counter pulse ticks task only uses 1 counter and therefore you still have one more general purpose counter to use for the same or another module. 

 

2. Secondly, their is a second DAQmx task for the Analog Input. As you only have one Analog Sample clock source in any one device, you must configure all the analog input tasks, even though they are of different types within the same task - and hence using the same Analog Sample Clock. If you look within the subVI - DAQmx Task Example_Configuration.vi. The sample clock source is the internal output of the counter used above to generate a clock pulse which is based on the divided encoder signal. 

 

Thus, when you run the VI you know that every time you have a AI sample, that X number of encoder pulses have been and you know they are all synchrosied. 

 

Note:

As your using the same Analog input sample clock - if you set the pulse frequency higher than a few Hz you will notice the Temperature value you update between samples. This is because the temperature modules don't update that quickly (there average a certain number of samples iternally to generate an accurate value). But, this doesn't stop you acquiring voltages (for example) at the rate you specificed with your divided down counter output.. say 100kHz. 

 

Note: 

 If you wish to just sample the encoder and the AI at 100kHz then you don't have to generate your own signal as you can directly access the 100kHz sample clock as a source. 

 

I hope this helps to get you started, and remember there are loads of example in the NI Example Finder >> Help>> Find Examples..>Hardware Input/Output>>DAQmx, and maybe try acquiring your voltages first, and then maybe just the encoder and then work on developing an entire application.

Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
Message 4 of 6
(3,818 Views)

Hi Again,

 

Thnak You for your help.

 

Actually, the attachment example could not work with my LabView version 8.5 as it ther are in 8.6. So, can I have it in diffrent version?

 

 

Also, I could not get you in your phrase"

 

Note: 

 If you wish to just sample the encoder and the AI at 100kHz then you don't have to generate your own signal as you can directly access the 100kHz sample clock as a source. "

 

 

Can you explain more please?

 

Thnaks

0 Kudos
Message 5 of 6
(3,774 Views)

Hi Thunder,

 

Good Morning and I hope your well today.

 

I have converted one of the VIs I sent you to LabVIEW 8.5. The other one is from the NI Example Finder - you need to find it. 

 

I have also attached some code I wrote for a customer trying to acquire 3 AI signals and 1 encoder signal. The code design allows you to get the top rate from the cDAQ - 100kHz. 

 

Hope this gives you some ideas, 

Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
Message 6 of 6
(3,757 Views)