LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Digital Change Detection on USB-6218 BNC

Hello all,

 

I am trying to configure digital data acquisition using the USB 6218 BNC, so that I put in multiple channels, and I get a measurement off all channels whenever any particular channel has a change--when any of the signals either rises or falls.

 

My natural instinct is to use digital timing using the change detection mode, and when I look for examples I find the Read Dig Chan-Change Detection.vi, but I see in the Requirements that my device is not supported.

 

However, I go here http://zone.ni.com/reference/en-XX/help/370471W-01/cdaqmxsupp/usb-6218/, and at the bottom it says digital change detection is supported.

 

I would just like some help as to how I could make this happen-- perhaps an example of accomplishing this task programmatically in LabVIEW if my device truly cannot utilize the change detection from the digital timing vi.

 

Thanks for the help!

0 Kudos
Message 1 of 10
(3,508 Views)

So after trying various options, it seems using the Create Timing Source VI set on the Digital Edge (Counter) may be able to do something close. Creating this counter could detect EITHER rising or falling signals, but not each, and only on one channel (I suppose I can add more counters later to do all channels but that's not my concern now.)

 

I tried basing my code (change detection - ish) off of the example "Event Response".

 

I also attached the example I mentioned above just so it'd be easier to reference.

 

Any and all help is greatly appreciated.

0 Kudos
Message 2 of 10
(3,493 Views)

Hello beefcake,

 

The link to the supported functions of the USB-6218 is incorrect in stating it supports change detection. After trying to set this up I was not able to perform direct change detect timing nor was I able to perform correlated Digital I/O. Looking at the Specifications sheet, the timing spec for Digital I/O is Software timed. Were you able to get the counter example to work? If you did then the next step would be to run all of your signals into an external OR gate and have the result run into the gate for the counter task.

 

Regards,

 

-Travis E

National Instruments
Product Marketer
0 Kudos
Message 3 of 10
(3,467 Views)

Thank you for your help Travis,

 

I was still unable to get the counter-type example to work. I was struggling with what the counter input and source input should be for the wiring I had set up in my code above. I use the constants to try essentially all combinations of possible terminals for the counter and source -- I started by trying to use "ctr0" for the counter, and the options I have for the source are essentially the "PFI's". Whereas the channel I create on the digital input channel are ports/lines.

 

Or am I supposed to set up the digital input line and its own timing as if I were to just be taking data, and then sent that timing as the input source to the "digital edge (counter)" create timing source.

 

Also thanks for the help on what to do afterwards, now I just gotta get there!

 

beefcake

0 Kudos
Message 4 of 10
(3,453 Views)

One more thing I thought of. So I am trying to collect data for multiple channels, and have my data points be the vales of all channels only at times when at least one channel has changed state.

 

If I were to just collect data from my digital input normally (say at a specified sampling rate for a certain time), I could then implement some sort of filter on my output data that only saves data from the times at which at least one state from a channel at that time is different than the state at the time before.  

 

If I were to figure how to save my data in that way, it would essentially accomplish the same task, correct? (Aside from taking more samples while the data intake was running, but I'd be getting rid of those data points before saving the data).

 

Double thanks,

 

beefcake

0 Kudos
Message 5 of 10
(3,451 Views)

Hello beefcake,

 

This software change detect option is a great suggestion. You can set up a producer consumer architecture that stores the data you acquire to a queue that the consumer will use based on the fact that there is a change in the data. I have attached a rough draft of this idea. Take a look at the design and build on it. Basically it checks if the current data is equal to the previous iteration's data and if so it puts it in a queue. The second loop pulls data from the queue and displays it in this case, you can modify this to store data to file or process it. Good luck!

 

Regards,

 

-Travis E

National Instruments
Product Marketer
0 Kudos
Message 6 of 10
(3,428 Views)

Hey Travis, 

 

Thanks for your help, although I forgot to mention I am using LV 11.0, not 12.0.

 

Would it be possible to upload an older version for me?

 

beefcake

0 Kudos
Message 7 of 10
(3,412 Views)

Hey beefcake,

 

Here you go!

 

Regards,

 

-Travis E

National Instruments
Product Marketer
Message 8 of 10
(3,409 Views)

Ah,

 

This is a pretty sweet idea you have set up.

 

I'm having some trouble generalizing to multiple channels. The data is either a 1D or 2D array (depending on the samples I want per channel), or could also be a waveform I suppose. However, this is conflicting with the data type in the queue and/or the output data from the dequeue function.

 

Just a bit confused, but thanks for all your help thus far, it's already helped.

 

 

0 Kudos
Message 9 of 10
(3,401 Views)

Yeah the 621x devices don't support change detection unfortunately--the polling based approach is the best you'll be able to do.

 

The page you linked earlier had me confused for a couple minutes, but it turns out that it's saying that the DI.ChangeDetectSupported property is supported:

 

Read Dig Chan-Change Detection.png

 

The property returns whether or not a line supports change detection.  So... technically this property is supported on the 621x, but it will always return FALSE since change detection itself isn't supported.  How confusing!  

 

A device that actually supports change detection would have the change detection timing properties available to it (e.g. the 6321).

 

 

Best Regards,

John Passiak
0 Kudos
Message 10 of 10
(3,372 Views)