From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

python DAQmxReadCounterScalarU32 error -200230

Solved!
Go to solution

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

 

Message 1 of 2
(5,512 Views)
Solution
Accepted by topic author 22buzz22

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)

 

Message 2 of 2
(5,510 Views)