LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

analog inputs and digital outputs usb 6009

Solved!
Go to solution

I am having an issue with programming my usb 6009 in labview.  I am attempting to continuously read analog inputs while also having an event driven digital output within the same program/vi.  Basically, I need to continuously sample the analog inputs while having a user defined event (button control) to signal the digital inputs to turn on then off after a specified period of time.  The digital output event needs to be independent of the analog sampling scheme.  I have been throwing the 'resource already allocated error' in most of the vi's I have written trying to accomplish this.  Is this programmatically possible with the usb 6009?  I am at my wits end trying to accomplish this and any help would be greatly appreciated (by myself and my boss).  Thank you for your replies in advance.

 

RJ

I surf therefore I am....
0 Kudos
Message 1 of 15
(5,263 Views)
it's posiible..what exactly do you need? can you post your vi...
0 Kudos
Message 2 of 15
(5,256 Views)

I am not familiar with what you are asking.  Here is a simple test VI I am working on to test my theory.  It is throwing an exception right now.

I surf therefore I am....
0 Kudos
Message 3 of 15
(5,252 Views)

Here is the same VI modified with some documentation to better explain.  The second while loop drives the digital output, port0 will be given a 00000001 1D array which will bring line 1 high.  Then I need to go and read some values from the associated analog input that is continuously being sampled in the other while loop.  Is it starting to make sense?  My apologies if I am being vague.

I surf therefore I am....
0 Kudos
Message 4 of 15
(5,242 Views)

@surferEE wrote:

  ...It is throwing an exception right now...


you mean an error? try this....clear task need to be on the outer parts of the while loop. i try and stay away from those Daq express. you can write and read at the same time in a while loop.

 

Spoiler
analog_digital_test1[1]_BD.png

 

Spoiler
analog_digital_test1[1]_BD.png

 

0 Kudos
Message 5 of 15
(5,240 Views)

It is now, please see updated VI.  

I surf therefore I am....
0 Kudos
Message 6 of 15
(5,238 Views)

Wow, I see you are reading from the analog input without creating the channel.  I will try this approach and post my results.  Thank you.

I surf therefore I am....
0 Kudos
Message 7 of 15
(5,220 Views)

Apok,

What is the VI in the upper left that you are using?

I surf therefore I am....
0 Kudos
Message 8 of 15
(5,217 Views)

@surferEE wrote:

Wow, I see you are reading from the analog input without creating the channel...

What is the VI in the upper left that you are using?......


you still have to create a channel...that's just what it looks like when you want to unpack n generate code from the Daq express, have a look at the NI Example Finder under 'Hardware Input and Output' under Daqmx section(Analog Input/Voltage-Sw-Timed Input.vi and Digital Output/Digital-Sw-Timed Output.vi) ..it should follow as 'create channel(ouside loop), start task(outside loop), read and or write(inside loop) and 'clear task (outside loop)

0 Kudos
Message 9 of 15
(5,216 Views)

I created the channel now I am not getting any readings on AI0-2.  I have attached the VI.  Thank you for your help Apok!

I surf therefore I am....
0 Kudos
Message 10 of 15
(5,206 Views)