Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

real time continuous dual analog voltage input daq with processing

hey all...
really sorry to be a total noob about this.
 
switched from measurement computing to NI daq card... should be easier right.
 
i intend to sample 2 voltage signals simultaneously at 20 samples/sec and process them real time (yknow, to check if they are within appropriate range and do some a little bit of math to turn off the daq when appropriate.)
 
i tried using the ni daq assistant in continuous mode... simply hooked up a daq assitant to an indicator and used a power supply to check how the sampling would work... worked okay but when i manually set the sample rate to 20 samples/sec i got the following error
 
Some or all of the samples requested have not yet been acquired.
To wait for the samples to become available use a longer read timeout or read later in your program. To make the samples available sooner, increase the sample rate. If your task uses a start trigger,  make sure that your start trigger is configured correctly. It is also possible that you configured the task for external timing, and no clock was supplied. If this is the case, supply an external clock.
Property: RelativeTo
Corresponding Value: Current Read Position
Property: Offset
Corresponding Value:

Task Name: _unnamedTask<18>
 
how do i ensure that i am sampling at 20samples/sec (which is not very demanding at all) ... should i stick to continuous mode and add a wait until next multiple of 50 ms (in which case i cant guarantee ill be doing 20 ... need to know interval between samples for numerical integration)
 
OR
 
should i goto single sample mode and run it in a while loop with a wait until next multiple of 50ms... here again i am not guaranteed it will only happen every 50ms ... also this seems foolish and there must be a prepackaged way to get around something so elementary.
 
please help... any input would be truly appreciated
 
thanks
 
lalmalani
------------
labview 8
NI 6008 daq card
0 Kudos
Message 1 of 11
(3,902 Views)

What kind of real time processing are you doing? maybe it is causing a overhead on acquisition ( may be not , but nevertheless worth checking)

Do post your VI or a pic of your block diagram so that we can suggest better.

Also go to examples and find a vi called 'continous Voltage acquisition(int scan clk).vi', save a copy of this VI in any other location and modify it to suit your requirement.

Continous acq mode will work fine, so doing a timed acquisiton with a single sample mode with a programmable time delay would not be an ideal solution for this case

0 Kudos
Message 2 of 11
(3,879 Views)
here is the block diagram
 
among other things,
 
1) should the stop control goto the DAQ assistant instead
2) i have set the daq assistant in continuous mode with sampling rate of 20 samples /sec but it still expected me to fill up no. of samples... how do i continuously scan till im done
3) in the daq assistant i have set up voltage input at 2 ports... how do i access the voltage of the second port there is no data 2 node even when i drag down the daq assistant vi to expand the no. of connections.
0 Kudos
Message 3 of 11
(3,866 Views)
0 Kudos
Message 4 of 11
(3,858 Views)
Hi
 
Find my answers in line with your questions
 
1) should the stop control goto the DAQ assistant instead
 
No, it is fine/correct
 
2) i have set the daq assistant in continuous mode with sampling rate of 20 samples /sec but it still expected me to fill up no. of samples... how do i continuously scan till im done
 
Number of samples tells the read function, how many samples must be retrieved from AI buffer in each iteration of the loop. So, enter its value  as 20 itself, no hasseles
 
3) in the daq assistant i have set up voltage input at 2 ports... how do i access the voltage of the second port there is no data 2 node even when i drag down the daq assistant vi to expand the no. of connections
 
Go to signal manipulations tools in Function tools on block diagram>>'split signal' function, it is a drag down function, one input is split into its component signals. Drag down this function for two split signals and you can display the data 1 and data 2.
 
Also, you have a quite a bit of on-line processing of data happening here ( a 'for' loop that runs for 20?? iterations) through it superficially does not seem like a very heavy overhead for a sampling rate of 20 samples\sec, it is a burden on the acquisition process.
See if you can keep it offline.
Also i feel that the processing that you are doing in the 'for' loop is wrong. The reason, you are performing 20 calculations on the same value, instead of 20 discrete values that you had acquired in DAQ express in that iteration.
 
again go to signal manipulations tools, here you will find a function that converts the signeal read using DAQ express to an array of voltage values ( sorry I do not recall that function's name)
 
And finally, as I said in previous post, do explore the possibillity of building your VI using DAQ mx functions ( refer to an example VI) instead of using a DAQ express VI, it is a much moe effecient approach
 
Hope this helps
Regards
 
Dev
 
0 Kudos
Message 5 of 11
(3,858 Views)
if i set 20 samples, would the while loop repeat after every 20 samples.
 
also,
the for loop is to run for every individual value of voltage (such is the model i am using)... i suppose instead of using a for loop i could create an array of constants and multiply them with the voltage value, do the calculations... and then take the mean of the array.. would that simplify it.
 
the function is probably one of those dynamic-to-double types... will look into building daq from scratch
 
thanks a ton
 
0 Kudos
Message 6 of 11
(3,844 Views)
in what sense do you mean offline processing...
0 Kudos
Message 7 of 11
(3,835 Views)

THANKS FOR ALL THE HELP

ive taken care of all the angles... now im just left wondering if the samples are truly taken at precise intervals of 50ms

0 Kudos
Message 8 of 11
(3,831 Views)

Be assured that they will be

Or do this simple test to ascertain this.

Feed a 1Hz sinusoidal signal ( of amplitude ideally 1V) and observe the values that you record

You will be able to acquire / View a fairly clear sine wave.

Regards

Dev

0 Kudos
Message 9 of 11
(3,827 Views)
thanks a ton...
 
is there any source (book/site) you recommend for learning labview from scratch (icluding all the daqmx VIs and stuff like that)... i dont want to have to rely on sample codes forever
0 Kudos
Message 10 of 11
(3,823 Views)