Multifunction DAQ

Showing results for 
Search instead for 
Did you mean: 

Confused about error -89120

Go to solution

I'm trying to collect a set number of samples at a specified rate from an analog input channel (PCIE 6321).  I am using MATLAB and the NIDAQmx library (through myni) to communicate with the DAQ card. I'm using the code below. There are no errors until I run DAQmxStartTask, which returns error -89120. In the error list this is called DAQmxErrorInvalidRoutingSourceTerminalName_Routing but I have no clue what that means. Do any of you know what might be causing that?





%------------- Constants -----------------

num_chans = 2; %how many channels we collect data from
lockin_min_timeconst = 1*10^-3;
sampling_rate = cast(ceil(10/(lockin_min_timeconst)),'int32');
dwell_time = 5; %in miliseconds
pixel_dwell = dwell_time*10^-3; %this is how long the DAQ will collect data at a particular pixel. Units of seconds.
samps_per_chan = cast(ceil(sampling_rate*pixel_dwell),'uint64'); %number of samples the DAQ will collect on each active channel.
data_buffer = zeros(num_chans,samps_per_chan);
DAQmx_Val_Volts =10348; % Volts
DAQmx_Val_Diff = 10106; % Differential
DAQmx_Val_Rising = 10280;
DAQmx_Val_FiniteSamps =10178;
DAQmx_Val_ContSamps =10123;
DAQmx_Val_GroupByScanNumber =1;
DAQmx_Val_GroupByChannel = 0;
DAQmx_Val_ChanPerLine =0;

%------------- Create the task -----------------

TH = sprintf('%.0f', taskHandle); %I don't think this step is necessary?
task = uint32(str2double(TH));

%------------- Create the input channels -----------------
[E_init(1,1)]=calllib('myni','DAQmxCreateAIVoltageChan',task, strcat('Dev1/','ai1'),taskName,DAQmx_Val_Diff,-10,10, DAQmx_Val_Volts,'');

[E_init(2,1)]=calllib('myni','DAQmxCreateAIVoltageChan',task, strcat('Dev1/','ai2'),taskName,DAQmx_Val_Diff,-10,10, DAQmx_Val_Volts,'');

%------------- Configure up the clock -----------------
E_ClkConfig = calllib('myni','DAQmxCfgSampClkTiming',task,'NULL',sampling_rate, DAQmx_Val_Rising, DAQmx_Val_FiniteSamps, samps_per_chan);

%------------- Configure the buffer-----------------
[E_buffer] = calllib('myni','DAQmxCfgInputBuffer', task, samps_per_chan);

%------------- Start the task -----------------
[E_start] = calllib('myni','DAQmxStartTask', task);


0 Kudos
Message 1 of 3
Accepted by topic author ecating

Hello ecating,


 This is related to the source name you are using when defining your DAQmx Timing with the "DAQmxCfgSampClkTiming"  function. 


Here you may find some information about the "DAQmxCfgSampClkTiming" you are using.


  1. Could you please try using an empty string  "" instead of NULL in the Source parameter
  2.  Would this sample code help you as a reference maybe? It uses the same function as yours.



Message 2 of 3

Oh d'oh. Thanks, that was exactly it.



0 Kudos
Message 3 of 3