Go to Post Their robot moves so fast that it changes colour due to the Dopler Effect. By rapidly alternating between driving away from the viewer (Redshift) and driving toward the viewer (Blueshift), they can make the viewer see it in their traditional purple colour. - philso [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 02-02-2009, 08:50
professorX professorX is offline
Registered User
AKA: Xavier
FRC #1660 (The Harlem Knights)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2005
Location: New York
Posts: 62
professorX is an unknown quantity at this point
Question Telling Labview which loop to execute first

I have two For Loops in Labview and I'm not sure how to tell it which loop to execute first.

In C language you would just have:
A For Loop {
...
}

B For Loop {
...
}

The first loop that it would execute would be the A Loop because its in the top.

So do I need to arrange the blocks some way so it does not execute both of the loops at the same time?
Reply With Quote
  #2   Spotlight this post!  
Unread 02-02-2009, 09:20
a3aperez's Avatar
a3aperez a3aperez is offline
Registered User
no team
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Puerto Rico
Posts: 9
a3aperez is an unknown quantity at this point
Re: Telling Labview which loop to execute first

Well, let's say you want your first For Loop to run 20 times. You could wire the 'i' in the For Loop to a Comparison. Compare the value of 'i' to 20, then make a Case Structure with the T/F value that results from that comparison. If the value is True, then run the second For Loop, if it's false, don't do anything.

Just tested it out and it works. You make one big For Loop, a Case Structure inside that For Loop that is only true when certain amount of iterations of the big For Loop have taken place and another For Loop inside the True value of the Case Structure.
Reply With Quote
  #3   Spotlight this post!  
Unread 02-02-2009, 09:23
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Telling Labview which loop to execute first

Nope. The sequencing is defined by dataflow. If one loop produces something that the other reads, they are automatically ordered. If no data dependency exists, LV assumes order isn't important and allows them to run at the same time.

If you want to order them, you can take an output of the first and wire it to the second, even if it isn't really needed. A better procedure if you are doing I/O -- which is where sequencing may also be important even where there is no data. Take the error wire from the I/O in the first loop, and wire to the input of the I/O in the second loop. This has the added benefit of actually chaining the errors.

Greg McKaskle
Reply With Quote
  #4   Spotlight this post!  
Unread 02-02-2009, 09:42
a3aperez's Avatar
a3aperez a3aperez is offline
Registered User
no team
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Puerto Rico
Posts: 9
a3aperez is an unknown quantity at this point
Re: Telling Labview which loop to execute first

Here's a demonstration of a For Loop executing before the second For Loop.

http://www.2shared.com/file/4782115/...For_Loops.html
Reply With Quote
  #5   Spotlight this post!  
Unread 02-02-2009, 12:15
professorX professorX is offline
Registered User
AKA: Xavier
FRC #1660 (The Harlem Knights)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2005
Location: New York
Posts: 62
professorX is an unknown quantity at this point
Re: Telling Labview which loop to execute first

Thank you.
Reply With Quote
  #6   Spotlight this post!  
Unread 02-02-2009, 15:15
RyanCahoon's Avatar
RyanCahoon RyanCahoon is offline
Disassembling my prior presumptions
FRC #0766 (M-A Bears)
Team Role: Engineer
 
Join Date: Dec 2007
Rookie Year: 2007
Location: Mountain View
Posts: 689
RyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond repute
Re: Telling Labview which loop to execute first

Or you can use a sequence structure, which is designed for this type of thing. Place the first for loop in the first frame of the sequence, the second for loop in the second frame. Use a flat sequence to make it really easy.

See here for reference

--Ryan
__________________
FRC 2046, 2007-2008, Student member
FRC 1708, 2009-2012, College mentor; 2013-2014, Mentor
FRC 766, 2015-, Mentor
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why is it telling me no code.... programmr C/C++ 5 28-01-2009 08:43
execute.h magical hands Programming 2 10-03-2007 21:02
EasyC: Execute code before autonomous Greg Marra Programming 7 07-01-2007 21:30
How I can execute Javascript into Perl? TomS Programming 3 22-08-2006 16:35
Pact of Secrecy (Stop Telling US!) Joe Matt Rules/Strategy 17 30-01-2002 01:02


All times are GMT -5. The time now is 21:33.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi