LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DC measurement and generation

Hello Guys,

 

I have a problem in DC measurement and generation and hope you can help me in this manner as I have studied different examples and couldn't find my problem.

 

The attached is the first part of my code:

 

using Ao/0:1 I want to generate DC voltage and after  the fisrt generation, to do a measurement by AI0, then change the amplitude of Ao0 and again doing measurement by AI0.... until the Ao0 get to the value that I set in the program that is 9.

when running the code I have an Error:

Error -200479 occurred at DAQmx Start Task.vi:2

Measurements: Specified operation cannot be performed while the task is running.

Task Name: _unnamedTask<3419>

 

 If I need any synchronization or case statement?

0 Kudos
Message 1 of 17
(3,133 Views)

Ok.  First of all, I think your program is begging to be a state machine.  Look them up...you'll like them!

 

Second of all:

 

Create all of your tasks outside the loop, before the loop starts.  Clear all of your tasks outside of the loop, after the loop stops.  If you are going to explicitly start your tasks, then you need to explicitly stop them also.

 

You specify a clock rate for your analog task but then you use "1 Channel 1 Sample", so you're using software timing...not hardware timing.  So you either need to use "1 Channel N Samples", in order to use hardware timing, or get rid of the clock.

 

IF YOU WANT CLOCKED INPUT (i.e. you want to use "1 Channel N Samples"), you will need to combine both of your analog inputs into one task, because you only have one analog input sample clock available.  Your clock configuration should also be outside the loop, before the loop starts.  If you do NOT want clocked acquisitions, you can leave the tasks separate.

 

Start with those suggestions, and post back if you run into more trouble.

 

0 Kudos
Message 2 of 17
(3,124 Views)

Hi Diane,

 

Thanks for your help.

Actually, I already noticed that I have attached wrong VI in my last post;Sorry about that.

Some of your suggestion had been applied to the correct VI  that you can see in the attached file, it works nicely without AI1 and I do not understand what is the problem when adding AI1.

 

BTW,I can't merge AI 0 &AI1 as they should work for different minimum and maximum values and I do not know how to apply the different min max values if I merge them !

 

Thanks for your help,

Ela 

 

0 Kudos
Message 3 of 17
(3,109 Views)

Help me out here.

 

When I run your VI, I don't get an error.  What is that feedback node for?  And PLEASE do not run your error wires from left to right.  Very bad form.

 

As I said, you really need to architect this VI properly.  Did you look at state machines?  I expect that improper architecture is the source of your issue, but without knowing quite what your issue is, it's difficult to help.

 

What, exactly, is the problem you are seeing?  What do you expect to see?

 

d

0 Kudos
Message 4 of 17
(3,105 Views)

Hello again,

 

The error that I see is :

 

Error -50103 occurred at DAQmx Start Task.vi:13 

Possible reason(s):

 

The specified resource is reserved. The operation could not be completed as specified.

 

Task Name: _unnamedTask<34B4>

 

 

The feedback is added automatically when I connect those two nodes and when I delete it, I have broken wires! 

Sorry, I am new in LV and if the wire connections are in bad form because I am a beginer!,

 

I attach  a new file for you, that works, I need to see this result if it helps you but adding a new AI 1 to make an additional measurement gives the message I have copied above.

 BTW, let me know what do u mean from bad wire connection and " do not connect your error wires from left to right" ? I have no idea. 

0 Kudos
Message 5 of 17
(3,100 Views)

I think what she meant to say was don't run your wires so that they run from right to left.  They should only run from left to right.  Dataflow along the wires should occur as if you were reading a page.  Going the other way just leads to confusion as to what code is dependent on other code.  In both VI #5 and #6,  you have a big error loop surrounding one of your DAQmx nodes.  Right click on that wire and do a cleanup

 

That is why you have a feedback node in #5.  You have 3 functions acting in a loop.  At the bottom you have a DAQmx read,  let's call that A, to the left you have a formula node, call that B.  Just up from the bottom you have a DAQmx write, call that C.  A goes first,  B is dependent on A because of the orange wire that goes into the formula node at variable Vb.  C waits on the formula node because it is waiting on the orange wire that comes out of that at variable VBB.  But you have an error wire running from C to A.  A can't be waiting on C if C waits on B and B waits on A.  A big round robin loop.  Which node would execute first?  LabVIEW  "fixes" that by putting a feedback node in between, so now A is just waiting on the feedback node which is the error coming out of C from the last loop iteration.

 

Automatic feedback nodes were a bad innovation in LabVIEW.  Go to Tools/Options and turn them off.  With them off, you would have had a broken wire when you connected those errors and would have known to look for a problem.

 


For error -50103, you should really learn how to use the search function on the forums.  Search for "error 50103" and you would have your answer already.  You have different DAQmx tasks, but they are all trying to share a single resource which is the counter on the DAQ card.  You can't do that.  What you need to do is put all of your DAQ channels into a single task.  Look in the example finder for numerous DAQmx examples for various data acquisition scenarios.

0 Kudos
Message 6 of 17
(3,095 Views)

Thanks Ravens Fan...that is what I meant to say.

 

I still can't quite figure out exactly what the OP is trying to do.

Message Edited by DianeS on 03-12-2010 11:51 PM
0 Kudos
Message 7 of 17
(3,094 Views)
Thanks Ravens, Your comments were helpful to understand the data flow.
0 Kudos
Message 8 of 17
(3,064 Views)

HI, 

 

I have checked multi function signal measurements but I really need your help. I understand why that error happens but I do not know how to define the two AI channels in one task while one of them should be read in outer loop and the other one in inner loop .could u please give me a hint?

0 Kudos
Message 9 of 17
(3,037 Views)

Hi Elahetal,

What is the “multi function signal measurements” that you checked? Can you post the latest version of your VI? The latest posted only has one AI channel, and I see there are multiple iterations and I want to look at the same thing you are

Matt
Applications Engineer
National Instruments
0 Kudos
Message 10 of 17
(3,013 Views)