本文整理汇总了Python中PyDAQmx.c_ulong方法的典型用法代码示例。如果您正苦于以下问题:Python PyDAQmx.c_ulong方法的具体用法?Python PyDAQmx.c_ulong怎么用?Python PyDAQmx.c_ulong使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyDAQmx
的用法示例。
在下文中一共展示了PyDAQmx.c_ulong方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: writeValues
# 需要导入模块: import PyDAQmx [as 别名]
# 或者: from PyDAQmx import c_ulong [as 别名]
def writeValues(self, chanNames, data):
DebugLog.log("DAQhardware.writeValue(): chanNames= %s val= %s" % (repr(chanNames), repr(data)))
self.analog_output = None # ensure the output task is closed
samplesWritten = daqmx.int32()
analog_output = daqmx.Task()
data = np.vstack((data, data))
data = data.transpose()
data = np.require(data, np.double, ['C', 'W'])
numSamples = 2
outputRate = 1000
for chanName in chanNames:
analog_output.CreateAOVoltageChan(chanName,"",-10.0,10.0, daqmx.DAQmx_Val_Volts, None)
analog_output.CfgSampClkTiming("",outputRate, daqmx.DAQmx_Val_Rising, daqmx.DAQmx_Val_FiniteSamps, numSamples)
analog_output.WriteAnalogF64(numSampsPerChan=numSamples, autoStart=True,timeout=1.0, dataLayout=daqmx.DAQmx_Val_GroupByChannel, writeArray=data, reserved=None, sampsPerChanWritten=byref(samplesWritten))
DebugLog.log("DAQhardware.setupAnalogOutput(): Wrote %d samples" % samplesWritten.value)
# wait until write is completeled
isDone = False
isDoneP = daqmx.c_ulong()
while not isDone:
err = analog_output.IsTaskDone(byref(isDoneP))
isDone = isDoneP.value != 0
analog_output = None
示例2: waitDoneTask
# 需要导入模块: import PyDAQmx [as 别名]
# 或者: from PyDAQmx import c_ulong [as 别名]
def waitDoneTask(task, timeout):
err = 0
isDone = False
isDoneP = daqmx.c_ulong()
tElapsed = 0
lastTime = time.time()
while not isDone:
task.IsTaskDone(byref(isDoneP))
# DebugLog.log("waitDoneTask(): isDoneP= %s" % repr(isDoneP))
isDone = isDoneP.value != 0
timeNow = time.time()
tElapsed += timeNow - lastTime
lastTime = timeNow
if timeout >= 0 and tElapsed > timeout:
if not isDone:
err = -1
isDone = True
return err