11-30-2009 09:07 AM
Hi
With a PCI6221 card, I need to acquire the 5 first channels in differential mode.
I acquire with finite samples (10 samples - 1kHz then mean).
What I want to know: In my main VI, I have 2 loops with are running in parallel
In the first one, I want to acquire the 4 first channels
In the other one, I want to acquire the fifth channel
Each loop is running with a different timing, my 2 different acquisition will never happen at the same time.
As I use the same card for my acquisition, is is possible to use 2 different daqmx tasks and make it run in parallel?
If so, this is perfect
If not, how could i proceed?
PS : I have not the material in front of me (so I am not able to test directly) and I need to modify the software without testing by remote
Thanks in advance for your answers
11-30-2009 09:17 AM
You can do this but you will have to stop and clear the task in the first loop then start the task and read in the second stop and clear the task in in the second loop then start and read in the first loop.
This would be very inefficient.
Why can you not read all of the channels at the same time and ignor the data that you do not want. You have not explained your problem clearly so it is hard to give much more help.
12-01-2009 08:05 AM
Hi
Thanks for your answer
I would like to have 2 loops working parallel
- 1 loop :fith channel to acquire (10 samples at 1 kHz then mean) every 2 seconds (for setting of orders) then supervision every 15 seconds
- 1 loop :third channel to acquire (10 samples at 1 kHz then mean) every 1.5 seconds (for setting of orders) then four first channel to acquire (10 samples at 1 kHz then mean) triggered by a global variable (variable itself triggered by an inductive sensor which is wired to a a PCI card I/O 24VDC). On this loop I check my global variable every 5 ms.
In the end, i am only able to handle those tasks only in parallel as, if my tasks were handled separately, there would be always one moment when I get 2 acquisitions at the same time.
How can i proceed?
Your suggest is to acquire all datas at the same time and then pik up dats needed.
In that case, it would be me similar to make something like a server for data acquired.
As I need to check for acquisition every 5 ms, it means that I would have to acquire my finite samples continuously?
Could you tell me more about what you are thinking about?
Thank you
12-01-2009 08:55 AM
jeanneau wrote:Hi
Thanks for your answer
I would like to have 2 loops working parallel
- 1 loop :fith channel to acquire (10 samples at 1 kHz then mean) every 2 seconds (for setting of orders) then supervision every 15 seconds
- 1 loop :third channel to acquire (10 samples at 1 kHz then mean) every 1.5 seconds (for setting of orders) then four first channel to acquire (10 samples at 1 kHz then mean) triggered by a global variable (variable itself triggered by an inductive sensor which is wired to a a PCI card I/O 24VDC). On this loop I check my global variable every 5 ms.
In the end, i am only able to handle those tasks only in parallel as, if my tasks were handled separately, there would be always one moment when I get 2 acquisitions at the same time.
How can i proceed?
Your suggest is to acquire all datas at the same time and then pik up dats needed.
In that case, it would be me similar to make something like a server for data acquired.
As I need to check for acquisition every 5 ms, it means that I would have to acquire my finite samples continuously?
Could you tell me more about what you are thinking about?
Thank you
Acquiring finite samples continuously is a bit of an oxymoron. I would set it to Continuous Samples and just give it a try. The worst thing that will happen is you'll run the buffer dry and get an error. Also, what's your clock speed? 5mS seems fast! You're likely reading stale data.
12-01-2009 08:59 AM
I would suggest you not to switch between tasks except you have plenty of time for the switching (which is about at least 500ms in my opinion)!
The better approach would be to acquire all channels you need in a single task, store the data in a communication layer. Your loops simply fetch the values from the communication layer if needed. Please remember that the communication layer has to discard old samples or otherwise, you will run into memory issues very fast!
hope this helps,
Norbert
12-01-2009 08:59 AM
THat is exactly what I am suggesting in this case. Collect all of the channels that you require at 5 ms intervals. Index the arrays and check the timing for the different intervals. I would still have two loop. One to contain the data acquisition and one for data processing.
The data acquisition loop should collect all of the channels that you are looking for and send them to the data processing loop. The data processing loop should index the arrays and keep that data that is required for the time interval that is satisfied.
Collect all five channels
Set up logic to look for elapsed time for the three different channels sets 0-3, 4 and 5: (i.e. 1 sec, 2 sec 3 sec etc...)
If elapsed time for 0-3 is > or = to 1.5 seconds then keep this data and rest the elapsed time counter for these channels.
See Example
12-01-2009 09:29 AM
Hi all
Thanks a lot for your advice
aeastet, would you mind make compatible your example with LV 8.5 ?
I'm not yet fitted with LV9.
Thanks
12-01-2009 09:35 AM
12-01-2009 10:07 AM
aeastet wrote:
Here you go.
Top loop needs delay timer! 99% CPU.
07-01-2010 08:29 AM
I'm a little bit confused between the answers here and my own experience. I have run multiple daqmx tasks from parallel loops from a single device. For example, the attached code runs fine. Maybe it has to do with the fact that I am reading and writing on demand?
Ken