Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How to realize simultaneously AI and DO?

I tried to acquire strain (using NI 9237) and several voltage input siginals (using NI 9215) while outputing counter (freqency) through NI 9401 in a task, so that I can output the same frequecy of internal clock for anolog input to control the frequency of some external event. But it couldn't go through. The error (200559) says the type of channal is not correct and Possible reason(s): Task cannot contain a channel with the specified channel type, because the task already contains channels with a different channel type.
If I need to generate the counter output to control the frequency of some external device when simultaneously doing analog data acquisition, how can I do? Is it possible that DAQmx can deal with two tasks respectively for input and output channals at the same time? Could somebody give some suggestion? Thanks!
 
Regards,
Gary
0 Kudos
Message 1 of 8
(4,185 Views)

Gary,

Several types of tasks, one of each type can be active at any given time.  The names are self documenting and include:

Analog Inputs

Analog Outputs

Digital I/O

Here is a link to a tutorial on tasks.  http://zone.ni.com/devzone/cda/tut/p/id/5374

You may also wish to study up on the Task State Model in the DAQmx documentation.  This gives a clear picture as how a task works and what is allocated when.

0 Kudos
Message 2 of 8
(4,165 Views)

Thanks a lot! I tried multitasks and it works. Can I ask one more question? How can I use the internal clock for AI sampling to output as the frequency for external event? Is there any syncronization approach to realize one data point in while one counter pulse out exactly at the same time?

Thanks again,
Gary

0 Kudos
Message 3 of 8
(4,154 Views)
I guess you should be able to route the ai/SampleClock to any PFI terminal. But did never try.

Felix
0 Kudos
Message 4 of 8
(4,151 Views)

Gary,

Have not done this myself.  Should be able to route internal clock through PFI pin.

I found this on the NI site.  http://digital.ni.com/public.nsf/allkb/3A7F1402B2A1CE7686256E93007E66C0

0 Kudos
Message 5 of 8
(4,141 Views)
Hi Gary,

The analog input and counter timebase's are all derived from one master timebase.  This means that if you start both an analog input and counter task at the same time using a start trigger you could make the assumption that they are very close to synchronized (theres different circuitry that might cause small phase delays but they might be close enough for your application).  You could also use that same counter output internally as your AI sample clock source to get it even closer.  If you want to avoid using a counter all together, I would just recommend going with the previous suggestions and route the ai sample clock to a PFI line on the 9401.

I hope this helps,
Paul C.
0 Kudos
Message 6 of 8
(4,132 Views)
Thanks for all those good suggestions. The routing seems to work out.
 
I have recently found a strange problem when I tried to access (through NI 9401) the onboard clock frequency for sampling AI data acquisition.  I used NI 9215 and  NI 9237 to respectively acquire the voltage and strain signals with on-board sampling rate.  But when I used the scope to read the designated frequency of on-board clock routed to PFI line of NI 9401, I found the reading is not the same as the prescribed value of the rate (the scope is accurate).  For example, if I input 1k Hz for onboard clock, the actual value read from scope is 3.8k Hz.   Moreover, If I remove the strain measurement sub VI from the program and only measure the voltage signal, then the frequency is same as the specified value.  So I am really confused: Is it true that NI 9237 cannot do the strain DAQ at the frequency prescribed by on-board clock? If possible how can I achieve the sampling rate of strain acquisition to be same as the one input for on-board clock (up to 50 kHz which is the limit of NI 9237)?
 
The digram and vi are attached.
 
Sincerely
Gary
Download All
0 Kudos
Message 7 of 8
(4,085 Views)
Hi Gary,

I'm not sure why you are seeing 3.8 KHz, but 1 KHz is not a valid sampling rate for the 9237.  Please see the Knowledge Base found here.  This is most likely part of the problem.  There are also some suggestions for resampling a waveform in the KB so you can take an acquired waveform and resample it to the desired speed.

Regards,
Paul C.
0 Kudos
Message 8 of 8
(4,023 Views)