LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

multiple cases in order

Hi all,
I'd like to use case structure to execute multiple cases in exact order (case 0, case 1, case 2,....case n). I don't want to use sequence structure since it executes whenever data is available, so sometimes I got case 3 executed before case 1, and so on. I saw the example Test sequencer.vi, but I wonder if it can be more simplify than that.
Please advice.
Thanks
 
0 Kudos
Message 1 of 7
(2,470 Views)
Put the Case structure inside a loop. Feed the case selectors in through an array with autoindexing. If you want to change the order, re-arrange the data in the array.

Lynn
0 Kudos
Message 2 of 7
(2,467 Views)

Lynn is certainly right. 🙂

However, I am totally confused by the following statement, because it make no sense with respect to your problem.


@dphan128 wrote:
I don't want to use sequence structure since it executes whenever data is available, so sometimes I got case 3 executed before case 1, and so on.
  1. How can a sequence structure scramble execution order??? A sequence structure is used to enforce execution order in cases where it is not determined by data dependency.
  2. Dataflow dictates that a structure executes when data to all inputs is available, there is nothing wrong with that. It even applies to Lynn's solution.

Can you show us an image of your sequence code? I don't understand at all what you are saying.


 

0 Kudos
Message 3 of 7
(2,461 Views)

Lynn,

Thanks for your help. But could you give me an example vi, please. I'm kind of slow in converting words into labview codes!

Thanks again.

Dan

0 Kudos
Message 4 of 7
(2,452 Views)
Dear Altenbach,
I'm still a novice in LabVIEW so I could be wrong in making such statement. But I think my problem lies within the code's logic, and it could acting as is the execution order is messed up. The bottom line is I don't know what is going on and I could make wrong assumption.
Thank you for your clarification.
Dan 
0 Kudos
Message 5 of 7
(2,448 Views)
How about a state machine.  It is simply a loop with a case structure in it.  See the attached vi, it has two examples of very simple state machines.  Advanced state machines can be made with queues and with shift registers.
 
 

Message Edited by tbob on 01-17-2007 12:59 PM

- tbob

Inventor of the WORM Global
Download All
0 Kudos
Message 6 of 7
(2,440 Views)

Thanks tbob,

Dan

0 Kudos
Message 7 of 7
(2,430 Views)