02-13-2013 09:41 AM
Hi all,
I trying to write data to a digital output with DAWmxWritteDigitalLines who returns an -200230 error code
I use NI-6509 board (96 digital I/O) and python3.2
The code I try to run is the following:
import ctypes
#Load the DLL
nidaq=ctypes.windll.nicaiu
#Create a Task
taskHandle=ctypes.c_uint32(0)
nidaq.DAQmxCreateTask("",ctypes.byref(taskHandle))
#Create a Digital Output
chan=ctypes.create_string_buffer(b'1/port10/line0:7')
DAQmx_Val_ChanForAllLines=ctypes.c_int32(1)
nidaq.DAQmxCreateDOChan(taskHandle,chan,"",DAQmx_Val_ChanForAllLines)
#Start the Task
nidaq.DAQmxStartTask(taskHandle)
#Write data
numSampsPerChan=ctypes.c_ulong(1)
autoStart=ctypes.c_uint32(1)
timeout=ctypes.c_double(10.0)
DAQmx_Val_GroupByChannel=ctypes.c_uint32(0)
writeArray=ctypes.c_ubyte(0)
sampsPerChanWritten=???????
nidaq.DAQmxWriteDigitalLines(taskHandle,\
numSampsPerChan,\
autoStart,\
timeout,\
DAQmx_Val_GroupByChannel,\
writeArray,\
sampsPerChanWritten,\
null)
#Clear Task
nidaq.DAQmxClearTask(taskHandle)
1- sampsPerChanWritten is an output. what is the value for this field?
2- Why does DAQmxWriteDigitalLines returns an errorcode?
3- What is the signification of the errorcode?
Thanks for your help.
02-13-2013 09:56 AM
Are you using PyDAQmx? Just a suggestion...never used it myself. That error means there's a NULL pointer somewhere.
-gavin
02-13-2013 10:25 AM
No, before your reply I did not know pyQADmx. I will try it.
I will look for my NULL error
Thanks
02-14-2013 02:52 AM
Hi there,
The SampsPerChannelWritten should be a pointer when used in the DAQmxWrite function, so that's probably why you get a Null error. The PyDAQmx is also a good option to me 😄
Regards,
Eric
Eric M. - Senior Software Engineer
Certified LabVIEW Architect - Certified LabVIEW Embedded Systems Developer - Certified LabWindows™/CVI Developer
Neosoft Technologies inc.