简体   繁体   English

使用PyDAQmx读取具有不同电压电平的模拟输入

[英]Using PyDAQmx to read analog input with different Voltage Levels

I am using NI USB-6289 to measure two channels (A and B) analog input voltage at the same time with PyDAQmx. 我使用NI USB-6289通过PyDAQmx同时测量两个通道(A和B)的模拟输入电压。 The range of Channel A's input is (-0.1, 0.1). 通道A的输入范围是(-0.1,0.1)。 While Channel B is (-5.0, 5.0). 而频道B为(-5.0,5.0)。 We found the value of channel A is not accurate. 我们发现通道A的值不正确。 BTW, the voltage channels set as below, is there someone meet the similar issue? 顺便说一句,电压通道设置如下,是否有人遇到类似问题? Thanks! 谢谢!

DAQmxCreateAIVoltageChan(taskHandle,"Dev1/ai16","",DAQmx_Val_Cfg_Default,-0.1,0.1,DAQmx_Val_Volts,NULL)
DAQmxCreateAIVoltageChan(taskHandle,"Dev1/ai24","",DAQmx_Val_Cfg_Default,-5.0,5.0,DAQmx_Val_Volts,NULL)

What you describe sounds a little like ghosting [1], where one channel affects another. 您所描述的听起来有点像重影[1],其中一个通道会影响另一个通道。 Typically, this happens when two or more channels have very different electrical signals connected to them, but it can also happen when two or more channels have very different gains, which is closer to your problem. 通常,当两个或多个通道连接的电信号非常不同时,会发生这种情况,但是当两个或多个通道的增益非常不同时,也会发生这种情况,这更接近您的问题。

To eliminate ghosting, read a grounded channel before each desired channel. 为了消除重影,请在每个所需的通道之前读取接地的通道。 In your example, you're reading from ai16 and ai24 , so you can read from _aignd_vs_aignd [2] before each channel to dissipate the residual charge from the previous channel. 在您的示例中,您正在从ai16ai24进行读取,因此可以在每个通道之前从_aignd_vs_aignd [2]进行读取,以消散前一个通道的剩余电荷。

DAQmxCreateAIVoltageChan(taskHandle,"Dev1/_aignd_vs_aignd","",DAQmx_Val_Cfg_Default,-0.1,0.1,DAQmx_Val_Volts,NULL)
DAQmxCreateAIVoltageChan(taskHandle,"Dev1/ai16","",DAQmx_Val_Cfg_Default,-0.1,0.1,DAQmx_Val_Volts,NULL)
DAQmxCreateAIVoltageChan(taskHandle,"Dev1/_aignd_vs_aignd","",DAQmx_Val_Cfg_Default,-5.0,5.0,DAQmx_Val_Volts,NULL)
DAQmxCreateAIVoltageChan(taskHandle,"Dev1/ai24","",DAQmx_Val_Cfg_Default,-5.0,5.0,DAQmx_Val_Volts,NULL)

If you're not affected by ghosting, there are several other causes for unexpected data [3], and perhaps a cabling change or fix will help. 如果您不受重影的影响,则还有其他一些原因导致意外数据[3],也许电缆的更改或修复会有所帮助。

References 参考

[1] How Do I Eliminate Ghosting from My Measurements? [1]如何消除测量中的重影?
http://digital.ni.com/public.nsf/allkb/73CB0FB296814E2286256FFD00028DDF http://digital.ni.com/public.nsf/allkb/73CB0FB296814E2286256FFD00028DDF

[2] NI-DAQmx Internal Channels for Self-Diagnostics and Self-Calibration [2]用于自诊断和自校准的NI-DAQmx内部通道
http://digital.ni.com/public.nsf/allkb/5826DD1B3709DBCA86256E2B00805C3D http://digital.ni.com/public.nsf/allkb/5826DD1B3709DBCA86256E2B00805C3D

[3] Troubleshooting Unexpected Voltages, Floating, or Crosstalk on Analog Input Channels [3]解决模拟输入通道上的意外电压,浮动或串扰
http://digital.ni.com/public.nsf/allkb/B9BCDFD960C06B9186256A37007490CD http://digital.ni.com/public.nsf/allkb/B9BCDFD960C06B9186256A37007490CD

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM