LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using DAQ-assist to input a waveform; need help building a counter to count voltage "spikes"

Hey all! Cat Wink I'm pretty new to labView and even newer to this forum, but its nice to meet you all...I hope that perhaps someone can help me with my problem.

 

Allow me to begin by detailing the specifications of the problem.  I am an undergraduate student, and have a job doing research in a MEMS (micro/nanotech) lab.  The graduate student I am making this program for is working on biomedical applications;  eventually, the program will be connected to a microdevice that has a tiny channel in it, cut through a wee little capacitor, which blood will run through.  As red blood cells pass this capacitor, the voltage will spike; meaning that for each voltage spike, we can (and are trying to) count the number of red blood cells.

 

However, I am still in the early developement of the program, so this above specific info is not that important.  Basically, I am using a function generator to input a waveform to the DAQ assistant of, say 500 mV.  I am trying to write a program that increments a counter every time I turn the voltage above say 550 mV (peak-to-peak), counting the number of simulated "spikes."  I have tried quite a lot to write a working program, and although I have not gotten it to work yet, I will post a screenshot of my most recent attempt HERE:

labview snapshot.png

I thank you in advance for any helpful tips, advice, or straight up assistance you may be able to give me.  Please ask me any clarifying questions about the program I wrote or the application, or anything.  Happy Friday! Smiley LOL

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

Hi!

 

That sounds like a very cool application!

 

The problem with the code you are writing is that it will increment for the entire time that the signal is above 0.55V. We need it to just increment the first time it crosses 0.55V on the rising edge.

 

If you would like to use the DAQ assistant along with another express VI, I have attached a VI that will count how often the input to the DAQ device goes above 0.55V using an express VI called "Trigger and Gate".

Basically what it does is the triggered signal becomes a "high" digital pulse whenever the input signal goes above 0.55V and then immediately goes back down to 0. Whenever it sees a high, it increments the counter by 1. 

 

You can read about the different VIs to understand what they do exactly.

 

I hope this helps! This is just one simple way of doing this task with express VIs. Have a great day!

Peter E
Applications Engineer
National Instruments
Message 2 of 10
(3,059 Views)

Thank you for responding!  And I appreciate your knowledge very much.

However, I am not running the latest version of LabView.  If it wouldn't trouble you too much, could you upload an image of your program?

I am about to open LabView and make some attempts of my own using Trigger/Gate, but just in case something goes awry Cat Frustrated

Thanks again!

0 Kudos
Message 3 of 10
(3,050 Views)

I apologize. I have attached pictures of the VI as well as the settings for the Trigger and Gate Express VI. You may need to change the settings to meet your personal requirements, and explanations of each setting can be found in LabVIEW's context help if you have any questions!

 

Have a great day!

Peter E
Applications Engineer
National Instruments
Download All
Message 4 of 10
(3,044 Views)

Peter - When I created this program for a template, the counter increments about once per second - before I even move the voltage above the threshold level!  Any idea what might be causing this?

You have a good one as welll; I hope that the weather is as great where you are today as where I am! Cat Very Happy

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

Hi!

 

It looks like this Express VI may not work for your application. It doesn't appear to be retriggerable for multiple samples.

However, there is another VI that may be able to do what you are looking for if you have LabVIEW Full Development System. It's called "Threshold Detector.vi" and it is located in the Signal Processing>>Signal Operation function palette. Take a look at that function and see if it will work for you. You can read about it in LabVIEW's context help.

 

For better understanding, what DAQ device are you using to acquire this data?

Peter E
Applications Engineer
National Instruments
0 Kudos
Message 6 of 10
(3,019 Views)

For this type of application the program code depends on the type and quality of the signal, take a look at my example (I don't know what version you have, I've saved it in LV version 8). The way my code works is to use a shift register to latch on when the signal goes above your trigger level and reset when you go below the level (minus a small amount which you may need if you have a noisy signal). I hope this gives you some ideas to try. If your not sure about using shift registers take a look at the examples which come with LabVIEW, they can be a big help when your starting out with LabVIEW.

 

Ian

Download All
0 Kudos
Message 7 of 10
(3,011 Views)

Hey guys, it's been a while!  A lot of stuff has been happening in my life and I have had virtually no time to work on my LabView project.  

 

I did create a LabView program based off IanW's reccomendation.  I am unsure of what exactly is going wrong, but when I run it, only a simple "snapshot" of a waveform from the DAQ shows up in the graph.  Even when I put the DAQ assist in a seperate while loop, the same thing happens.  I am including a screenshot of the project in case I am messing something entirely different up.  If you happen to read this, I really appreciate your help and thank you Ian! Smiley Happy

 

I am also having a random issue with the filter signal VI.  So that background signals in the actual experiment do not read as "spikes" I have been instructed to include a high-pass filter in the VI.  However, everytime I use the high pass filter VI, it botches my signal and turns it into a bunch of noise!  I, nor my graduate mentor (who isn't too well-versed in LabView) have any idea why this is - we've tried using different types of filters to no avail.  

 

Lastly, I would like to talk to Peter about a few questions I had abour LabView design.  In case you're still around, I will write another post later today with more detail.  In the meantime, I will try to find some of the example VIs about shift registers Smiley LOL  All who read this have a great day!

0 Kudos
Message 8 of 10
(2,979 Views)

Your DAQ code will need to be inside the loop or provide an array of data for the loop to process.  I never use the DAQ Assistant or Dynamic Data Types Smiley TongueSmiley Wink so I can't help you unless you advance to real DAQmx VIs.  If you want to stick with the assistant you MUST post the actual VI.  A picture of a wizard interface box doesn't show us what's inside it so we have no idea how it's configuring the real DAQmx VIs that it's hiding.

 

I suspect you may be filtering a single datapoint as well (rather than an array of data) which would explain why the filters don't work.  Check out the shipping examples (Help > Find Examples...) to find some VIs that show you the proper technique.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
0 Kudos
Message 9 of 10
(2,965 Views)

Are you still using the function generator, or do you have real signals fron the red blood cells? Either way, can you capture the raw data from your data acquisition and upload it to the forum. It should be easier then to give you some ideas to try.

 

Ian

0 Kudos
Message 10 of 10
(2,950 Views)