LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

convert square wave to sinc wave

Solved!
Go to solution

The 6008 does not support an analog trigger for analog output. The 6008 does not even support hardware timed analog output. I guess "they" might have picked the wrong DAQ card to evaluate in this case.

 

You can certainly output a signel single point by point with the 6008 after you correct your acquisition code but for optimum performance, you will need to rewrite much of it if you decide to get a different DAQ card

0 Kudos
Message 41 of 61
(2,280 Views)

You need to connect your function generator to the USB-6008 input.  If generator is set to generate TTL level signals, use a digital input on the 6008, otherwise use an analog input.  In Labview, use DAQmx functions to read the 6008 (look for examples for DAQmx).  For the DAQmx read function, select an output of 1D array of DBL (if using analog input).  Now you need a loop to process the data.  Pass the array to the loop with indexing enabled.  When you see the data going high (or low, depending upon which edge to trigger off of), call a subvi to generate one EKG pulse (use my code, modify it to generate one pqrst wave).  Then generate DC until the next edge, where you will again generate one EKG pulse.  Then more DC.  Continue until the end.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 42 of 61
(2,276 Views)

Jst to show there are a couple of different way to skin a cat, you can use the Basic Level Trigger Detection function to detect a rising edge. You can even use it with that DAQ Assistant without converting the datatype.

0 Kudos
Message 43 of 61
(2,263 Views)

I am using analog input. Do I have to convert it to digital?  How do I link the following two files?

Download All
0 Kudos
Message 44 of 61
(2,243 Views)

The EKG signal generator would be a subVI in your main VI. You would then have to address the issue of actually generating the waveform. The board you are using cannot at that sample rate.

 

FIX that DAQ Assistant if you want to use analog input. It's impossible to meet your specs with the way you have set it up, as I already mentioned. You can change it to digital acquisition if you want. Since the DAQ device you are using has only software timed digital I/O, you are forced to read one sample at a time. Since you have a slow input, that should be no problem.

0 Kudos
Message 45 of 61
(2,234 Views)

I believe that this project is extremely difficult for a novice programmer.  It took me a while to get it done.  You have to look at your incoming square wave signal, one point at a time.  When the voltage level goes up above the threshold, you need to generate an EKG pulse by calling the subvi.  I had to modify the EKG subvi to make the length shorter than the square wave cycle.  The trick is to trigger the subvi call just once, and then wait until the input signal drops and rises again.  Also, the length of the EKG cycle does not match the length of the square wave cycle.  It is shorter.  So then I had to pad the EKG signal with trailing zeros until the two cycle lengths were equal.  The output looks like a square wave triggering an EKG pulse on every rising edge.

 

The OP now has to figure out how to capture his square wave and apply it to the code I have included.  This thread is getting too long.

 

Keni:  learn Labview before trying to tackle a project like this.  Don't use DAQ Assistant.  It is easy but not at all versatile. Learn discrete DAQmx functions instead.  That is the best way to read one sample at a time (put the read in the loop in my code).

The attached VIs are saved in 8.6  Here is the code picture for the main program:

 

20167iD2F046C14BA86589

 

- tbob

Inventor of the WORM Global
Download All
Message 46 of 61
(2,216 Views)

Hey, tbob, I'm currently working on converting some Matlab code into LabVIEW. If I post it will you do it for me? Smiley Wink

0 Kudos
Message 47 of 61
(2,205 Views)

@smercurio_fc wrote:

Hey, tbob, I'm currently working on converting some Matlab code into LabVIEW. If I post it will you do it for me? Smiley Wink


Very funny! Smiley Very Happy  I felt sorry for the guy.  Pretty tough assignment for a rookie.  Besides, this thread is already 5 pages long.  If he had to do it on his own, it would go another 50 pages.  I usually don't do their homework for them, but this one was getting out of hand.  Actually, I did only a part.  He still has to implement his DAQ.  After 10 more pages here, I'll probably do that part too.

 

Matlab???  What's that?  A lab where you perform math?  I got one of those at home.  I use it to do my daughter's homework. Smiley Very HappySmiley Very HappySmiley Very Happy

- tbob

Inventor of the WORM Global
0 Kudos
Message 48 of 61
(2,200 Views)

First of all, thank you tbob. I don't know what's going on your program. To be honest, I am lost now. Isn't there any simple way to connect my program with your EKG generator program?

0 Kudos
Message 49 of 61
(2,173 Views)

You replace tbob's simulated square wave with a DAQmx Read and inside the case statement with the 'triggered - generate EKG' comment, you place a for loop with a DAQmx Write to output the signal. You need the for loop because you are using the wrong DAQ card. also, you need to set your sample size small in order to output the EKG signal as close as possible to the transition of the pulse.

 

It would be simple if you were using the correct DAQ card. There are five pages of answers/questions and it would be one with only a couple of functions if you (or whoever bought the 6008) had done a bit of research beforehand.

0 Kudos
Message 50 of 61
(2,165 Views)