Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Why is my Sample Rate not matching my timer?

I can't seem to get my sample rate any faster than 5 or 6 Hz regardless of what I set my timer to be.  If I set it slower than that, it does record slower.  It is asif there is a hardware limitation of the computer that LabView is running on.  I am using a SCXI-1102,1303, and DAQ6036E as my hardware, and I'm sampling 25 channels.  With that setup I should be capable of sampling greater than 1000Hz.  I am at a loss.  My .vi code should be attached below.  If anyone could take a look at it and tell me what I might be doing wrong it would be greatly appreciated.  

Thanks
Download All
0 Kudos
Message 1 of 5
(3,557 Views)
You are using AI Sample Channel completely inappropriately. Every time it gets called, you do an AI config and you call this 20+ times with each loop. You do realize that you can have multiple channels read with a single scan don't you? If for some reason you can't use DAQmx, then just put the AI Read One Scan in your top level VI with all channels defined at once and with the iteration input of AI Read One Scan wired to the 'i' terminal of your while loop. However, you should first verify that your DAQ board is supported by DAQmx and if it is, use that. All of your scaling and offsets can be defined in MAX or in the VI for a task and that will make your program a lot simpler as well.
0 Kudos
Message 2 of 5
(3,543 Views)
Hello,
 
I agree with Dennis' assessment that the fact that you have so many AI Sample Channel's in a while loop is causing the slower behavior.  If you double click on each VI and dig down a couple levels, you will see that in fact you are configuring each channel every single iteration of your loop.
 
The 6036E devices should support DAQmx, if you haven't installed it already.  You can cross reference this data sheet to find exactly what device you have, and which versions of our DAQ drivers will work with that (operating system dependent). 
 
As for the programming methods, I believe that Dennis has already detailed a more practical way to program your application.  It shouldn't be too much of a change; you'll just need to modify that first part of the program with the data acquisition steps. 
 
Good luck, and let us know if you have any other questions along the way,
 
Regards,
 
Daniel L.
Applications Engineer
National Instruments
0 Kudos
Message 3 of 5
(3,520 Views)
Dennis and Daniel, thank you very much, conceptually, I understand what you are saying.  This .vi was originally written in LabView 6.0 and none of the DAQmx commands were available and this is all new to me now.  I now realize using the AI Sample Channel along each line is wasteful.  What I'm having a hard time now doing is physically connecting the 25 Channels into the AI Sample Channel in the block diagram, there must be some method of combining all of the channels into an array or something or how is it that they get wired to a single AI Sample Channel Block, I can't seem to find blocks with the same color wires.   I understand the concept, but not how to physically do it in the block diagram.  I apologize if this should be a simple concept, I am just not familiar enough with all of the LabView blocks. 

Thanks again.
Trevor
0 Kudos
Message 4 of 5
(3,511 Views)

With DAQmx, it's really easy. You can specify multiple physical channels as Dev1/ai0:2 (channels 0 through 2) or Dev1/ai0,Dev1/ai2,Dev1/ai4 (channels 0, 2, and 4 only). You can easily create a single task in MAX that contains multiple channels. With traditional DAQ, if I remember correctly, you use something like 0:4 for channels 0 through 4 for example.

There are numerous shipping examples for DAQmx. Take a look at them and modify as needed.

0 Kudos
Message 5 of 5
(3,503 Views)