05-22-2017 02:28 AM
Hi,
I have an issue with my USB-6003 card and counter operation. Below is part of my Python script that I'm using. My understanding is that those CreateCICountEdgeschan and ReadCounterScalarU32 are needed. And actually those seems to work 'cause that initialCount value can be read with ReadCounter-function. I have learned that CfgDigEdgeStartTrig can no be used with counters, and instead of that ArmStartTrig should be used.
So I added SetArmStartTrigType(DAQmx_Val_DigEdge) between CreateCICountEdgesChan and StartTask but following error was printed out.
DAQError: Specified property is not supported by the device or is not applicable to the task.
Property: DAQmx_ArmStartTrig_Type
Task Name: _unnamedTask<F>
Status Code: -200452
in function DAQmxSetArmStartTrigType
datatype = ctypes.c_uint
data = datatype()
initialCount = 1
CreateCICountEdgesChan(devport, '', DAQmx_Val_Rising , initialCount, DAQmx_Val_CountUp )
#SetArmStartTrigType(DAQmx_Val_DigEdge)
StartTask()
ReadCounterScalarU32(-1, data, None)
Any ideas what might be wrong? With MAX this seems to work smoothly. I created Counter Input (Edge Count) and after rising edge the measured value is updated. And now my goal is to make this work with Python.
Thanks and regards,
Antti
Solved! Go to Solution.
05-30-2017 08:23 AM
Hi Antti,
The ArmStartTrig can be used to start the counting hardware based on a digital trigger, which is indeed not supported on the USB-6003. And it is also not needed if you just want to count edges.
The USB-6003 only supports counter readings on demands, so every time you want to get an updated value of the counter you need to use the ReadCounterScalarU32(-1, data, None) function.
So your program should work fine (without the starting trigger), but you need to place a loop around the read function in order to read it more than once.
You should also use close() at the end of your program to free the allocated ressources.
Andreas Jost
Applications Engineer
National Instruments