LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Maintain last analog output value when switching physical channel

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

0 Kudos
Message 1 of 10
(3,905 Views)

Hi Mela,

 

why don't you attach your VI when you have problems with your VI?

How do you setup your DAQmx task(s)?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 10
(3,837 Views)

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 😕

0 Kudos
Message 3 of 10
(3,824 Views)

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

Message 4 of 10
(3,801 Views)

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 😕

0 Kudos
Message 5 of 10
(3,797 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 6 of 10
(3,757 Views)

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.

0 Kudos
Message 7 of 10
(3,747 Views)

Hi Mela,

 

as the NI9269 allows "simultanous" output on its 4 channels you should be able to create two independent DAQmx tasks in parallel. No need to stop/clear the AO0 task before starting the AO1 task…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 8 of 10
(3,705 Views)

When i do that i get the error -50103 "the specified ressource is reserved".

0 Kudos
Message 9 of 10
(3,430 Views)

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?


GCentral
Message 10 of 10
(3,254 Views)