Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Data Acquisition FPGA Returns#1

Solved!
Go to solution

Hi,

 

I am new to using LabView FPGA and am wokring with an NI-9239 for analog input in a cRIO-9053 chasis. As a first go at FPGA VI I just want to send data into channel 0 (from a function generator) and represent this on the screen. I've attached pics of my Host VI (on the chasis) and my FPGA VI.

 

When I run this the data doesn't make sense (supplying 1V 10Hz Sine wave), and from the Highlight Execution it shows the data as #1 which has me confused. Any help with finding the error in my code is greatly appreciated.

HighlightExecution of Host VIHighlightExecution of Host VIFPGA VIFPGA VIHost VIHost VI

0 Kudos
Message 1 of 5
(171 Views)

Do you really need to use FPGA Mode? Real-Time DAQmx Mode is way easier to use. See Take Your First Measurement in LabVIEW Real-Time (Data Logging) to get started.

 

If your goal is to learn the LabVIEW FPGA and to answer your question, you are reading a scaled fixed point data from the AI but the data got converted and pushed into the DMA FIFO as U16 integer. The easiest fix would be changing the data type of the DMA FIFO to match with the AI.

-------------------------------------------------------

Applications Engineer | TME Systems

https://tmesystems.net/

-------------------------------------------------------

https://github.com/ZhiYang-Ong
0 Kudos
Message 2 of 5
(151 Views)

Yeah my final deployment will require FPGA so I am using this first VI to learn.

 

That is a great point, I completely missed it. My FIFO now takes a signed 24 bit word length and integer length of 5 (as defined by the Mod1/AI0 block). I am still unfortunately seeing a flat signal at 0 on my waveform output. Does my method for loop timings look correct to you?

 

Also, should I do anymore conversion before sending it to the waveform output?

 

Thanks

0 Kudos
Message 3 of 5
(139 Views)
Solution
Accepted by topic author NKJDE

I just realized that you are using NI-9239. It is a DSA module and you need to tell the module to start acquisition.

Please refer to the shipping example at Help >> Find Examples... >> Hardware Input and Output >> CompactRIO >> Module Specific IO >> Analog Input >> NI-9239 Getting Started

Besides, please also refer to the host VI for the FIFO read implementation. Your current method of reading 1 sample every iteration won't work as it is not efficient and the host usually cannot run at a high loop rate.

ZYOng_0-1753837105367.png

 

-------------------------------------------------------

Applications Engineer | TME Systems

https://tmesystems.net/

-------------------------------------------------------

https://github.com/ZhiYang-Ong
0 Kudos
Message 4 of 5
(119 Views)

Thank you! My issue was certainly how many elements I was reading, I now invoke to FIFO reads, first one to find how many elements remaining, then the second picks up that number of elements.

 

Maybe not the most ideal solution, I will come back to define the element number more accurately another time. Thanks!

0 Kudos
Message 5 of 5
(111 Views)