Analog Output advantech PCI1711
3 ビュー (過去 30 日間)
古いコメントを表示
Hello everybody,
I would like to use the "Analog Output"-Block of the Data Acquisition Toolbox for the advantech PCI1711 in one of my Simulink modells. Unfortunately I receive the following error:
Error reported by S-function 'sdaqao' in '.../Analog Output': The analog output subsystem of this device does not support clocked generation. With this hardware you must output individual samples using PUTSAMPLE and can not use a combination of PUTDATA and START.
To get around this error I wrote a Level-2 MATLAB S-function with the following code:
function analogoutput(block)
setup(block);
%endfunction
function setup(block)
% Register the number of ports.
block.NumInputPorts = 1;
block.NumOutputPorts = 0;
% Set up the port properties to be inherited or dynamic.
block.SetPreCompInpPortInfoToDynamic;
% Override the input port properties.
block.InputPort(1).DatatypeID = 0; %double
block.InputPort(1).Complexity = 'Real';
block.InputPort(1).Dimensions = 1;
% Register the parameters.
block.NumDialogPrms = 0;
block.SetAccelRunOnTLC(false);
block.SimStateCompliance = 'DefaultSimState';
block.RegBlockMethod('Outputs', @Outputs);
%endfunction
function Outputs(block)
output(block.InputPort(1).Data);
%endfuction
function output(u)
AO = analogoutput('advantech');
set(AO,'Samplerate',500);
chan = addchannel(AO, [0 1]);
putsample(AO, [0 u]); %0 Volt auf Channel 0 geben
delete(AO);
Unfortunately this is a very slow solution that takes 26,5 ms/call.
If you had an idea of a faster solution I would be very thankful!
Cheers, Malte
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Simulink Functions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!