Sinchronize analog output and analog input channels and queues

1 visualizzazione (ultimi 30 giorni)
Hi, all!
A need to sinchronize analog output and analog input channels and queues on National Instruments PCI-6229 board. The properties of board is:
daq.getDevices
ans =
ni: National Instruments PCI-6229 (Device ID: 'Dev2')
Analog input subsystem supports:
4 ranges supported
Rates from 0.1 to 250000.0 scans/sec
32 channels ('ai0' - 'ai31')
'Voltage' measurement type
Analog output subsystem supports:
-10 to +10 Volts range
Rates from 0.1 to 833333.3 scans/sec
4 channels ('ao0','ao1','ao2','ao3')
'Voltage' measurement type
Digital subsystem supports:
Rates from 0.1 to 1000000.0 scans/sec
48 channels ('port0/line0' - 'port2/line7')
'InputOnly','OutputOnly','Bidirectional' measurement types
Counter input subsystem supports:
Rates from 0.1 to 80000000.0 scans/sec
2 channels ('ctr0','ctr1')
'EdgeCount','PulseWidth','Frequency','Position' measurement types
Counter output subsystem supports:
Rates from 0.1 to 80000000.0 scans/sec
2 channels ('ctr0','ctr1')
'PulseGeneration' measurement type
Properties, Methods, Events
I need to set AO and get AI synchronously and simultaneously with the speed of 250000.0 scans/sec in two parallel threads (queues). How can I do it?
  1 Commento
Sergey Makovkin
Sergey Makovkin il 6 Mag 2016
How can I make a synchronization between two sessions? AO and AI. I have a code:
aoSession = daq.createSession('ni');
aoSession.addAnalogOutputChannel('dev2', 0:1, 'Voltage');
rate = 250000;
aoSession.Rate = rate;
aiSession = daq.createSession('ni');
aiSession.addAnalogInputChannel('dev2', 'ai0', 'Voltage');
aiSession.Rate = 250000;
Xmin = -5;
Xmax = 5;
Ymin = -5;
Ymax = 5;
Xresolution = 256;
Yresolution = 256;
XX = 0;
YY = 0;
TimeCalculatingArray = 0;
tic
for iX = Xmin : (Xmax - Xmin)/(Xresolution-1) : Xmax
for iY = Ymin : (Ymax - Ymin)/(Yresolution-1) : Ymax
XX = [XX, iX];
YY = [YY, iY];
end
end
outputData(:,1) = XX;
outputData(:,2) = YY;
TimeCalculatingArray = toc
TimeQueue = 0;
tic
for i = 0:1:100
queueOutputData(aoSession, outputData);
end
TimeQueue = toc
TimeScaning = 0;
tic
startForeground(aoSession);
%%%%Here I what to start a synchronizide with AO session of Analog Input like that:
startForeground(aiSession);
%%%%
TimeScaning = toc

Accedi per commentare.

Risposte (1)

Emmanuel Aboagye
Emmanuel Aboagye il 10 Apr 2019
Hi guys!
I want to input and output analog signals using set velocity of +10V and -10V from an NI card to a servo drive? This +10V and -10V will be used to control the speed of an AC motor with an NI card. Please help me guys!

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by