LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

write different values to DAQ

Hi, I am using NI PXI 4461 DAQ card. This card has 2 output channels

 

I would like to write a sine wave to channel 0 and DC output to Channel 1

 

Could you please let me know how should I set the DAQmx functions to do this

 

My other quetion is , can I set and write to 1 channel and then while the other acquisition is running set the other one?

 

or I will get driver is in use error

0 Kudos
Message 1 of 14
(2,668 Views)

I would greatly appreciate your help

0 Kudos
Message 2 of 14
(2,626 Views)
Since both channels have to written with a single task, just make an array of the same size but with the same value for each element.
0 Kudos
Message 3 of 14
(2,620 Views)

As long as you don't use the sample clock on the DC Analog Output, I think you can do this.  Just put the two channels into different tasks.  Here is a quick example I put together to try it out.  Of course, I'm using a simulated 6225, so your mileage may vary.


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 4 of 14
(2,610 Views)

The problem I should be abale to write to both lines in the while loop because I do initialization in one VI and then should be able to write to both at the same time.

 

Could you please let me know if it is possible to write to both in the while loop. I have tried in my program I still get resource is resreved error

0 Kudos
Message 5 of 14
(2,590 Views)
Thanks crossrulz. I didn't know you could use a separate task if it was single sample.

Tintin,

You've been told that it is possible. If you are continuing to not understand and still have problems, you need to post your code.
0 Kudos
Message 6 of 14
(2,584 Views)

@Dennis_Knutson wrote:
Thanks crossrulz. I didn't know you could use a separate task if it was single sample.

Then where's my Kudo? Smiley Wink

 

 

 

Tintin,

You sure can write to both inside of the While loop.  They just won't exactly update at the same time.  That is the issue with having seperate tasks.  But for the applications I have ran into, the time difference doesn't matter.


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
0 Kudos
Message 7 of 14
(2,558 Views)

Hi Crossrulz

 

I have just realized even when I run your code I get this error inside the loop after running DAQmx Write ( 1 sample ) 

 

Error -50103 occurred at Untitled 1

Possible reason(s):

NI Platform Services: The specified resource is reserved. The operation could not be completed as specified.

Task Name: _unnamedTask<29>

 

This problem might be specific to this DAQ card. I am using 4461

0 Kudos
Message 8 of 14
(2,550 Views)

tintin_99 wrote:

This problem might be specific to this DAQ card. I am using 4461


I just tried a simulated PCI-4461 and got the same error as you.  You will have to put the two channels into a single task and change the values together.


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
0 Kudos
Message 9 of 14
(2,543 Views)

@crossrulz wrote:

@Dennis_Knutson wrote:
Thanks crossrulz. I didn't know you could use a separate task if it was single sample.

Then where's my Kudo? Smiley Wink

 

 

 

Tintin,

You sure can write to both inside of the While loop.  They just won't exactly update at the same time.  That is the issue with having seperate tasks.  But for the applications I have ran into, the time difference doesn't matter.


the 4461 won't support single sample on demand so, in this case, Dennis is correct.  Both channels will need to reserve the sample clock so, 1 task two channels is the only option for this device.  (Unless you WANT errors):smileywink:

 

"the specs are harder to read but that is what "

[EDIT] Aren't crossing posts fun?  I see I didn't add much you didn't find out on your ownSmiley Wink


"Should be" isn't "Is" -Jay
0 Kudos
Message 10 of 14
(2,541 Views)