LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQ Clear counter

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?

0 Kudos
Message 1 of 5
(2,669 Views)

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 

Kurt P
Automated Test Software R&D
0 Kudos
Message 2 of 5
(2,635 Views)

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

0 Kudos
Message 3 of 5
(2,620 Views)

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

Kurt P
Automated Test Software R&D
0 Kudos
Message 4 of 5
(2,590 Views)

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,

John Passiak
0 Kudos
Message 5 of 5
(2,581 Views)