03-05-2013 08:42 AM
Hi all,
I'm using Python 3.2 and NI-6521 board.
I try to count the number of rising edges of my signal when i click on a start button but i always have the error code -200230.
My program is the following:
#Variables
DAQmx_Val_Rising=int32(10280)
InitialCount=uInt32(0)
DAQmx_Val_CountUp=int32(10128)
timeout=float64(10)
null=ctypes.POINTER(ctypes.c_int)()
value=uInt32()
#Source Channel
chan_count=ctypes.create_string_buffer(b'1/ctr0')
#Create a task
TaskHandle=uInt32
TaskCount=TaskHandle(0)
nidaq.DAQmxCreateTask("",ctypes.byref(TaskCount))
#Create a counter input
nidaq.DAQmxCreateCICountEdgesChan(TaskCount,chan_count,"",DAQmx_Val_Rising,InitialCount,DAQmx_Val_CountUp)
#Start the task
nidaq.DAQmxStartTask(TaskCount)
#Read the number of rising edges when click on GUI button
nidaq.DAQmxReadCounterScalarU32(TaskCount,timeout,value,null)
I think my error is in the declaration of value but i don't understand why.
Does somebody have an answer? It is very urgent.
Thanks
Solved! Go to Solution.
03-05-2013 09:25 AM
After more tests, i have found the solution
#Read the number of rising edges when click on GUI button
nidaq.DAQmxReadCounterScalarU32(TaskCount,timeout,ctypes.POINTER(ctypes.c_uint32)(value),null)