Showing results for 
Search instead for 
Did you mean: 

Acceleration Data Acquisition using FPGA, FIFO and Real Time VI (cRIO-9064)

Go to solution


I am relatively new to labVIEW and I was hoping some more experienced users in this community could help me out. I am using a compactRIO data acquisition system (cRIO - 9064) with an NI 9234 card with 4 BNC channels to continuously record acceleration data from accelerometers. I am then using this acceleration data for frequency analysis after a Fast Fourier Transform.


I was able to create a labVIEW program on the real-time processor which makes use of the pre-configured scan engine to read the acceleration with a defined sampling period and stores the information in a .tdms file. However, with the scan engine, the minimum sampling period is 1 ms. Since I now have to identify higher frequencies, I need a smaller sampling period (500 microseconds for example). I believe I need to make use of the FPGA Target for this.


I have followed th tutorial  (5. LabVIEW FPGA Tutorial) on the following link to create this: 


I now have a VI under my FPGA target which acquires the data and using a FIFO, the data is passed to the Real Time VI. I am now able to set sampling periods smaller than 1ms. However, all the acceleration values are showing 0 even if the accelerometers are connected. I have checked the accelerometers with my previous program which made use of the scan engine and they are working fine. I guess that means there is a problem with the FIFO, the FPGA VI or the Real Time VI but I cannot identify the problem.


I have attached a picture of my project structure, pictures of the FIFO configuration as well as the FPGA and Real Time VI. Could anyone point out why all the acceleration values are coming out as 0?

0 Kudos
Message 1 of 5



Looking at your code I cannot see anything immediately wrong so what I suggest is that you work backwards to find the last point at which your acceleration data was available.

In your FPGA VI you can set up an indicator before and after your build array function to check the individual data channels from your module input (from the cRIO). Make sure that the data is being read and seen here.

Then check the indicator after the build array and make sure the data is available going into the FIFO.

If this data is available there then your FIFO is not configured correctly - this will be true if you place an indicator in your RT VI where the data output of your FIFO is and you read nothing.


If you let me know where your data starts being lost then we can start to look further into this.


Kind Regards,


National Instruments AE

0 Kudos
Message 2 of 5
Accepted by topic author Nirvan_Mak


Thank you very much for your reply. I have solved the problem of obtaining all zeroes. The problem was that I was not starting and stopping the acquisition in my FPGA code. This link helped me identify that problem:

(Please see attached image of the updated FPGA code).


However, I am now facing a different problem, the reshape array function which I am using in my Real Time code (please see attached image), does not seem to be correctly re-assigning the data that is being recorded from each channel. The desired output I wish to save to the tdms file is a time-history of acceleration for each channel (so four columns). However, after testing the program by only connecting an accelerometer to one channel and then changing it. I can observe that the array being generated sometimes assigns significant non-zero values to the wrong channel. Do you know why this could occur, and how it can be fixed? I believe it has to do with the timing of the code and the loop in which the array is being re-shaped but I am unsure how to calculate the correct parameter to assign to the reshape array function. 

0 Kudos
Message 3 of 5
Accepted by topic author Nirvan_Mak

Solved. The product of the two parameters of the reshape array function must equal the Number of Elements input of the FIFO.Read Invoke function.

0 Kudos
Message 4 of 5

I dont think that this is solved. I am working on a similar problem. Without setting the data rate the "Count" control doesnt work the way it is intended to be. 

0 Kudos
Message 5 of 5