03-23-2008 11:28 AM
I need is a way to measure interval’s of 33 msec, starting from t 0.
I want to begin the measure (t 0 ) when my code (visual c++) asks the counter to begin counting and to get interrupt's from the card to my code each 33 msec from that point on.
by using NI6601 , do i need to reset a counter each 33 msec and start counting again? or can i generate an interrupt by the difference each 33 msec?
if i need to reset the counter - how can i do it internally ?
how do i give the interrupt to start the counting?
thanks
03-24-2008
10:24 AM
- last edited on
12-18-2024
02:24 PM
by
Content Cleaner
Jonasblacher,
Welcome to the NI forums!
Do you know your source rate going into your counter? If you know this then you will be able to essentially create a real time counter.
If you are using DAQmx you can start with one of our shipping examples. I would start with the Count Digital Events.vi example, located in the LabVIEW Example Finder (Help->Find Examples). In this example, you will count pulses on your source.
Now that you have your pulse count the formula to determine the elapsed time is:
elapsed time = counter value * time period of source signal
time period of source signal = (1/frequency) or (1/20 MHz) = 50 ns
Since the NI 6601 is a 32 bit counter you will be able to count 648 (33ms intervals) before the timer resets itself to 0.
50ns*(2^32 - 1) = 214s
214 s / 33 ms = 648
You can also reset the device every time you reach your 33ms requirement.
I hope this helps!
Message Edited by Ryan N. on 03-24-2008 10:24 AM
03-24-2008 11:18 AM
I believe that the answer was for using NI-DAQmx, but i mentioned that i use visual c++...
If i have to reset the counter and stop the task i believe it wont do me any good..
but i understand that it is not necessary to do so, and i can still get interrupts even if the counter got to "0" again.
Do you have an example of how to give my interrupt and then receive interrupts each X msec period? is the library you mention, in the installation kit that comes with the 6601 card?
thanks
jonas
03-25-2008
04:12 PM
- last edited on
12-18-2024
02:26 PM
by
Content Cleaner
jonasblacher,
Unfortunately we do not have any examples in Visual C++ that accomplishes this task. Interrupt’s (IRQ) main use with our products are for data transfer (kind of like DMA).
We do have an example in Visual C++ that is equivalent to the example I mentioned in my last post. You will still have to reset the device back to zero and or use all 32 bits of the counter, which the counter will then reset itself back to zero and start over. I hope this helps.