How to acquire data through Analog Input and use in a Digital Output with NI myDAQ?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I'm using a DAQ to acquire data through an Analog Port (AI:0) and need to use it to control 2 Digital Ports (D0:4;5 & D0:6;7). Using inputsingleScan I can only acquire 1 single scan from the Analog Input. I need to constantly update this scan in order to control the Digital Output. startForeground and startBackground seem to only work with Analog inputs and outputs.
I am taking data from a Photo-transistor and using it to change the direction of 2 motors.
So my question is, how can I continuously take scans using the Analog input to update the operations on the Digital Output?
0 Kommentare
Antworten (1)
Amit Doshi
am 7 Sep. 2017
Hello Danté,
You could use 'addlistener' to add a listener function to the session. This function is called every time the DataAvailable event occurs. Refer the below link :
Inside that function, you can loop through the acquired data and use the 'outputSingleScan' function to output the data to a digital channel. Refer the below link:
0 Kommentare
Siehe auch
Kategorien
Mehr zu Data Acquisition Toolbox Supported Hardware finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!