07-27-2010 10:24 AM
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
07-27-2010 11:17 AM
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.
07-27-2010 02:57 PM
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.
07-28-2010 10:10 AM
I am using analog input. Do I have to convert it to digital? How do I link the following two files?
07-28-2010 10:41 AM
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.
07-28-2010 01:42 PM
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:
07-28-2010 03:52 PM
Hey, tbob, I'm currently working on converting some Matlab code into LabVIEW. If I post it will you do it for me? ![]()
07-28-2010 04:07 PM
@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?
Very funny!
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. ![]()
![]()
![]()
07-30-2010 09:56 AM
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?
07-30-2010 10:33 AM
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.