How can I modify output values during ongoing analog input acquisition?

4 visualizzazioni (ultimi 30 giorni)
I would like to acquire AI and monitor the incoming AI values - depending on these values, I'd like to generate AO (or digital output) values.
A simplified example: record AI0 at 1 kHz for 60 seconds. When AI0 signal exceeds +3V (and stays >3V for 2 seconds), change a DIO output line from LO to HI. By "when" I mean within ~100 ms of the condition.
I intend to use an NI USB device with multiple AO, AI and DIO channels (e.g. USB-6002 or USB-6341). My real world case will involved multiple AI channels, multiple AO channels, and multiple DIO channels (some in, some out).
Having read the documentation, it seems like I should start a background acquisition, register a callback for data acquired, and let the callback function analyze the acquired data and check whether the relevant condition is met. If the callback detects that the condition is met, I would then like to generate appropriate values on certain output channels. I don't know how to do that last part: how can my callback e.g. change a DIO output from LO to HI, but without affecting/pausing/interrupting the ongoing AI acquisition?
Thank you for your help!

Risposte (0)

Categorie

Scopri di più su Simultaneous and Synchronized Operations in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by