Simulink and NI-Daq PCI-6251

2 views (last 30 days)
Misha Dabaghyan
Misha Dabaghyan on 18 Jun 2015
Edited: Walter Roberson on 18 Jun 2015
I can't seem to make Simulink recognize the device, while the script using the usual commands (see below) works just fine. Moreover, on another disk the same Simulink model worked great with the same version of matlab (2012b, 32-bit). But now I can't even tweak the settings in the "Analog Input" block (which is the starting block of the whole diagram and it complains that "Data acquisition device 'nidaq Dev1 (PCI-6251)' is unavailable. The 'winsound 0 (Microphone (high Definition Aud)' device will be selected"
Thanks in advance!
-Mike.
Here is the output of
devices = daq.getDevices
>> devices(1)
ans =
ni: National Instruments PCI-6251 (Device ID: 'Dev1')
Analog input subsystem supports:
7 ranges supported
Rates from 0.1 to 1250000.0 scans/sec
16 channels ('ai0' - 'ai15')
'Voltage' measurement type
Analog output subsystem supports:
-5.0 to +5.0 Volts,-10 to +10 Volts ranges
Rates from 0.1 to 2857142.9 scans/sec
2 channels ('ao0','ao1')
'Voltage' measurement type
Digital subsystem supports:
24 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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The code below runs without problems.
devices = daq.getDevices
devices(1)
s = daq.createSession('ni');
s.addAnalogInputChannel('Dev1', 0, 'Voltage');
s.Rate = 8000
[data,time] = s.startForeground;
%%Plot the Acquired Data
plot(time,data);
xlabel('Time (secs)');
ylabel('Voltage')

Answers (0)

Categories

Find more on Simultaneous and Synchronized Operations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!