12-30-2019 04:40 AM - edited 12-30-2019 05:13 AM
Hello, i create a task for generate a finite samples signal on a first analogue physical (Ao0) channel but when i create an other task on an other physical channel (Ao1) to generate a new finite samples signal (different values/different rate) the last value generate on the last channel (Ao0) is not conserved but reinitialized. Can you help me ?
I have a cDAQ-9185 and a NI 9269
12-30-2019 05:44 AM
12-30-2019 06:11 AM
Hello, many thanks for trying to solve my problem. My .Vi is a state machine with a lot of things added during the years... I have attached a .vi representative of my problem. When i start it and it go to the second channel (Ao1), the first channel (Ao0) don't keep is last value generated but go to -10.33v. It realy help if the solution don't question the all structure of my program. My schedule is very short 😕
12-30-2019 07:09 AM
Read the help on DAQmx Clear Task (the 5th DAQmx function that releases all of the resources for AO0). If you leave the Task "live", I would expect it to hold its final value, while if you Clear it, I would expect it to return its output to a "default" (or other non-specified) value.
Bob Schor
12-30-2019 07:40 AM
Thanks bob,
But how i can leave the task Ao0 "live" and create another one for the second Ao1 ? I try with "DAQmx Control task" but with no success. The only solution i have for the moment is attach at this message. But it's very crappy and it's don't fit very well on my program 😕
12-30-2019 08:40 AM
Since it looks like you sample rates are the same, why not just combine both channels into a single task? Then you have full control over both channels at all times.
12-30-2019 09:02 AM
No its for the example sorry for the confusion it need to accept : different rate / different size of samples / different value ...
But it one after the other, the only condition it's to maintain the last value generated.
12-30-2019 10:41 AM
12-31-2019 01:25 AM
When i do that i get the error -50103 "the specified ressource is reserved".
12-31-2019 02:16 PM - edited 12-31-2019 02:17 PM
I would suspect that although you can simultaneously control the values output to each of the channels, you cannot create separate tasks for them.
I'm using a cRIO-9045 and NI-9223 AI module (not the same module, and perhaps not even the same architecture based on the specifications, I think... but anyway) and I haven't seen a way to sample at different rates for different channels without directly programming on the FPGA (which I've elected not to do, in favour of DAQmx on RT and then oversampling one channel and ignoring some values. Maybe I'll average them in the future...)
On the other hand, you should be able to set up a single task with all of the channels you need, and stop the task, change the rate, and restart (without Clear and Create Virtual Channel calls) without an issue (I think...).
You would then have to write a constant value (and remember what it should be) for each channel that isn't active but is "previously active", or however you might phrase it.
A specific module of code (class, library, Actor, etc) to do this would probably be helpful...
That should get you where you need, no?