LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using digital edge counting as a time source for a timed loop

Hi Friends,

 

I have a USB 6002, a multifunctional device having analog output (AO) and counter input , and would like to use it as a time source (via edge counting) for a timed loop to avoid Windows OS interruption to a while loop. I found that such OS interruption to a while loop occurs occasionally when a while loop runs  at 20-50 iterations/s, the loop contains a VISA reading data from a device register.  The interruption is normally approximately less then 2 seconds, posing the reading data for the short time, and then the reading data can resume by itself. The VI with the loop is set at the highest priority to ensure the data acquisition. It is a annoying issue to my project. 

 

My point is to send a square wave signal via a USB 6002's analog output to the counter PFI0 or PFI1, the counter then sends edge counting bits to a DAQmx time source for a timed loop so that the loop can run at specified number of iteration.

 

I tried around and obtained an error. A simplified VI is attached, which included the error message and the USB 6002 channel description for your reference.

 

edmonton_0-1610488999770.png

 

 

Can some one help me with the settings?

 

I will post this at different location for a broader exposure, e.g. LabView and counter/timer

 

Thanks,

Gu

 

0 Kudos
Message 1 of 4
(145 Views)

@edmonton wrote:

Hi Friends,

 

I have a USB 6002, a multifunctional device having analog output (AO) and counter input , and would like to use it as a time source (via edge counting) for a timed loop to avoid Windows OS interruption to a while loop. I found that such OS interruption to a while loop occurs occasionally when a while loop runs  at 20-50 iterations/s, the loop contains a VISA reading data from a device register.  The interruption is normally approximately less then 2 seconds, posing the reading data for the short time, and then the reading data can resume by itself. The VI with the loop is set at the highest priority to ensure the data acquisition. It is a annoying issue to my project. 

 

My point is to send a square wave signal via a USB 6002's analog output to the counter PFI0 or PFI1, the counter then sends edge counting bits to a DAQmx time source for a timed loop so that the loop can run at specified number of iteration.

 

I tried around and obtained an error. A simplified VI is attached, which included the error message and the USB 6002 channel description for your reference.

 

edmonton_0-1610488999770.png

 

 

Can some one help me with the settings?

 

I will post this at different location for a broader exposure, e.g. LabView and counter/timer

 

Thanks,

Gu

 


I don't think that approach is going to work, since ultimately Windows will be the one to control the timing.  The problem is more likely an issue with your code.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 2 of 4
(112 Views)

Further, I doubt that any USB devices support the use of counter signals as timing sources for a Timed Loop.  (Just checked your posted code -- yup, sure enough, that error confirms that your device doesn't support such a usage.) 

 

You also probably need independent parallel loops.  One for VISA communication to an instrument, another for your AO.  And I'll venture a guess that you might be running the AO task in unclocked, unbuffered, on-demand mode.  You can get a much more precise and reliable update rate by configuring it as a hw-clocked, buffered task.  Try out one of the corresponding shipping examples to see how it's done.

 

 

-Kevin P

Message 3 of 4
(84 Views)

Hi Kevin,

 

Thanks. I will check my code carefully. 

Gu

0 Kudos
Message 4 of 4
(73 Views)