07-03-2007 04:19 PM
I am acquiring a signal frequency approximately 1 to 2 Hz (waveform attached). My goal is to create an output signal when 2 conditions are satisfied:
1) analog input signal crosses zero and 2) the integral under the negative part of the waveform is larger than a certain value.
The output signal can be analog, digital or counter pulse, but it has to happen within 10 to 30 ms upon finding a trigger threshold value.
So far I was just trying to generate the output signal upon finding a threshold (on a sinus waveform from the signal generator), but I was not successful doing this in a reliable and fast enough manor. I attached the latest LabVIEW code I wrote. My sampling frequency was 1000 samples/sec, although I played with higher and lower rates, samples per channel, counter out frequency etc.
I am using a NI-USB-6251 mass termination board with the SCC-2345 signal conditioner.
I also tried hardware triggering and it works well for the sinusoidal waveform, but for the real signal I need to continuously monitor both conditions before creating the output control.
I would really appreciate any input.
07-03-2007 04:26 PM
I apologize; the LabVIEW code is attached now.
Again, any aid or ideas would be greatly appreciated,
b777
07-04-2007 04:34 AM - edited 07-04-2007 04:34 AM
Message Edited by daveTW on 07-04-2007 11:37 AM
07-05-2007 10:45 AM
Hi Dave,
I do not have a greatest understanding of what is going on “behind the scenes”, I mean how the data are flowing through the buffer etc. The task I was trying to solve was much beyond my LabVIEW “expertise” that I acquired by reading through the NI website, various help manuals, examples, a little bit of NI phone support, etc.
Actually, this is much more than what I was hoping for… thank you so much for your very elegant and detailed solution… I appreciate it a lot…
I wanted to ask you a few more questions though…
1) I could not open your program since I have 7.1 version… the first read API goes immediately after the start icon and later on the program always read all available samples – is that correct?
2) Is there a need to assign any value to a wait timeout?
3) Would you still use the counter output (set the time to implicit, finite but 1 sample?), to generate a control output?
4) Can LabVIEW 7.1 and 8 both be installed at the same time? I have a LabVIEW version that I can install, but I am a little worry about the learning curve at this moment…
Thanks again for all your help,
Branka
07-06-2007 05:19 AM
1) I could not open your program since I have 7.1 version… the first read API goes immediately after the start icon and later on the program always read all available samples – is that correct?
2) Is there a need to assign any value to a wait timeout?
3) Would you still use the counter output (set the time to implicit, finite but 1 sample?), to generate a control output?
07-23-2007 06:41 PM
Dave, I greatly appreciate your help. I was immersed in another project for a while, and then unsuccessfully was trying to understand the problem I am facing when testing the program. I read a bunch of literature, especially about buffering issues, and that only opened more questions for me. I will try to explain the problem and, as always, any help would be greatly appreciated.
I am acquiring a sinusoidal waveform approximately 1V amplitude, 1Hz frequency.
The triggers and integration work fine, but instead of 1 sample going out as I specified (in the timing counter output API) many of them are generated. That slows down acquisition and instead of 1 to 20 available samples per channel, there is 40 or so. (I set the "wait (ms)" VI value to 5 but even if it is higher, the same thing happens).
I tried changing a counter output into a digital output ("Digital Bool 1Line 1Point") as you suggested (it took me a while to figure out how to connect the digital output with the SC-2345), however, I am not generating any signal.
I then try to only generate one digital output signal with the modified "write dig chan.vi" (attached) and the signal appears on the oscilloscope - which probably means the connections are fine - but it happens in a strange manner: the first time I run the program, the signal is generated, the second time is not. It can only be generated again (negative output) once the input is false. Further on, if you alter the true and the false, the signal is generated, if you repeat the same input – nothing happens?????
I am attaching both versions of the program – with the counter pulse and digital output,
I hope you could point the solution on either of them. From my limited perspective, it seems more logical, that the program would run faster if it only needs to write one digital output while samples are read.
It seems though that the output would be able to respond between 20 to 30 ms, which would be good if it does for every beat.
Please help.
Branka
07-23-2007 06:43 PM
07-25-2007 01:57 AM
Thank you for posting on the National Instruments forums.
It is not our policy to debug customer code, but I will try and take a look and see if I can give you any suggestions. If that is not possible, then I can at least tell you how things should behave.
I’m not sure that I understand what you are trying to accomplish. I understand that you have two conditions that must be met before you want an output signal to be created and the output signal must be generated within 20 to 30 ms of the conditions being met. What I don’t understand is what kind of signal you want to generate. Do you want a rising edge or a sine or square wave at a certain frequency, or just a voltage level. Since you say that it can be either analog, digital or counter, I’m confused. The only things that I can think of that are similar between the three is either a square wave, a rising or falling edge or a voltage level. If you can elaborate on this part, it will be easier to figure out the best way to get your application going.
07-25-2007 01:56 PM
Nick,
Thank you very much for your reply.
Let’s forget about the code. What I would like to accomplish is to generate a voltage level upon finding a trigger on an analog pressure waveform signal. Since besides finding a threshold analog trigger level I need to process some data, and then generate an output signal, I can not use the hardware triggering.
I was thinking that the easiest way to solve this is to send a counter output pulse upon finding a final software trigger, however despite specifying only one pulse to be generated, several of them are generated; that slows down the reading process (available samples per channel in a buffer increases), and make the timing of the generated pulse relatively random with respect to the trigger level.
I am following the “generate the pulse programming flowchart” to generate the output signal, and I don’t understand why instead of one many of them are generated.
Besides that the program works perfectly fine, so if you can help me understand how to generate one pulse upon a final trigger that’ll be all I need.
Thank you so much,
Branka
07-25-2007 10:31 PM
Try looking at Gen Dig Pulse.vi in the example finder. You can find it in the directory under Hardware Input and Output >> DAQmx >> Generating Digital Pulses >> Gen Dig Pulse.vi. You can run this code when need the output signal. Hopefully this will work for you.