How to que analog and digital output simultaneously?
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am trying to use two analog channels and one digital channel on a daq. I am passing the daq session_info a file called "trial_sequence" with a matrix called flicker_info of 3 columns of 0's and 1's, one column per channel. I know that the matrix file works becasue I've troubleshooted by using 3 analog channels and it works, but I need the third channel to go to a digital output.
However, I keep getting the following error:
"The hardware you are trying to use is already reserved"
Is there a way to queue digital output or not rely on outputSingleScan?
clear; clc; %clear everything
timeStarted = cputime;
daqreset; %reset DAQ in case it's still in use by a previous Matlab program
session_info = daq.createSession('ni');
session_info.IsContinuous = true; %for continuous background generation of the signal
sample_rate = 100000; %sample rate is 100k
session_info.Rate = sample_rate; %pass the sample rate to the DAQ
addAnalogOutputChannel(session_info,'Dev1', [2 3], 'Voltage'); % AO2 for sound, AO3 for LEDs
% start pump channel
addDigitalChannel(session_info,'Dev1','Port0/Line1', 'OutputOnly'); % port 0.1 on the DAQ
filename = 'trial_sequence.mat';
load(filename);
queueOutputData(session_info, flicker_info);
session_info.startBackground();
0 commentaires
Réponses (1)
Kavya Vuriti
le 2 Avr 2020
Hi,
I think the reserved hardware error is not due to digital channel. Here is an example showing how to generate signals on both analog and digital channels.
In this case, the reserved hardware error is expected because the vendor's NI-DAQmx driver does not allow two separate connections to the same subsystem at once.
Hope this helps!!
0 commentaires
Voir également
Catégories
En savoir plus sur Digital Input and Output dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!