필터 지우기
필터 지우기

Does the Digilent Toolbox Add-On work with Matlab Library Compiler?

조회 수: 5 (최근 30일)
Michael Sonnenberg
Michael Sonnenberg 2023년 4월 21일
편집: Vu Hoang Thang Chau 2024년 6월 13일
Does the Digilent Toolbox work with the Matlab Library compiler? I'm attempting to deploy a matlab .NET application, but when the deployed application runs the command
AO = daq("digilent")
it returns the exception "Specify an operational vendor" which tells me it doesn't have the Digilent Toolbox info included in the compiled application.
I also don't see Digilent Toolbox in the Suggested Support Packages in the Library Compiler application window.
  댓글 수: 3
Michael Sonnenberg
Michael Sonnenberg 2023년 4월 24일
편집: Michael Sonnenberg 2023년 4월 24일
Hi Vinayak, thanks for the response. See the code shown below. My problem is that "digilent" is not recognized as a daq option on the target machine specifically when this line of code is run:
AO = daq("digilent"); % DAQ session for the AWG channel
I installed MATLAB runtime on the target machine, and everything else seems to be working as expected. How do I ensure that the Digilent Toolbox is installed on the target machine? I was assuming it would be included when compiled, but this appears not to be the case...?
function [status] = FactoryThermalModuleVibrationCapture_ms00(capture_path,file_name,capture_time,duty)
% Required Hardware:
% Audio DAQ with ASIO driver and IEPE power. Currently using Echo AIO (Echo Test & Measurement)
% Power Source / Function Generator. Currently using Digilent Analog
% Discovery 2.
% capture_path - folder location on local drive
% file_name - wav file name = "asdf.wav"
% capture_time - time of capture in seconds
% duty - % duty cycle [0.0, 1.0]
% Initialize Audio Device:
fs = 48e3;
blocksize = 1024;
deviceReader = audioDeviceReader(...
'Driver','ASIO',...
'Device','ASIO Echo AIO',...
'SampleRate',fs,...
'BitDepth','24-bit integer',...
'ChannelMappingSource','Property',...
'ChannelMapping',[1,2]);
fileWriter = dsp.AudioFileWriter(file_name);
fileWriter.SampleRate = fs; % Capture at same sample rate as stimuli
fileWriter.FileFormat = "WAV";
fileWriter.DataType = "int24";
daqreset;
AO = daq("digilent"); % DAQ session for the AWG channel
VP = daq("digilent"); % DAQ session for the V+ power supply
% Start background +5V
addoutput(VP, "AD2_0", "V+", "Voltage");
VP.Rate = 10; % Rate is 10 Hz
T = 1; % Frame seconds
V = 5; % Amplitude
output01 = V*ones(VP.Rate*T,1);
start(VP,"repeatoutput");
write(VP,output01);
pause(3);
% Start background Analog Out PWM Signal
% Create the PWM signal
N = 40;
% n = 0:N-1;
PWM_fs = 25e3;
rate = N*PWM_fs;
% dt = 1/rate;
% T = N*dt;
% t = n/rate;
N_on = floor(N*duty);
N_off = N - N_on;
PWM_output = [5*ones(N_on,1); zeros(N_off,1)];
% hfig = figure(1);
% hfig.Visible = "on";
% hplot = plot(n,PWM_output);
% hplot.LineWidth = 1.5;
% grid on
% xlabel('Samples (n)')
% ylabel('PWM Out')
PWM_output = repmat(PWM_output,PWM_fs,1);
addoutput(AO, "AD2_0", "ao0" ,'Voltage');
AO.Rate = rate;
preload(AO,PWM_output);
cd(capture_path)
N_frames = ceil(capture_time*fs/blocksize);
N_OverRuns = zeros(N_frames,1);
ii_frame = 1;
start(AO,"repeatoutput");
pause(3);
while ii_frame <= N_frames
[acquiredAudio, N_OverRuns(ii_frame)] = deviceReader();
fileWriter(acquiredAudio);
ii_frame = ii_frame + 1;
end
release(deviceReader);
release(fileWriter);
stop(AO)
stop(VP)
if sum(N_OverRuns)
status = 0;
else
status = 1;
end
end
Vu Hoang Thang Chau
Vu Hoang Thang Chau 2024년 6월 13일
편집: Vu Hoang Thang Chau 2024년 6월 13일
Have you found a way to work around this? I actually have the same problem where both
daqlist;
daqvendorlist;
did not list anything in my standalone application at the beginning as well. However, I found a way through to be able to register 'digilent' devices to daqvendorlist by including Session.m, VendorInfo.m and DigilentAdaptor.mex64w into my standalone app package (also run DigilentAdaptor in the startup of the app). However, my app is still not able to find the connected device (by checking with daqlist it shows an empty variable). I've already installed all the required digilent toolbox and waveform driver though. Furthermore, my app runs fine when I exported as a Matlab App.
@Vinayak @MathWorks Support Team Could you help us sort this out? I think I am missing some libraries to include into the standalone package (high chance it might be FTDI library or some API with Waveform driver). I found that many people have similar problems, it would be nice if you could fix this and update official document to help other people out as well. I find Matlab App Designer is a wonderful tool to build simple programs interactively, but the lack of compatibility with other toolboxes is a frustrating experience to me.
I'm using R2023B version fyi.
KR,
Vu.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Signal Generation and Preprocessing에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by