LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I program more than one VI in one main VI?

Hi Dennis:
 
This is what I did.  I took away the AI part of the VI, and just had the AO part.  It works great.  I already have the AI part running in  a separate VI with while loops.
 
Thanks,
 
Mizar
0 Kudos
Message 21 of 29
(1,086 Views)
Hi Dennis:
 
Now, I have the for loop in a while loop in the main VI.  I cannot control the for loop that way.  Do you have any suggestions?
 
Thanks,
 
Mizar.
0 Kudos
Message 22 of 29
(1,079 Views)

The best suggestion I can make is that you first take the LabVIEW tutorial and then a class.Smiley Wink

What you've done is have the AO step through all of it's values and then you take the analog in readings, though actual order may be just the opposite since you have no dataflow connections between anything. If you really want to step, take a measurement, wait, step, etc., move the ai reads into the for loop or move the ao out of the for loop and into the while loop. If you want to use a while loop, you are going to have to index the value array differently. With a constantly running while loop, you would need to index out each element and then start over again at element 0. That is why my origianl example had just a for loop. It would step through each value and then stop. You also need to add some dataflow to control when you make you ai readings. As it is now, ir could be before or after the ao step. That is also why I used the lower level DAQ functions. They have error in/error out connections so that the wiring will define execution order.

Message 23 of 29
(1,068 Views)
Here's what I think you might want to do. First of all, I got rid of the while loop and put everyting in a single for loop. If you want to run continuously, say so. The simplest way to make that mode is just to put a while loop around everything. The second thing I did was use a single AI Sample Channels for both channels. There is no reason to use two different ones. The third thing I did was to use a sequence structure with the error cluster passing through it. This forces the AI read to happen after you step the voltage. I also cleaned up the Write to Spreadsheet File. I put in a File Dialog function so that you would not get prompted for a file name with each iteration and I made the Write to Spreadsheet append each new result to the previous. The way you had it, it would overwrite any previous data.
0 Kudos
Message 24 of 29
(1,059 Views)

Hi Dennis:

 

Thanks a lot for your help.  You are really good at this.  I am going to educate myself with LabView.  I had one last question at least for today.  What do I have to do to read to two input channels and save them in the VI you had sent me?

 

Thanks,

 

Mizar

0 Kudos
Message 25 of 29
(1,051 Views)
Looks like I didn't set the ai channel control to a default of 0,1. Do that and run it.
0 Kudos
Message 26 of 29
(1,047 Views)

Hi Dennis:

 

How exactly do I go about doing that?

 

Thanks

 

Mizar

0 Kudos
Message 27 of 29
(1,042 Views)
First, type in your channel list (i.e. 0,1). Then go to Operate>Make Current Values Default. Save the VI. This isn't strictly necessary for you. You can just try to remember to enter the correct channel list each time before running. I just assumed that you were having problems because when I changed from two different ai reads and didn't change the channel control, you were only seeing 1 channel's worth of data.
0 Kudos
Message 28 of 29
(1,031 Views)

Hi Dennis:

 

It works!.  Thanks a lot for all your help.  I greatly appreciate it.

 

Regards,

 

Mizar.

0 Kudos
Message 29 of 29
(1,028 Views)