Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

NI 9239 - Measure analog input in LabVIEW FPGA

Hi,

 

I would like to measure voltage using a NI 9239 with my CompactRIO 9074 in LabVIEW FPGA. While everything works perfectly when I'm using LabVIEW in Scan Interface mode, the indicators always show '0' when the VI is loaded and running in LabVIEW FPGA. However, I can generate a voltage using NI 9264, use the digital I/O, and run a VHDL program without issue.

 

I followed this example, but the output is always '0' instead of 3.28 in my case. (fixed point data)

 

http://www.ni.com/tutorial/14532/fr/#toc3

 

Sam

0 Kudos
Message 1 of 6
(5,015 Views)

There should be a "Start" signal that you set to TRUE.  I had the same issue with the 9234.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 6
(5,011 Views)

Oh, so these modules require the use of the START and STOP properties in LabVIEW FPGA. I'll try this solution in a few hours.

 

Thanks for the quick reply.

0 Kudos
Message 3 of 6
(5,001 Views)

Not exactly properties.  They are actually IO for the module (just like the Analog Inputs).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 6
(4,988 Views)

Thanks a lot. I used the example VI present in LabVIEW, and I now understand how does the module works. I've adapted the VI to measure the voltage of two of the four outputs available with the NI 9239. I have 2 VI. The FPGA VI, which reads the values of the Analog Inputs and stores them into a FPGA FIFO, and the Host VI, which reads these values and presents them in a graph.

 

I would like to use a VHDL code in order to multiply these inputs in the FPGA VI. Let's take A (AI0) and B (AI1) for inputs, and S as the ouput. I already wrote the VHDL program, but I'm not sure how to integrate my program as I'm not familiar with the use of the Single-Cycle Timed Loop [SCTL]. If I use the "IP Integration" method, can the VHDL program access the values of the FPGA I/O inside the SCTL? How do I store the value of S (result of the multiplication) in a FIFO (like I did with the analog inputs) if the program, thus the output is in a SCTL? If the loop is running without interuption, I can't access the output value outside of the loop.

 

Is the CLIP a better method in this case?

 

Thanks for helping me.

Download All
0 Kudos
Message 5 of 6
(4,914 Views)

Hi

 

I managed to solve my issue by using the CLIP method instead of the IP Integration one. CLIP seems to be the best option for accessing FPGA I/O. My VHDL code is runnig, but I have one issue. Like I said, I wanted to do a multiplication in VHDL between 2 inputs of the NI 9239. 

 

If AI0 equals 3.2465 and AI1 equals 10.121, the result should be 32.8578. In my case, the result is 30, which means that my code doesn't take into account what's after the dot. Is this something related to my VHDL code? Am I missing something? I tried modifying the indicators properties to display the number under the right format (fixed point), but the result is always 30. Does LabVIEW support fixed point when you use a VHDL code? I read that fixed point data are read as a vector (std_logic_vector).

 

 

0 Kudos
Message 6 of 6
(4,813 Views)