LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

real time aquisition of digital and analog inputs with 6133 S

Hi, I am

pretty new using Labview and also labview RT. I have the pxi 6133 S  board and with this board I want to aquire 6
analog channels (  3 Input Voltage and 3
reference voltage) and 3 digital inputs. I also need a sampling rate of at
least 1 Mhz, for both, analog and digital input. We choosed a RT system because
we need to aquire the signals continuously and process them very fast.  I already did a program, which runs but where
I’m not sure if I lose some data. It is very important not to lose any of the
incoming data. One additional thing : with the conditions of the three digital
inputs I can distinguish which signal I aquire. So I have 3 analog input
channels. With the 8 possible conditions from the digital input I can say that
all 3 analog input channels belong to element 1 til 8. For example d/io 0 is 0 ,d/io
1 is 0 and d/io 2 is 1, so in total I will get number  4 ( U32). This tells me that the data I acquired
at that time belonged to element 4. I tried to read the 1D array which comes
from the digital DAQmx and for every condition to do a case structure, but I’m
not sure if the solution is fine and if I might lose some data. Does anyone  has some other ideas?? I appreciate any help I
can get!

elh


0 Kudos
Message 1 of 3
(2,646 Views)

Hi elh,

I have looked through your code and have found that you read samples every 20ms in your high priority timed loop. However, the DAQmx timing you set (500kS/s, 1000S) requires a loop time of 2ms (1/500 s). Do you change the timing values during runtime? If the loop is timed correctly I do not see any reason for data loss. Have you encountered any problems so far?

 

The other thing that you should consider changing is displaying the data. It is typically not wise to display data on an RT VI front panel. This will cost you performance and should always be done on the host VI (see NI example finder, example RT Network Communication).

 

Hope this helps.

 

Best regards,

Peter

--
Peter A.
Field Sales Engineer, NI Germany
Message 2 of 3
(2,607 Views)

Hi Peter, I have a question about the Rt Fifos. I aquire with my Card 6 Analog Voltage values and 3 digital inputs. Fot both I have a Sample clock Frequency of 1Mhz, for both analog and digital input. For my time crital loop I have a dt of 20 ms, which means that for every loop I should get 20000 samples from each channel. With the DAQmx Analog 2D DBL Nchannels Nsamples I should get a 2D array of 6 cahnnels x 20000 samples. The same is also with my digital inputs, but for this a have a 1D array, because I selected one channel for all lines . When I looked how big both arrays were, I was surprised  because instead of beeing 20000 samples, the array number always changed. Always bigger that 20000. And also for both digital and anlog differently. I thought I might happen, because at my DAQmx I put a number of -1 for  number of samples, which means that it reads the complete buffer. But why is there a difference between the digital and analog amount of samples? The programm is made to simultaniously aquire both digital and analog inputs.

Nest question I have: After the aquisition the data is transfered to a shared variable with a RT fIfo with 2000 elements. Because I read that a RT Fifo cann't be a 2D array, I split the 2D array in 1D array, and made so for every channel a shared variable. What means if I have a RT Fifo of 2000 elements? If I have aquired 25000 samples, means that the samples are saved in blocks of 2000 elements, so in this case I would get 12 blocks with 2000 elements and one block with 1000 elements? Is it right?? What happens when I have different amount of samples for the digital and analog inputs? My analog input are coded with the 3 digital inputs. That means that reading my digital values which can be 0 till 7,  the values which I get at analog channel 0 comes from 8 diffent stages. So evreything has to be simultanious. If not than I can not assign the right value to the right status.

I also was quite surprised, because I when I aquire samples from all 6 analog channels and  split them to get a 1D array for each channel, sometimes later during aquisition the channel switch. So instead of presenting me ch0 I see ch1 and instead of ch1, ch2 and so on!! And in the Fifo ist the same is also saved! And that fatal for my assigment Has someone already had similar problems?? here is also my new vi! I know it not advised to display data in the time crital loop, but I just wanted to see my raw data, before puting it in the fifo. One more question: What is better to use, a RT Fifo or a shared variable with an RT FIFO. I couldn't find any difference!

Best regards, Elh

0 Kudos
Message 3 of 3
(2,591 Views)