How to acquire data through Analog Input and use in a Digital Output with NI myDAQ?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Amit Doshi
el 7 de Sept. de 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 comentarios
Ver también
Categorías
Más información sobre Data Acquisition Toolbox en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!