I am on a project reading a spectrometer and driving simultaneously a stepper motor.
I like to divide the program into the steps "Init Spec", "Read Spec", "Move Motor", "End".
The first part is called only once, the end part also.
From "Move Motor" the program should go back to "Read Spec" till the last position has
been reached.
For this i initialized a shiftregister of a while loop with an enum control element containing
the fields "Init Spec" .... "End" as above, but set on "Init Spec".
Inside the while loop i have a case structure which executes the program part related to
the selection of the enum field passed by the shift register.
Inside the different program parts i can switch the shift register, which represents the enum
to another value, so that i can for example go from "Move Motor" back to "Read Spec".
This works perfectly until i want to insert a new field into the enum. Than all enum constants
in the while loop contain only the old enum fields and the case identifiers of the case structure
don't display the enum constants anymore but only the numbers. This means, that i don't know
which case belongs to which enum field anymore.
Here is the description how to build up the vi:
1.) Setting up enum input element with fields "Init", "Read", "Move", "End"
2.) Select "Init" with the hand tool
2.5) Create While loop, create shift register
3.) Connect enum with outer side of shift register of the while loop
(Means that the integer corresponding to "Init" is passed into the while loop)
4.) Insert Case structure into while loop
5.) Connect the inner side of the shift register with the selector of the case structure (The identifiers of all avaiable cases of
the case structure should change to the names of the enum fields.
6.) Create block diagram for all fields of the enum and so for all cases of the case structure so that each case sets
the shift register to the index of the next case via an enum constant.
For an example what i mean above, that the identifiers get lost:
Add a new field to the enum. You see, that none of the constants inside the while loop will change also.
This is a pity, because they belong to the initializing enum and should all contain the same fields!
After that, the block diagram wil be messed up, because the routing via the enum constants does not work anymore.
Sneff
Message Edited by Sneff on
07-29-2008 09:41 AM