04-18-2013 03:36 PM
How is the best way to clear the DAQ counter without stopping the task? I tried setting the property node CI.Countedges.InitialCnt to 0 for the DAQ counter task, but the data is still there. Any idea's why after setting this to 0 the counter would still exist?
04-19-2013 04:05 PM
Hey QRP,
I have a few questions
Could you explain why you need to clear the counter without stopping the task?
Which card are you using?
Are you doing this is LabVIEW or is this in a text-based language?
Are you trying to clear the counter output, or clear the count of the counter?
What are the other settings of your counter task (input/output/clock speed, etc.)?
It does not look like you can reset the counter to zero unless you restart the task. You could use a variable and have it roll over once you once it gets to a certain value and use that instead.
Regards,
-KP
04-19-2013 10:08 PM
Actually I'm using a DAQ counter on the 9401. I need to clear the actual count of the counter when I get to a home position. Can I just stop the task and restart the task to clear the actual count? Or do I have to stop, clear and create a new task in order to clear the count. Could you let me know.
Tnx,
Rob
04-22-2013 09:54 AM
Hey Rob,
It looks like all you need to do is stop and start the task. I found an example in LabVIEW (it looks like it has some C# code as well) to give you an idea of the general structure.
https://decibel.ni.com/content/docs/DOC-6576
Regards,
-KP
04-22-2013 12:25 PM - edited 04-22-2013 12:26 PM
You can reset the counter based off of a hardware signal:
For encoder tasks, you can use the Z Index.
For edge count tasks, you can use the CI.CountEdges.CountReset functionality (this might not work on the 9172 chassis, you didn't mention which chassis you are using though).
If you just want to reset the counter in software, you could instead store the current value of the counter and then subtract it from whatever value the hardware is reporting. Restarting the task is probably not desirable because it would take longer, and while the task is in the process of restarting you would miss counts.
Best Regards,