LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read / write multiple channels on a Real Time PXI target with a 6259 board

Solved!
Go to solution

On a real time PXI target, I have been unable to access more than one channel at a time.  The attached example shows the issue, when the second analog read occurs, I get a "resource is reserved error".  This is my first real time challenge and not sure how to proceed.  Ultimately I need to read three Analog Input channels and one Analog output channel in the real time loop.  Thanks for any assistance.

0 Kudos
Message 1 of 9
(3,226 Views)

Did you get error -50103?

 

Search the forums for error 50103 and you'd have your answer.

 

You need to put both analog input channels into a signal task.

0 Kudos
Message 2 of 9
(3,222 Views)

Thanks for the quick answer, unfortunately I don't believe putting both analog input channels into the same task will do it...  See attached.  The ao0 channel is wired to the ai1 channel, but I am getting readings for ai0 which is not wired to anything.  I suspect the issue is the 6259 does not do simultaneous reads.  How do I deal with that?

0 Kudos
Message 3 of 9
(3,220 Views)
Solution
Accepted by topic author Dave@Ventec

Yes.  You need to put both analog input channels into one task.  There is only one clock for reading analog inputs.  If you use it for one task, that clock is reserved and the other task can't use it.

 

What does having it connected to an analog output channel have to do with it?  If the ai0 is not connected to anything, why are you trying to read it?

 

The reason you are seeing something on that channel is that you are seeing the residual value from reading the other analog input channel.  When you have an open circuit, the amplifier can't charge or discharge to another value, so you are seeing a ghost of the other channel.  Wire the unused analog input to ground and you will see the reading would be zero or very close.

0 Kudos
Message 4 of 9
(3,218 Views)

"What does having it connected to an analog output channel have to do with it?  If the ai0 is not connected to anything, why are you trying to read it?"  Because I want to read multiple channels, and will have something connected to it.  Just trying to do a simple demonstration of my understanding - or lack of it in this case.

 

Wiring the channel to ground worked exactly as you indicated taking the reading close to zero.

 

Thank you for your help and explanation!!

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

More frustrations....  When I used suggested approach in my application...  I do not get any errors BUT I do not get any data at the NChan 1Samp read either.....  Any suggestions??  Screen shot of appropriate portion of vi attached....

0 Kudos
Message 6 of 9
(3,212 Views)

Found the problem in another part of the vi - the multiple read is working!!  Thanks again.

0 Kudos
Message 7 of 9
(3,204 Views)

Get rid of the shift register on the error wire.  If you ever do have an error, then it will perpetuate forever and will keep the DAQmx Read from executing.

 

I have no idea why it would be working fine before and would not be working for you now.

 

Do you still have the analog output wired to analog input 1, and analog input 0 wired to ground?  Right now your index array is getting the data from analog input 0.  Are you actually reading nothing?  Or are you reading zero?

0 Kudos
Message 8 of 9
(3,202 Views)

Getting rid of the shift register on the error wire really helped!!  The read is working correctly now.  Thanks again for the timely and accurate assistance!

0 Kudos
Message 9 of 9
(3,200 Views)