LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Delay

Hi,
      Currently i'm sequencing an numeric constant value into analog outputs, i was wondering is there any way i can include a delay before the analog output given out ? cause somehow i need the false constant which is in the same case loop as the 2 analog outputs which is supply to the digital port line to activate something before , i let the analog outputs out..
0 Kudos
Message 1 of 8
(3,637 Views)

Sorry, it is not clear what you mean. Could you add a few comments directly to the relevant parts of your diagram and re-attach the VI?

  • Which "false constant" are you talking about?
  • Which parts do you want to delay compared to what other parts?
  • What is a "case loop"?
  • What is "sequencing"?

 

 

0 Kudos
Message 2 of 8
(3,635 Views)

 

I'm sorry, Please see the new attached file.. As you can, in the while loop, its consisted of 3 "case structures" , the one i'm talking about is the one at the top whereby there is 3 outputs given out into 3 different DAQmx at the right side of the "case structure"... Inside the top " case structure" i believe, u can see that there are 2 analog outputs(orange in colour) and one digital output(green in colour), what i wanted is to include 1-2 seconds delay for the analog outputs to be activated after the digital output have been given out..

0 Kudos
Message 3 of 8
(3,631 Views)
There's either something weird going on with time, or you two were awake at 2 AM, based on the time given in your posts. Burning the overnight oil with LabVIEW?

To answer your question, just use the error cluster to force data dependency for the DAQ functions that generate the analog output. You can use the Time Delay VI found in the Timing palette since that has error in/error out clusters.
0 Kudos
Message 4 of 8
(3,605 Views)
OK, it seems you now removed the two parallel delays you added in the first attachment..
 
Execution order is determined by dataflow, so if you want a delay after the digital output, you would insert e.g. a "time delay" express VI and connect it to the error output of the last step of the digital out. Now user the error output from the time delay and branch it to connect to all the error inputs of each of the analog output parts. Since code cannot execute until all inputs contain data, delaying the error cluster will force all the AO tasks to be delayed.
 
Some other points:
  • You should use the error from the TCP, because if no packet is received (25 second TCP timeout!) you probably don't want to output anything.
  • It is extremely inefficient to create (and later clear) a new task for each output operation. The correct way is to create the tasks once outside the loop and keep only the write operations inside the loop. Closing the task should happen again outside the loop after the loop has finished.
  • Try to avoid coercions. You are randomly mixing orange and blue as if there was no difference. Make all you diagram constant consistent with the data.
  • Try to avoid overlapping and hidden objects and wires. For example is is not possible to tell what is connected to what output tunnel in the big case structure.
  • You use a switch as a stop button. This is not logical and has the wrong mechanical action. You probably want latch action and not switch action.
  • Use "in range and coerce" instead of two comparisons. Also since the output of the comparisons is only needed in the FALSE case, the comparison should be done inside the false case of the big case structure. Don't compute unless you actually need the result! 😄
  • Your two small "inner" cases output a TRUE under all conditions which you later OR. All this can be replaced by a single diagram constant. Actually, you could just invert the selector for the big case structure and not even take this boolean inside any cases.
  • Don't be afraid to branch a wire. You have several instances of the same diagram constant right next to each other (e.g. "-256"). Use one and branch to the following operations.
  • Name the items in your cluster diagram constant and use "unbundle by name". It will make the code much easier to read and avoids confusion and coding errors.
  • ...

Good luck! 🙂



Message Edited by altenbach on 12-31-2007 11:23 AM
0 Kudos
Message 5 of 8
(3,597 Views)
Hi smericio, i did not catch what u saying.. sorry.. But i tried editing.. Just hope you can help me check am i right? cause somehow my data get stuck and , does not respond to my input signal..
0 Kudos
Message 6 of 8
(3,555 Views)
Sorry i mean altenbach not smericio
 
Hi altenbach, i did not catch what u saying.. sorry.. But i tried editing.. Just hope you can help me check am i right? cause somehow my data get stuck and , does not respond to my input signal
0 Kudos
Message 7 of 8
(3,551 Views)
OK, I think you should start out with a few simple LabVIEW tutorials before trying to tackle such project.
 
Why would you add an infinite loop?????
 
You added a small WHILE loop that will spin until the stop condition is true. Since you wired a FALSE diagram constant to the stop condition, the small while loop will NEVER stop and since the big while loop cannot proceed to the next iteration until all parts have finished, it will be stuck at iteration zero forever!
 
Just remove that small inner while loop (only keeping the contents of it) and see if things improve. 😉 (right-click..remove while loop).
0 Kudos
Message 8 of 8
(3,530 Views)