cancel
Showing results for 
Search instead for 
Did you mean: 

concurrent analogue reading

LABMAT
Member

concurrent analogue reading

Message contains an attachment

Dear all,

 

I am desperately in need for some help.

 

I am doing a project where 4 batteries can be tested simultaneously.,

 

right now, I have the program coded as shown in the Vi attached below. But when I try to run it it shows NI-DAQmx Error -50103 "The Specified Resource is Reserved" error.

 

I came to know that the error was caused when I was trying to read multiple tasks at the same time. what are your thoughts on this. the program works when just one channel si read, but not when more than 1 is read simultaneously.

 

Thanks,

 

Labmat

18 REPLIES 18
RavensFan
Knight of NI

Re: concurrent analogue reading

It is pretty clear what you need to do.  You need to combine the reading of all 4 channels into a single task.  I would make that its own loop and pass the values of each channel off to the various state machine loops as a notifier.

 

(PS:  Check the spelling on your front panel.  It should be "dissipated".)

LABMAT
Member

Re: concurrent analogue reading

Hi,

thanks for the spelling update and also for the reply.

 

I read it in the knowledge base that if we wire 4 of the Create Channel Vi in series followed with a Start task vi, we could do combine all 4 of them into one channel. But after doing that, where do we read the single values from the channels? do we read it inside the loop or outside it?

 

thanks,

 

Labmat

SLee2004
Member

Re: concurrent analogue reading

I looked at the code and you can't read analog input channels from the same device at different locations. You can read multiple channels from the same device at one location/vi. If you need to read multiple channels at the same time in different VIs, you can use global variables or shared variables to pass analog input data from one analog input read VI.

LABMAT
Member

Re: concurrent analogue reading

Hi SumTom,

 

thanks for getting back to me. Is there any way yourself or anyone could demonstrate this on my Vi as im a bit lost with the last comment

 

thanks,

 

Labmat

RavensFan
Knight of NI

Re: concurrent analog reading

One task.  Have 4 channels entered into the channel constant for the Create Task.

 

Use Read N channels, 1 sample for your Analog Read.  Then you can use Index Array to break out the individual channels from the array.

 

Search LabVIEW examples (Example Finder in the help menu) for numerous DAQmx examples.

 

Also search the forums for "error 50103"  (drop the negative sign since that interferes with the search engine), where this question has come up thousands of times before with messages on how to fix the problem.

LABMAT
Member

Re: concurrent analog reading

Ok.

as you can see in the code, I am doing the analogue read within each loop. So, this is how I got it set up now.

 

Multiple channels: One task ------->>> DAQMx Start task.vi ------->>> Loop1(analogue read - N channels, 1 sample) ------>>> clear task

 

Is this how you meant it?

 

thanks,

 

Labmat

SLee2004
Member

Re: concurrent analog reading

Message contains an attachment

I made some changes to your code showing an example of how you can implement the analog input reads. I am using local variables to transfer the data between the parallel loops (just be aware of the race conditions and performance problems of local/global variables.) In this case, your VI is not too complicated so I don't see harm in using local variables to pass information.

RavensFan
Knight of NI

Re: concurrent analog reading


@LABMAT wrote:

Ok.

as you can see in the code, I am doing the analogue read within each loop. So, this is how I got it set up now.

 

Multiple channels: One task ------->>> DAQMx Start task.vi ------->>> Loop1(analogue read - N channels, 1 sample) ------>>> clear task

 

Is this how you meant it?

 


No, that is not at all what I meant.

SumTumWong shows in his VI what I meant.

 

By the way, you don't need two create channels.  You can get by with one if you put "Dev1/ai0:1" into the channel constant.  (meaning Dev 1 analog input channels 0 through 1".  If you click on the channel constant and choose Browse, it will let you select multiple channels.

 

LABMAT
Member

Re: concurrent analog reading

Hi Sumtong,

 

Can you please upload the file in 2011 format as I dont have the 2012 verson with me.

 

thanks,

 

Labmat