LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How could I count events within some time period for NI-6602?

I only wire the TTL signal to the source pin of one counter, and like to count the number of event from that for the past 5 seconds each time I call the read function. Right now I can get readout but that is only proportional to the elapsed time other than constant time. How could I do that? Thanks.

Message Edited by stevensung on 03-07-2005 01:37 PM

0 Kudos
Message 1 of 2
(2,416 Views)
Hello Steven,

There are a number of ways that you could set up such a counting task. You will have to provide some way for the task to know what the count was 5 seconds ago...

1. You could set up a buffered event couting task and latch the count to a buffer with a gating signal of a known frequency. Then you would simply subtract the reading from 5 seconds ago from the current reading to get the count from the last 5 seconds. I have attached an example which expects a 100Hz signal on PFI9 to latch the count to buffer. After 500 samples (5 seconds), it subtracts the first buffered count from the most recent buffered count. This loop does take 5 seconds to iterate as it fills the 500 sample buffer.

2. You could also set up a regular event counting task and call a Read every 5 seconds (with a loop set to iterate every 5 seconds). Then subtract the previous iteration count from the current count.

Let me know if you have any further questions.

Sean C.
0 Kudos
Message 2 of 2
(2,400 Views)