Re: Independently controlling four random AI-triggered output



Ron,
I think that the best way to approach your project would be to use a
state machine architecture.  A state machine uses a while loop on
the outside and inside has a case structure that does different things
depending on the state.  You use shift registers to transfer
whatever data you want between iterations of the loop.  Data would
include booleans as to whether individual lines had passed a threshold,
etc.  Another advantage of this architecture is that you wouldn't
need to constantly start and stop and recreate tasks.  You would
simply continuously read from all of your channels.  To see how
conitinous aquisition works, open the NI Example Finder in the Help
Menu, go to Hardware Input and Output >> DAQmx >> Analog
Input >> Voltage >> Cont Acq&Graph -- Int Clk.vi. 
You'll notice in this example that there is a while loop that simply
reads a certain number of samples every iteration.  Inside this
loop you could put your state machine.  When your triggering
conditions are met you could use local variables, or some other
mechanism such as notifiers or semaphores to notify a separate,
independent loop or VI to write out to your digital channels.

You may want to take a look at the following tutorials on state machines <a href="http://zone.ni.com/devzone/conceptd.nsf/webmain/c74cec177a289dbd86256c4e00600196"; target="_blank">here</a> and <a href="http://zone.ni.com/devzone/conceptd.nsf/webmain/8c4eecacf084f8e986256802007b9186"; target="_blank">here.</a> Also check out the templates when creating a new VI.

Doug M
Applications Engineer
National Instruments
.



Relevant Pages

  • Re: microcontroller programming -- how to begin
    ... Do they have a main loop and a state machine? ... to stringing a bunch of switches in series/parallel strings. ... seems to be similar to putting together a bunch of relays. ... I would write a big event loop and make a case statement based on my ...
    (sci.electronics.design)
  • Re: finite state machine
    ... state machine to code that no longer looks like a finite state machine ... The switch statement will switch on the state and ... Then you have loop just like in the first ... function pointers, and you call the function you get out of the table. ...
    (comp.programming)
  • Re: Finding the execution time
    ... for k in 0 to loop ... Make yourself familiar with the concept of a state machine - especially a synthesizable state machine in VHDL. ... If you want to model real hardware you have to think hardware. ...
    (comp.lang.vhdl)
  • Re: How to implement State Machine
    ... you put two kind of state machine one inside of the other. ... you will be able to controle the elapsed time for one loop. ... For the user interface, use anothe loop with local variable that is read from the state machine. ...
    (comp.lang.labview)
  • Re: "continue/next" for "loop"
    ... It's not a state machine. ... Does it have to be at that low language level, ... connotations for other people, for example Perl programmers ... end loop; ...
    (comp.lang.ada)