ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Counter reset

I have a program that counts motor revolutions up to a certain number of revolutions then resets.  So currently I am using a chain of daqmx functions: stop, clear, then start but the counter doesn't seem to start back up afterwards.  Does anyone know how I can reset the counter simply and systematically?

0 Kudos
Message 1 of 4
(924 Views)

I am trying to add properties to a daqmx channel property node but when I search and select the property I want (counter:reset:enable), nothing happens.  It only closes the search pop up without adding the property to the select property popup.  Does anyone know how to fix this?

0 Kudos
Message 2 of 4
(925 Views)

1. You really should put a few minutes into neatening up your diagram wiring.  It's going to be helpful to *you* in the long run but in the meantime, it also helps us to help you.

 

2. The most immediate few things I'll recommend are:

  • Do not call DAQmx Clear inside the Case Structure
  • Wire the task refnum and error out from DAQmx Stop into DAQmx Start inside the Case Structure
  • Pay attention to your error inside your loop.  Either send it to an indicator or use it for loop termination

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 3 of 4
(880 Views)

You created a Task, started it, then in your loop, you read one sample, and at a certain time later, stopped the Task, cleared the Task (which makes it disappear!), then tried to start a no-longer-present Task (trying to cheat by using the now-useless "former Task Reference" won't work).

 

Try removing the Clear Task from inside the Case statement.

 

Here's some advice -- always run wires in and out of (most) structures on the left and right sides.  Using the top and bottom of a Case Structure makes the code devilishly difficult to read.  Here's a partial fix -- select all of the code in the VI, then click on the "Broom" symbol on the menu bar to "clean up the mess".

 

Bob Schor

0 Kudos
Message 4 of 4
(872 Views)