11-07-2011 08:34 AM
Hello Internets,
I'm an inexperienced LabVIEW user, I'm trying to set up a system in which voltage samples are taken when triggered by a digital pulse.
I am sampling using a PCI-6250. I have an encoder set up that emits a digital pulse once per revolution. I would like to eventually take approximately 1000 samples in a very short space of time triggered by this once per rev pulse.
The problem I am currently having is that I seem to get much fewer readings than I would otherwise expect, the LabVIEW programme I am currently running also takes a long time to stop following my pressing the stop button.
The array also fills up in a way that is odd to me, perhaps someone could explain it?
Thank you, any help would be greatly appreciated!
Solved! Go to Solution.
11-07-2011 10:56 AM - edited 11-07-2011 10:56 AM
Hi Relaxidermist,
Thanks for joining the community!
It would be a good idea for you to attach your VI, that way we can see it running and modify as needed. However, it looks as though you are almost there. You can configure your task to acquire a finite number of samples (1000) on the digital trigger - without any need for a For Loop. The "DAQmx Read" will take (1/SampleFreq)*No.Samples to execute, so you will need to make sure you set a high enough timeout value.
You also mention that your program takes a long time to stop when you press the stop button, although I can't see one in your pictures
Let us know if you have any questions!
11-07-2011 03:13 PM - edited 11-07-2011 03:16 PM
Hi Relaxidermist,
There are a couple of things in your current code that seem contrary to your objective:
"I would like to eventually take approximately 1000 samples in a very short space of time triggered by this once per rev pulse."
Assuming you want to read 1000 samples for each external trigger received and you have multiple triggers coming in, I would instead start with this example:
Finite Retriggerable Analog Input using Digital Trigger
I'll be the first to admit that it's not the most intuitive--on M Series (like your 6250) you have to use a counter output in order to achieve a truly re-triggerable acquisition. You could re-arm the task in software but doing so takes time and is prone to missing trigger signals.
If you were on an X Series (63xx devices), the code that you have is close but you would need to make the following changes:
1) Use the on-board clock for your sample clock source instead of the external PPR signal.
2) Make the task finite instead of continuous.
3) Enable the Retriggerable property--this is not available on your M Series device (hence the workaround posted above).
Best Regards,
11-08-2011 10:14 AM
Hi, Thank you both for your quick responses.
John, just to clarify, when I input a digital pulse, should I expect to see n samples appear on the waveform graph at the frequency I've specified? I've managed to get something to this effect to occur when I wire a 5000 pulses per rev channel to the digital trigger soure and I use the 100 kHz timebase clock. I've left the counter for sample clock to counter 1 on dev1 (PCI 6220) because when I specify on dev2, I seem to be getting errors about paths being reserved for other processes.
Thanks,
Ingram
11-08-2011 11:07 AM
Hi Ingram,
The code currently displays N samples on the graph every time a trigger occurs. However, the loop and graph can only update so fast--you might need to read back more samples per iteration to keep up with your triggers. I'm not sure how fast your trigger signal is occurring (in terms of Hz).
You won't be able to use a counter from another device unless the two are connected via RTSI cable (or in a PXI chassis).
Best Regards,
11-09-2011 06:22 AM
11-09-2011 11:49 AM
Hi Ingram,
What do you ultimately want to do with the data, and how fast is your trigger occurring (in terms of Hz)? The bottleneck in your case is probably going to be the loop rate keeping up with the data if the trigger is occurring too quickly--you can mitigate this by readings more samples per loop.
To use the automatic routing available in DAQmx over RTSI, you have to make sure to configure the RTSI cable in MAX.
Best Regards,
11-10-2011 04:22 AM
Hi John,
I'd like to just acquire the readings and store them for now and process them later.
The trigger is only coming in at around 3Hz, I'm rotating it manually, this is what has me somewhat confused. There appears to be significant lag between when I press stop and when the program actually stops.
Cheers,
Ingram
11-10-2011 05:08 AM
Sorry John, my digital trigger is connected to the 80MHz clock and my AI sample clock is connected to the encoder pulse which is approximately 3Hz.
11-10-2011 09:57 AM
Cheers John,
Managed to find a configuration that works,
Have a nice weekend
Ingram