How can I create an analog output?
Afficher commentaires plus anciens
Hello! This is my first article. Sorry if I have done any mistakes!
I try to create a analog output in MATLAB to control my Data Translation DT9834.
I need an output of 7 Volt. I will use a GUI with a pushbutton to start the signal. After 5 seconds the signal should be again 0 Volt.But there are any mistakes in my code. Maybe you can help me!
function analog_output_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
global ao;
ao = analogoutput('dtol', 0);
addchannel(ao, 0);
addchannel(ao, 1);
set(ao, 'TriggerType', 'Immediate');
putsample(ao, [0 0]);
guidata(hObject, handles);
----------------------------------------------------------
function pushbutton1_Callback(hObject, eventdata, handles)
global ao;
putsample(ao, [7 7]);
start(ao);
wait(ao,5);
putsample(ao,[0 0]);
When I start the button, it appears this error:
Error using daq.analogoutput_dtol_1_31/start
Data must be queued using PUTDATA before starting.
Error in daqdevice/start (line 62)
start( daqgetfield(obj,'uddobject') );
Error in analog_output>pushbutton1_Callback (line 102)
start(ao);
Error in gui_mainfcn (line 96)
feval(varargin{:});
Error in analog_output (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in
@(hObject,eventdata)analog_output('pushbutton1_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback
I hope you can help me. Best regards!
Domi
Réponses (0)
Catégories
En savoir plus sur Analog Filters dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!