LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Only 1 VI can run at the same time?

Solved!
Go to solution

Hi there, this is for my school project which requires to acquire analog input from 2 sensor circuits(1 with LDR,1 with LM35 for temperature sensing) and generate an output so that a light bulb would light up if the voltage in the LDR circuit is too low and a fan would be turned on if temperature is over a certain limit.

 

I managed to come up with the VIs and it worked independently but when i try to integrate it only the LDR circuit worked, and i could not troubleshoot it.

Attached is the 2 VIs that i come up with and another VI which i tried to integrate but failed to work properly.

 

Thanks

Download All
0 Kudos
Message 1 of 9
(3,712 Views)
And you are getting a resource reserved error. Did you try to search for that error or error code. If you had, you would have seen that it is a verhy, very common mistake that you have made. You simply cannot have mulitple tasks running on the same hardware. You have to combine your channels and have a single analog read and a single analog write.
Message 2 of 9
(3,695 Views)

Hi.thanks for your reply i'm using labview 8.5 and USB6008 and it dosen't shows any resource reserved error and the VI can be run properly and how would i go about combining the channels since i have 2 circuits connected to the DAQ which i need to read the 2 analog input signal from the circuit and generate analog outputs to the circuit? If i only can have 1 analog read and analog write in the VI wouldn't that be impossible to show the 2 different analog input and output as the value are different?

 

Thanks

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

You need to create a DAQmx task to be able to read two voltages from two AIs on the same device.  Same for writing two AOs on the same device.  Here is an example of how to create a DAQmx task.  Create one task for AI and another for AO.  You must set the AI Read and AO Write to Multiple Channels - Single Sample - 1D DBL.  The first element in the 1D array will correspond to the first element in the List of AI Channels array shown in my example:

 

CreateTask.png

 

Here is another tip.  On the loop borders, change the DAQmx task/channel in/out and the error in/out terminals to shift registers.  Using shift registers here is good practice recommended by NI.  The reason being is this.  If there happens to be an error in one loop iteration, the error gets lost with regular terminals because the input terminal will have no error condition.  On the next iteration, the error from the previous iteration is lost.  For the task in/out terminal, if the task changes, you will lose the change.  Shift registers will propogate all errors and changes to the next loop iteration.  Another reason is if the loop runs 0 times (doesn't run at all).  The outputs will be default values.  So if there was an error coming into the loop, it will be lost if the loop does not iterate at least one time.  So use shift registers here.

 

One more thing, change your numeric type to DBL inside your case structures.  Notice the coercion dot (small red dot) on the input to the DAQmx Write funtion.  It is expecting a DBL data type.

 

OK, just one more.  Your output from AI Read is a DBL data type.  You can't have a DBL input to a case selector.  Notice again the red dot on the case selector question mark.  Labview is converting the DBl to an integer (probably an I32).  You may have rounding off errors.  You should round off and change to an integer before the question mark so you know exactly what the outcome will be.  What if the AI Read outputs 0.5 votls?  Will the 0 case be executed, or will it be the 1,2 case?  What if the voltage is 2.5?  Which case will be exectuted?  You should fix this.

 

I think that is enough for now.  Smiley Wink

 

- tbob

Inventor of the WORM Global
Message 4 of 9
(3,648 Views)

Hi,

 

How about the physical channel at the DAQmx Create Channel VI? The program can't be executed if it's not wired up and i don't know which channel to choose from since i'm acquiring from 2 analog input.

 

Thanks

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

If u are geting problem in understanding this DAQmx VIs.. try DAQ assistant express VI.. it will show u dialog control and help u in configuring.. if u select more then one channel then just use split signal to split them..

 

Hope it helps

 

HS

0 Kudos
Message 6 of 9
(3,560 Views)
Solution
Accepted by topic author bloodxrage

bloodxrage wrote:

Hi,

 

How about the physical channel at the DAQmx Create Channel VI? The program can't be executed if it's not wired up and i don't know which channel to choose from since i'm acquiring from 2 analog input.

 

Thanks


Click on the little arrow on the right side of the physical channel control and select 'Browse'. Use Ctl-click or shift-Click to select mulitple channels.

Message 7 of 9
(3,539 Views)
Thanks for all your replies i have managed to acquire the 2 analog signal now i just need to work on the output.
0 Kudos
Message 8 of 9
(3,501 Views)

Hello i'm using the same sensors but i don't know how to connect the LDR sensor to NI mydaq can you help me please to get data and save it into a data base so i can compare (measerment) in the next year please help me 

0 Kudos
Message 9 of 9
(2,801 Views)