Closed j-estois closed 10 years ago
Hello,
There is a shift of 1 between the position of arguments in the methods of a Task object and the argument of the ctyps fonction. Your error comes from the numSampsPerChan argument.
Furthermore, you can let python to the conversion for you.
To use WriteAnalogF64, with the functions : DAQmxWriteAnalogF64(taskHandle,n,0,10.0,DAQmx_Val_GroupByScanNumber,data,byref(sampsPerChanWritten),None)
Or with a task : task.WriteAnalogF64(n,0,10.0,DAQmx_Val_GroupByScanNumber,data,byref(sampsPerChanWritten),None)
In this example : data is a numpy array of total size n and sampsPerChanWritten=int32()
Thanks very much. That allowed me to solve the problem. The argument position shift should have occurred to me since the NI function has an extra argument, and the error probably originates there.
Hello, I have ReadAnalogF64 working, but with WriteAnalogF64 I'm having trouble with argument 2 (autostart, bool32). I've tried PyDAQmx.bool32(True) (or False) as well as ctypes.c_ulong(1), etc., and always get the error below. Any help would be much appreciated.
File "", line 3, in WriteAnalogF64
File "", line 2, in function
File "C:\Python27\lib\site-packages\pydaqmx-1.2.5.2-py2.7.egg\PyDAQmx\DAQmxFunctions.py", line 23, in mafunction
error = f(*arg)
ctypes.ArgumentError: argument 2: <type 'exceptions.TypeError'>: wrong type