Sinchronize analog output and analog input channels and queues

2 ビュー (過去 30 日間)
Sergey Makovkin
Sergey Makovkin 2016 年 5 月 4 日
回答済み: Emmanuel Aboagye 2019 年 4 月 10 日
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 件のコメント
Sergey Makovkin
Sergey Makovkin 2016 年 5 月 6 日
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

サインインしてコメントする。

回答 (1 件)

Emmanuel Aboagye
Emmanuel Aboagye 2019 年 4 月 10 日
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!

カテゴリ

Help Center および File ExchangeDigital Input and Output についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by