01-04-2012 08:14 PM
Are you saying that in one VI I can't create two virtual channels off the same device?
I have included a MAX report along with two VIs for you to peruse.
"Cont AI Mult Chs DAQ VIs" is an example that creates a task and then a virtual channel and then starts timing. This VI works OK.
The other VI, Cont AO with DAQmx API, is a similar example code but for analog output instead of input. When the create task VI is diabled the code runs OK. But on this case what task is being used to run this program: a voltage, current, thermistor, or whatever? There is no task in the code anymore that selects a task. When I enable the creae task subVI I now generate error 200371. How is this VI so different than my other VI?
01-05-2012 12:46 AM
01-05-2012 03:36 PM
The first VI, Cont AI Mult Chs DAQ VIs, is a working example that seems to do what you are telling me that I cannot do! This VI starts out with a create task vi with a Voltage task that was created in MAX and then I connect the output of this VI to a create virtual channel vi, which is what you are telling not to do as it will give me this problem. The problem here is that what I have done is a running VI with no errors and it works just fine!!! The other VI, Cont AO with DAQmx API, is coded in exactly the same way as I did in the first piece of code except I used a different task out of MAX coupled into the create task VI, but this VI does not work. I also have the task in the bad code using an output task and used a device that allowed for analog output. So why is the first piece of code running with no problem and the second piece of code not working? That is the million dollar question. Look at both pieces of code and tell we where I'm wrong.
And one more thing, if I don't wire in a task how will the create channel VI be able to figure out what kind of measurement that I want to take.
01-05-2012 03:50 PM
Have you actually looked at the Create Channel function? Don't you see the 'AI Voltage', 'AO Voltage', etc in the polymorphic selector? Didn't you change this in your own code? Don't you think this is how you actually select the type of measurement?
Do whatever you want. I've never defined anything in MAX before using the DAQmx Create Channel and I've never done anything except wire in the physical channel input.
You've posted so many different threads on this subject (many of them where you say you attached something and never did) and so few actual VIs that I really don't know what you have and have not done and what you claim that works and does not work any more.
01-05-2012 06:13 PM
Yes, I have looked at the polymorphic selector and it is configured
accordingly to the type of VI I am coding; ie, input or output. As
far as posting so many threads I did make a lousey post a while ago
where the name of the thread was an obvious typo so I went back to
this and appologyzed for the naming error and reposted this and
completed the thread since I thought that was the appropriate thing
to do.
Now if you go back to the post that I made on 1/4/2012, which is
part of the current thread, there you will see the posts: one for
the MAX report generator so it can be seen what I have done in MAX.
Also I think you will find that there are two other posts in this
message that contain the two VIs that I have been working with, and
they both are done using the create task VI and then the create
virtual channel VIs in the beginning of the code examples. One
works and the other does not!
01-06-2012 02:13 AM
Hello Cuthbert,
I don't really get what you're trying to do with this VI.
You wire a certain existing task to the task to copy input of the DAQmx Create Task VI
This means that you copy all the configurations (including the already defined physical channels in the existing task in MAX).
After this you try to readd the same (already existing) channel to the new task.
I do not really understand why this is necessary in this case.
Can you also upload the actual VI's?
I only see screenshots of these VI's attached to the posts.
01-06-2012 08:35 AM
Dear Thierry:
Here I have included the VIs. The first one, "Cont AI Multi Chs DAQ VIs" is an example that is actually working. The second one "Cont AO with DAQmx API" is the example that I am having trouble with. They are both coded in the same manner. In the code for the AO example there is a diagram disable structure, and when it enabled for the create task VI I get the error code 200371. When the create task section is disabled the VI works, and I really do not get why this is happening since I am doing just about the same thing in each VI.
Incidentally, last night I discovered something about LabVIEW that I did not know before and it pertains to the subject we are discussing. I created a blank VI and put a task constant on the block diagram, selected the task that I made in MAX, and then right clicked the constant and found that I could select "Generate Code" -> "Configuration and Example" and much to my surprise a new VI was generated that contains just about everything that I have been trying to do for the past couple of weeks! This generated VI uses all the same sub VIs as I do in my example code, but there is one difference: the new VI creates an unnamed task; ie, there is no task input to the subvi. The rest of the code creates a virtual channel where the physical channels and name to assign inputs are entered via string constants: the physical channel has the device name from MAX that is associates with the task that was created in MAX, while the other input is the task name that was created in MAX. This is a little different than what I did by creating a task with a task constant input that contained the task made in MAX and no inputs to the create virtual channel VI. Obviously the newly generated VIs work and I can see how they work. It still is point of amazement to me that the two VIs that I made and sent to you don't both actually work!
01-09-2012 06:36 AM
Hello Cuthbert,
In both cases you are trying to add new channels to your existing channel(s) in the defined task.
Please keep in mind that if you do this, then as well the "configuration" in the original task as the "configuration" that you define in the VI will be executed/used.
Analog Input case:
Here it is possible to do this and you will not have an error because reading two times exactly the same input is possible and this is also what you are doing in the VI. That's why you see two coloured lines on top of each other in your plot.
Analog Output case:
It is not possible to add to your existing ao3 task another channel that should control ao3 (that's what you're trying to do in your code).
In this VI you are trying to "Control/drive" one analog output (ao3) with two different virtual channels in the same task.
This would also not be possible in 2 different tasks.
Only one virtual channel can "control/drive" a certain analog output at a certain moment in time.
However, what you can do is drive 2 different analog outputs (eg. ao0 & ao3) with one (or 2 different) virtual channel(s) inside one task.
I don't think that this is what you wanted to do.
Also note my previous post: about the "task to copy" input you are wiring.
It copies an existing task and all its configured virtual channels and allows you to add new virtual channels to it.
Do you now see clearly why this is not possible?
04-03-2019 11:54 AM
Hello,
I got the same error, so I tried your solution and it worked. But the signal is running slowly, and the simulation takes much time to finish. Do you know why occurs this? And how can I solve this?