1

这是我第一次在论坛发帖。我是一个没有经验的程序员,他认为他的第一个程序几乎完成了,结果却遇到了障碍。我将非常感谢对这个问题的一些见解。

我正在编写一个 GUI 来运行两个硬件:一个运动控制卡 (Precision MicroControl) 和一个数据采集卡 (National Instruments)。到目前为止,我已成功使用 Python 的 ctypes 导入所需的 DLL 以单独运行设备。那里一切都好。但是,当我尝试同时使用这两者时,特定的 DAQ 调用失败并生成 NIDAQmx 运行时错误以及 Windows 错误:

NIDAQ 错误 - 50251 ' 指定的软件组件不可用。组件未加载的窗口错误“PYTHONW 在 0167:6ef85ab5 的模块 NIESXU.DELL 中导致异常 10H。”

运动控制卡的初始化是我的程序中首先发生的事情之一。如果我跳过程序的这一部分,DAQ 就可以正常工作。事实上,当我在程序中使用 matplotlib 创建图形时,会出现一个非常相似的问题。使用 Tkinter 'grid' 调用时程序失败,可以通过排除运动控制调用来解决。

谁能给我一个关于故障可能在哪里的指针?将不胜感激任何线索。如果需要,我会尝试提供更多信息。

更多信息:Windows 98 SE、Precision MicroControl DCX-PC100、DAQ PCI-MIO-16XE-50、Python 2.5 版

不工作的程序的简化版本:

from ctypes import *
import numpy

mcapi32 = windll.mcapi32  # motion control card DLL  # leave out this line...
hCtlr =mcapi32.MCOpen(arguments...)      # and this line, and the program works

def CollectNShots(n):  # set up to take n measurements
    mx = windll.nicaiu  #  load National instruments DAQ DLL
    TH0 = c_ulong()
    data.numpy.zeros((2*n,),dtype = numpy.float64)
    mx.DAQmxCreateTask(arguments)
    mx.DAQmxCreateAIVoltageChan( arguments)  # here is where the error arises
    .....other DAQ commands.....

    return 0

谢谢!

4

0 回答 0