LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQMax as variable

Hi,
 
In my vi, I used DAQMax to create a subvi (let's call it DAQMax_motor) to control a motor thru a USB6525. The input data to DAQMax_motor is a boolean (True/False). In the vi, there are several sub-sequences. In one of the sub-sequences, I set the input data to DAQmax_motor to be "TRUE", and in the other the input data to DAQmax_ motor is set to "FALSE".
In my current vi, I copied and pasted DAQMax_motor in those two sequences and link them to "TRUE" or "FALSE" boolean depending on the sub-sequence.
I would like to change that. I tried the following: the DQMax_motor subvi is outside the sequence and the TRUE/FALSE commands in the sub-sequences are both connected to it. However, it does not work.
 
I am thinking that may be there is a way to set or convert DAQMax_motor subvi as a general sub-function that can be accessed at any moment. Therefore, I would not need to copy/paste the sub-vi everytime I want to use it. I suspect that by doing so, the response time would be improved.
 
I hope it's clear.
 
JM
 
0 Kudos
Message 1 of 4
(3,473 Views)
 

Hi jmb22,

 

 

Do you think you can post a screenshot of your block diagram? I am having a hard time understanding what you are trying to do. A subvi is not a special kind of vi. You can call any vi as a functional block in another vi's diagram. If the vi you are going to call has inputs/outputs, you have to define its connector pattern (right click on front panel icon) to be able to wire data to/from it in the main vi's diagram. Note that you will still be able to run the vi separately, which is a good feature for debugging. You can then just drag and drop the vi from file explorer to the main vi's diagram, or use "Select a VI..." from the functions palette. The main vi will not inherit the called vi's front panel: each specific vi describes specific processes using specific front panel terminals. Some configuration options (right click on front panel icon) in a subvi, such as the "Show Front Panel When Called" option, should be set carefully. There is such great information about this in the LabVIEW help about creating sub-VIs. I hope this helps!

 

 

Carla

 

 

National Instruments
Applications Engineer
0 Kudos
Message 2 of 4
(3,446 Views)
Hi Carla,

Thanks for the reply.
I attached 3 files. The 2 first files are PrintScrs of the block diagram (sequence6.jpg and sequence7.jpg).
As you can see, I created "DAQ_Assistance 3" and use it in sequence 6 with the input data (TRUE).
Then, in sequence 7, I created another "DAQ_Assistance 3" that has the same configuration than
"DAQ_Assistance 3" in sequence 6, but this time the input data is "FALSE".
What I want to do is shown in the sequence6_goal.jpg.
I want to have
"DAQ_Assistance 3" outside the sequences so I can input data from sequence6 and from sequence 7. Note that actually, I tried it, and it does not work.

Why do I want to do that?
My understanding is that if there are two "DAQ_assistance3"
(literally) in my vi, then I will be using dynamic memory to store two times the same DAQ information.
However, if I have only one 
"DAQ_assistance3" to which I input either "TRUE" or "FALSE" depending on the sequence, then I will be using   memory for only a single DAQ.
In a sense, it's like in a C program with a sub-function. Usually, the sub-function is defined once and you can use the same sub-function for different input data. In my current vi, I have the impression of writing twice the same sub-functions (
"DAQ_Assistance 3").

Thanks for your help.

JM

Download All
0 Kudos
Message 3 of 4
(3,439 Views)
Hi jmb22,
 
Thanks for the information. My first recommendation is to get rid of the stacked sequences and to use a state machine to set up your application. There is a great Developer Zone article that covers the basics on how to implement a state machine.
 
Also, can you explain a little more about your ultimate goal or application for the VI? I think that if we take a step back, we might be able to figure out what the best way to implement this would be. I hope this helps!
 
Carla
National Instruments
Applications Engineer
0 Kudos
Message 4 of 4
(3,413 Views)