LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Realtime A/D conversion

Hello,
I'm working on a new LabView project, and did some VI programming before, but this is the first time for me to work with the DAQmx software.
I want to sample an analog channel, check if the sampled value is above a threshold and write the result to a digital channel. The problem is to do this with a rate of 10 kHz and with 20 channels at the same time. I've already did some realtime programming, and I have the possibility to use a realtime PC system.
My questions are how to program this (parallel loops, timed loops?), how to check if the computer is really doing the trick at 10 kHz and how to do the calculations at the same time.
 
I have already read the 'Learn 10 Functions in NI-DAQmx...' tutorial, but that doesn't answer my questions. I'm using LabView 8.0 with the NI PCI 6259 boards.
 
Best regards,
0 Kudos
Message 1 of 2
(2,473 Views)
Possibly the point you have missed is that LabVIEW operates on the basis of data flow.

When the desired number of samples are available from a Data Aquisition task (DAQ aquisition), the data becomes available to the processing routine by 'flowing' from the DAQ task into your process task. It's this flow that controls the execution when you connect the data wire from the DAQ task to your processing task.

Thus is if you use the DAQ Assistant and create a task to read your channels, if there is insufficient time to read in or process the data then an error (e.g. -200279 buffer over written) will be generated and be made available at the error node. Whilst if there is available time the system will wait untill the timeout or the data becomes available.

For your task I suspect that you will need to use reasonably large data blocks for example at 10kHz perhaps transferring data as say 1000 sample blocks might be good for your computers processing configuration. Thus you would have 20 channels at 1000 samples giving a transferred data set of 20,000 samples (if they are two byte samples that's about 40k bytes of data). Now you need to finish your data processing calculations (threshold calculation)  in less than 0.1 of a second to be ready for the next set of data as with the rates and sample sets detailed there will be 10 sample sets per second. So now you can determine if your processing task can be performed in the available time period.

Unless you need some kind of guaranteed realtime response behavoir then the realtime operating system may not be necessary. Don't forget that real time only implies that a task will start at a certain time based on a given set of criteria. It does not guarantee that the data processing of a block will complete if the processing overhead is too large for the total system iteration rate.

"May the flow be with you"Smiley Wink

0 Kudos
Message 2 of 2
(2,442 Views)