Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Does the NI-9239 really have an 800us delay?

I'm working on a benchtop setup for a controls project using a cRIO, a custom driver board interfacing with some digital I/O modules for PWM output, and an analog input module NI-9239 which reads in the process variable from a sensor on the plant. It's an unstable system and the controller needs to be pretty snappy. I'm measuring ~6us computation delays, which is probably acceptable.

 

The problem comes in that I'm seeing a ~1ms difference between the real value of the process variable and the value the FPGA code seems to be seeing! This is determined from oscilloscope measurements, not just internal to the FPGA. If I set the controller to purely proportional, when the input is 0V the FPGA should output a 50% PWM as fast as it can react. From the plots I'm generating within the FPGA all seems to be behaving correctly, but when I put it on a scope I see that the 50% PWM moment is about 1ms behind the zero that it is supposed to correspond with. I've done a ton of timing measurements in the FPGA code and I can't account for more than about 20us of delay.

 

Here's a scope capture that hopefully illustrates the problem. Process variable is pink (measured right at the input to the NI-9239 module); PWM output is blue; vertical orange line marks 50% PWM. Controller was purely proportional for this measurement.

scope_33.png

 

I believe the last potential source of this huge delay I have not eliminated is the NI-9239 analog input module itself. That is, it seems that by the time the data is received by the FPGA it is already about 1ms old. Looking at the datasheet, there is an equation given for "Input Delay":

unnamed.png

They don't give any definition of the term or context. It's unclear whether the first number is intended to be read as a mixed number (implicit addition) or as implicit multiplication. Assuming it's a mixed number and using fs=50k, the input delay would be about 803us. That seems large, but would seem to explain what I am seeing.

 

Does anyone know if I am reading this correctly? If so, does NI sell another analog input module that has a smaller input delay? What about the NI-9223?

 

Thanks!

Mitcham

0 Kudos
Message 1 of 2
(903 Views)

Looks like a typo in the 9239 datasheet - see the 9237 datasheet : https://www.ni.com/pdf/manuals/374186a_02.pdf

 

(40 + 5/512)/ƒs + 4.5 μs

 

Also in the documentation about different variables : https://www.ni.com/en-us/support/documentation/supplemental/17/specifications-explained--c-series-mo...

 

"Note: Some C Series Modules list their input delay in mixed fraction notation. The NI 9239 is an example of this. Its input delay is (40+5/512)/fs + 3.3µs."

 

So if you're reading at 50kHz then 800 us is the correct delay. Any of the cards without built-in antialiasing filters (like the NI-9223) will have shorter delays.

0 Kudos
Message 2 of 2
(792 Views)