Re: Independently controlling four random AI-triggered output
- From: Doug M <x@xxxxxxxx>
- Date: Fri, 5 Aug 2005 12:40:50 -0500 (CDT)
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
.
- References:
- Prev by Date: Need help with serial port
- Next by Date: Re: Independently controlling four random AI-triggered output
- Previous by thread: Independently controlling four random AI-triggered output
- Next by thread: Re: Independently controlling four random AI-triggered output
- Index(es):
Relevant Pages
|