george seifert Posted May 23, 2008 Report Share Posted May 23, 2008 I posted this on the NI forum and got one reply that I hope isn't true. Hopefully someone else here can confirm or deny it. I need to be able to sample up to 8 analog channels independently. For instance I need to start up a conversion in one VI and then in another VI start up another conversion on another channel - independent of the first conversion. I thought maybe the PCI-6143 should be able to do that because it has separate A/Ds for each channel, but when I tried it with a simulated device I get the following error: Error -50103 occurred at DAQmx Read (Analog Wfm 1Chan NSamp).vi:2 Possible reason(s): The specified resource is reserved. The operation could not be completed as specified. This is the same error I get if I use a more standard DAQ. If it can be done are there any examples that show how to do it? If not, does anyone know if anybody makes an A/D card that can do this? George PS, I did some more checking. It looks like I probably need an R series device to do the independent sampling. Quote Link to comment
Neville D Posted May 23, 2008 Report Share Posted May 23, 2008 QUOTE (george seifert @ May 22 2008, 05:15 AM) I posted this on the NI forum and got one reply that I hope isn't true. Hopefully someone else here can confirm or deny it. Error -50103 occurred at DAQmx Read (Analog Wfm 1Chan NSamp).vi:2 Possible reason(s): The specified resource is reserved. The operation could not be completed as specified. George Yes its true, since most cards have only 1 FIFO and 1 sample clock, you can't do it. You can sort of do it, by sampling all the channels at the highest rate that you need (in a group) and then have 1 loop or VI that acts as a DAQ server with all the data available, and different clients sampling different channels at required lower rates. Neville. Quote Link to comment
george seifert Posted May 23, 2008 Author Report Share Posted May 23, 2008 QUOTE (Neville D @ May 22 2008, 11:23 AM) You can sort of do it, by sampling all the channels at the highest rate that you need (in a group) and then have 1 loop or VI that acts as a DAQ server with all the data available, and different clients sampling different channels at required lower rates.Neville. Maybe that is a better way (at least cheaper) than using the FPGA - start up the A/D sampling all channels all the time and then pick what I need out of the buffer. Does that sound reasonable? Does the DAQ board use up processor resources transferring it's data all the time or does it only transfer it off the board when I do a read? George Quote Link to comment
Neville D Posted May 23, 2008 Report Share Posted May 23, 2008 QUOTE (george seifert @ May 22 2008, 09:39 AM) Does that sound reasonable? Does the DAQ board use up processor resources transferring it's data all the time or does it only transfer it off the board when I do a read?George Depending on your DAQ board, and the way you set it up: 1 Hardware timed (using the onboard scan clock) Uses a DMA channel(s) to dump data directly into computer memory without Processor intervention 2 Software timed (using a AI read VI in a while or timed loop) Reads the FIFO whenever you ask it to. The more expensive DAQ boards have multiple DMA channels for AI and AO. The multithreaded DAQmx driver is really good for the software timed reads/writes if you go that route. Neville. Quote Link to comment
george seifert Posted May 23, 2008 Author Report Share Posted May 23, 2008 Thanks for the help. One more question if I may. Assume that acquisition is always running - converting 2 channels. Is there a way to set it up so that I can read from one channel and (in another loop) read from another channel? The two reads would be asynchronous. It seems like reading from the one channel resets the buffer pointer so that when I try to read from the other channel it has to wait for the buffer to fill again. Somehow it seems like I need two buffer pointers to guide the two different reads. George Quote Link to comment
Neville D Posted May 24, 2008 Report Share Posted May 24, 2008 QUOTE (george seifert @ May 22 2008, 11:52 AM) Assume that acquisition is always running - converting 2 channels. Is there a way to set it up so that I can read from one channel and (in another loop) read from another channel? The two reads would be asynchronous. George Are you reading H/W timed? S/W timed? Are you reading both chans simultanously? Somewhere on the NI website there is an example showing how fast you can go with s/w timed loops and DaqMX, maybe you can go S/W timed and the two reads could then be separated into two loops (provided you don't expect too much accuracy on the timing and are not going too fast). Neville. Quote Link to comment
jdunham Posted May 24, 2008 Report Share Posted May 24, 2008 QUOTE (george seifert @ May 22 2008, 11:52 AM) Thanks for the help. One more question if I may. Assume that acquisition is always running - converting 2 channels. Is there a way to set it up so that I can read from one channel and (in another loop) read from another channel? The two reads would be asynchronous. It seems like reading from the one channel resets the buffer pointer so that when I try to read from the other channel it has to wait for the buffer to fill again. Somehow it seems like I need two buffer pointers to guide the two different reads.George You can totally do this. Hardware Scanning is nearly always recommended. And yes, you keep track of your own buffer pointers. The main trick is that in it's default mode, DAQmx.Read will remember the last point where it read from and start there. If you read from separate threads, you need to change the DAQmx.Read properties. I decided it was easier to describe all this in LabVIEW, so here you go. These are just code fragments, not tested or anything, but I've used these methods in many applications. http://lavag.org/old_files/monthly_05_2008/post-1764-1211516168.png' target="_blank"> Quote Link to comment
george seifert Posted May 24, 2008 Author Report Share Posted May 24, 2008 Thanks a million :worship: . Yes, seeing the code snippets is much easier than reading an explanation. I've got to do some digesting and experimenting, but it's helpful to know it can be done. I almost had myself convinced that I wasn't going to be able to do it. 10 lashes for not believing in LV! George Quote Link to comment
george seifert Posted May 24, 2008 Author Report Share Posted May 24, 2008 QUOTE (jdunham @ May 22 2008, 11:19 PM) I decided it was easier to describe all this in LabVIEW, so here you go. These are just code fragments, not tested or anything, but I've used these methods in many applications. I got it working. One minor oversight in your diagram in the middle example. I had to negate the offset value that feed into the "number of samples per channel" input on the DAQmx Read VI because it needs a positive value. Other than that it works like a champ. George Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.