Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Error with Simulink DAQ analog output

Hello, I have trouble outputting data with a NI USB 6211 device using the Analog Output block from the Data Acquisition Toolbox on Simulink.

 

I have been able to acquire signals with the Analog Input block, which makes me think it sholud be possible to output the signals the same way. This is the model that worked fine and the configuration I used:

 

 

 

 

 

 

 

Anyway, I keep getting the following error whenever I want to run the simulation using Analog Output:

 

Error reported by S-function 'sdaqao' in 'DAQ_Analog_Output/Analog Output':
To run in a hardware-clocked output mode, this hardware requires that at least
2 samples be queued using PUTDATA. You must pad your output with additional
samples to use PUTDATA, or use PUTSAMPLE instead.

 

I have tried writing the following code in the command window and then running the simulation:

 

ao = analogoutput('nidaq','Dev1');
ch = addchannel(ao,0:1);
y = [1 1]';
putdata(ao,[y y])

 

But the same error keeps comming out.

I also tried using Analog Output (Single Sample), but I have problems with the timing. For example, I generate a sin of some frequence but on the osciloscope I see another frequence and the simulation does not last what I put in the model.

I could acquire and output data writing code in the Command Window, but for my work I need to be able to do it on Simulink. I am using Matlbab R2012b.

This are the images of the model and the configuration of the block for Analog Output:

 

Analog_Output_Modelo_reducida.JPG

 

Analog_Output_Configuracion_Bloque_reducida.JPG

 

 Configuration_parameters_reducida.JPG

 

 

How can I output data using the Analog Output block? I really need to do this so any help will be very appreciated.

 

0 Kudos
Message 1 of 6
(5,012 Views)

Hi Idrim.

 

Are you giving a 2 point array to the putdata function? Does the error also ocurr if you give it more data points?

 

I found these examples for outputting data from Simulink, They could be good starting points to get you up and running:

 

http://www.mathworks.com/help/daq/examples/generate-signals-on-ni-devices-that-output-voltage.html

http://www.mathworks.com/help/daq/examples/generate-continuous-and-background-signals-using-ni-devic...

 

I hope these help you out.

 

Regards.

Aldo H
Ingenieria de Aplicaciones
0 Kudos
Message 2 of 6
(4,970 Views)

Hi,

 

I coludn't solve my problem with this information since I have already read the documentation that Mathworks offers to use the Data Acquisition Toolbox and there isn't any example that shows how to use the block I'm interested in clearly. The links you suggest tell how to do it on the Command Window, but I already did it and now I have to do it on Simulink. 

 

Thank you very much, anyway, for the quick answer and the help.

 

I.

 

 

 

 

0 Kudos
Message 3 of 6
(4,951 Views)

Hello All,

Any update about this issue?

I face a similar one.

0 Kudos
Message 4 of 6
(3,816 Views)

If anybody has solved this issue Let us know

0 Kudos
Message 5 of 6
(453 Views)

Hello @iamrajakr 

 

Did you solved that issue?

0 Kudos
Message 6 of 6
(300 Views)