DO_WHILE Loop (Onboard Motion Control Programming)
This FlexMotion example demonstrates the implementation of a DO_WHILE loop data structure in an onboard program. The C equivalent of the data structure implemented here is:
do {
// code to be repeated
loopVar = loopVar - increment;
} while (loopVar != 0);
THEORY OF OPERATION:
The flow of the DO_WHILE loop data structure goes as follows:
(1) Program storage is begun.
(2) The DO_WHILE loop is set up. (Loop Variable and Increment are each defined and initialized.)
(3) A code delimiter is set using label #1.
(4) Code to be executed each time through loop is run (in the template program, the loop variable is decremented).
(5) The loop variable or other test condition is checked.
(6) If the test condition is true, then we jump back to label #1. Otherwise, the condition is false so the loop terminates.
(7) Program storage is ended.
DEVELOPMENT DETAILS:
Application Software: LabVIEW 5.0.x
Hardware: FlexMotion controller
Driver Software: FlexMotion Software 4.0
REQUIRED HARDWARE:
(controller only)
INSTRUCTIONS:
(0) Initialize the FlexMotion controller before running this VI.
(1) Add the FlexMotion functions you want to execute into the block diagram where noted.
(2) Run the VI to store the program. (The program will not be executed at this time.)
(3) You can then run the program you have stored by calling the run_prog.flx function with the appropriate program number.
ADDITIONAL NOTES:
(a) You should read the following items before writing FlexMotion onboard programs:
(1) The Onboard Programs section of the FlexMotion Hardware User Manual (page 4-9 in the November 1998 edition).
(2) The section about onboard variables in your FlexMotion Software Reference Manual (pages 4-11 and 4-12 in the November 1998 edition)
(3) You will find the chapter of the FlexMotion Software Reference Manual concerning the Onboard Programming functions to be an invaluable reference resource (Chapter 12 of the November 1998 edition) along with the online help for the VI functions.
(b) This template repeats the DO_WHILE loop as long as an expression with a variable evaluates to be true. However, you may evaluate other conditions such as move complete status instead.
Requirements
Filename: 2544.zip
Software Requirements
Application Software: LabVIEW Full Development System 5.0.1
Language(s): LabVIEW
Hardware Requirements
Hardware Group: Motion Control
Driver: NI-Motion
Reader Comments | Submit a comment »
Legal
This example program (this "program") was developed by a National Instruments ("NI") Applications Engineer. Although technical support of this program may be made available by National Instruments, this program may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this program with each new revision of related products and drivers. THIS EXAMPLE PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).
