Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

how to continous trigger

hai,
i did a program to count three digital pulses continously.the problem im facing now is that i need to count the signal for a certain period time than aftter that period of time i need to start counting again from zero.
 
im using a trigger function to start the count but on the next loop i need to trigger again.can i hv solution so that when i trigger once i dont hv to trigger for the next loop.i have send the program that i did
0 Kudos
Message 1 of 6
(4,513 Views)
Hi Shamaran,

 Here is what I understand your question as:

 I have a CI Cnt Edges task created. This count's rising or falling edges of a digital signal. I would like to reset the counter values back to zero (or some other default value) programatically. How can I do this?

 There is no programatic way to clear the counter value. The only way to do this for a CI Cnt Edges task is to Stop/Restart the Task, here is one possible implementation of this:
 

The inner while loop accumulates the counter value. When the Stop&Clear Counter Task boolean is true then this loop ends and the task is Cleared. The outer while loop
then re-starts

Message Edited by Matthew W on 11-02-2007 09:01 AM

0 Kudos
Message 2 of 6
(4,503 Views)
 Hi Shamaran,

 to finish my earlier post (browser timed out).

  In this example the Task is stopped when the count has reached some value. when the task is re-started then the count is cleared. this will be the only way of reseting the counter value for a CI Cnt Edges task.

 
Here is a KB that also addresses this question. If the task was a Angular Encoder task instead of CI Cnt Edges then you can reset the counter value with a digital line. This KB addresses how to do that. If you are counting edges however then a CI Cnt Edges is the correct task to use.

Have a great weekend,

Best regards.

MatthewW
Applications Engineer
National Instruments
 

Message Edited by Matthew W on 11-02-2007 09:03 AM

Message Edited by Matthew W on 11-02-2007 09:08 AM

Download All
0 Kudos
Message 3 of 6
(4,502 Views)

Shamaran,

I don't have LV handy here so I can't look at the code you posted.  Here are some general thoughts though. 

Depending on your app, another possibility *might* be to perform buffered period measurement using units=Ticks.  Each TTL "sampling clock" edge will automatically reset the count register to 0 right after storing the prior count value to the data acq buffer.  Depending on your timing requirements for this sampling/resetting, you can generate such an edge with a digital output line or perhaps with a pulse or regular pulsetrain from another counter.  (Since you've got 3 counters, I assume there's at least a 4th around somewhere since I only know of boards providing 2, 4, or 8 of them).

-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 4 of 6
(4,491 Views)

hai kevin,

 

clearing the count can be done.the main problem im having is the trigger part.my program is in a for loop as well as my trigger function.after one loop i need to retrigger again to arm the counting. what i would like to do is after i trigger it once i dont want to trigger again for the next loop but the count need to be done.is it possible??

hope can advice me to settle the problem.thanks.

0 Kudos
Message 5 of 6
(4,461 Views)
 Hi Shamaran,

 Here is what I understand your current problem to be:

 The counting and triggering are working correctly in that you trigger the counters the first time and they count. When you stop the While loop the task is cleared,
     on the next iteration the task is created again, including the Arm-Start trigger.

What you should do is move the DAQmx Create Channel and ArmStart triggers outside of the For loop, this way they will only require triggering (synchronization) once, after that they will count until the loop is stopped. The next iteration they will immediately count.

 I have modified your code to include this change, it is attached to this forum post and shown here:
 



This way the triggering only occurs once, the counting will  happen immediately on subsequent iterations of the For loop.

Best regards,

MatthewW
Applications Engineer
National Instruments






Message Edited by Matthew W on 11-05-2007 11:09 AM
Download All
0 Kudos
Message 6 of 6
(4,450 Views)