From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

NI DAQ digital output error -200288

Solved!
Go to solution

Hello all,

I am using Matlab to control PCI 6534. In the code I am trying to write Npulse(=3) no. of pulses. Pulse data is of size 1 X 1e5. When i try to write in the finite samples generation mode it throws error -200288 when writing the pulse data 3rd time. 1st two times it does not give any error.

The flow of code below is 1. Open 32 bit DO channel to write digital data at 10MHz clock.

2. Set it for finite sample genration, and disabel regeneration.

3. Write the first pulse data to buffer.

4. Start task

5. Write the next Npulse-1 number of pulse data

6. Wait till task is done and stop the task

 

clc;
inputDATA = uint32(100*randn(1,1e5));
NPulse = 3;
rate = 1e7;%10MHz

if(libisloaded('myni')~=1)
    [notfound warnings] = loadlibrary('nicaiu.dll','C:\Program Files\National Instruments\NI-DAQ\DAQmx ANSI C Dev\include\NIDAQmx.h','alias','myni');
end
taskh = libpointer('voidPtrPtr',0);
DOtaskhandle = taskh;
[errCode,taskName,DOtaskhandle] = calllib('myni','DAQmxCreateTask','',DOtaskhandle);
DOtaskhandle.setdatatype('voidPtrPtr');

DAQmx_Val_ChanForAllLines=int32(1);
DAQmx_Val_Rising = int32(10280);
DAQmx_Val_GroupByChannel = uint32(0);

DAQmx_Val_FiniteSamps = int32(10178);
DAQmx_Val_GroupByChannel = uint32(0);
DAQmx_Val_DoNotAllowRegen =int32(10158);
numSampsPerChannelWritten = libpointer('int32Ptr',0);
reserved = libpointer('uint32Ptr',[]);
data2 = libpointer('uint32Ptr',inputDATA);
 sampsPerChanToWrite = uint64(numel(inputDATA));
 inDataLen = uint32(numel(inputDATA));
sperchan = uint32(inDataLen);

[errCode,lineNames,nameoflines] = calllib('myni','DAQmxCreateDOChan',DOtaskhandle,['Dev1/port3,Dev1/port2,Dev1/port1,Dev1/port0'],'',DAQmx_Val_ChanForAllLines);
[errCode,clockType] = calllib('myni','DAQmxCfgSampClkTiming',DOtaskhandle,'OnboardClock',rate,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,sampsPerChanToWrite);
if(errCode ~=0)
    errMessage = 'Error while setting clock';
    calllib('myni','DAQmxStopTask',DOtaskhandle);
    calllib('myni','DAQmxClearTask',DOtaskhandle);
    return;
end
[errCode] = calllib('myni','DAQmxSetWriteRegenMode',DOtaskhandle, DAQmx_Val_DoNotAllowRegen);

[errCode,writeArray,numSampsPerChan,zz] = calllib('myni','DAQmxWriteDigitalU32',DOtaskhandle,sperchan,0,double(10),DAQmx_Val_GroupByChannel,data2,numSampsPerChannelWritten,reserved);
if(errCode ~=0)
    errMessage = 'Error while writing 1st Stimulation Data';
    calllib('myni','DAQmxStopTask',DOtaskhandle);
    calllib('myni','DAQmxClearTask',DOtaskhandle);
    disp(errMessage);
    return;
end

[errCode] = calllib('myni','DAQmxStartTask',DOtaskhandle);
if(errCode~=0)
    errMessage = ('Error in starting DAQmx task ');
    calllib('myni','DAQmxStopTask',DOtaskhandle);
    calllib('myni','DAQmxClearTask',DOtaskhandle);
    disp(errMessage);
    return;
end
for i = 1:NPulse-1
    [errCode,writeArray,numSampsPerChan,zz] = calllib('myni','DAQmxWriteDigitalU32',DOtaskhandle,sperchan,0,double(10),DAQmx_Val_GroupByChannel,data2,numSampsPerChannelWritten,reserved);
%     if(errCode ~=0)
%         errMessage = 'Error while writing Stimulation Data';
%         calllib('myni','DAQmxStopTask',DOtaskhandle);
%         calllib('myni','DAQmxClearTask',DOtaskhandle);
%         disp(errMessage);
%         return;
%     end
end


 IstaskDone = libpointer('voidPtr',logical(0));
[A11 A21 A31] = calllib('myni','DAQmxIsTaskDone', DOtaskhandle,IstaskDone );

while(A31==false)
    [A11 A21 A31] = calllib('myni','DAQmxIsTaskDone', DOtaskhandle,IstaskDone );
end


calllib('myni','DAQmxStopTask',DOtaskhandle);
calllib('myni','DAQmxClearTask',DOtaskhandle);

 

Can anyone please help me with this code. Is there some step I am missing or not setting any paramter?

Thanks,

 

Vani

 

0 Kudos
Message 1 of 5
(3,898 Views)
Solution
Accepted by topic author vanishree

Take a look at this:

 

Why Am I Getting Error -200288?

http://digital.ni.com/public.nsf/allkb/BFCE83133C0ECAD786256E6000814B68?OpenDocument

 

Are you using DAQmx or Traditional DAQ?

 

 

--Michelle

National Instruments
0 Kudos
Message 2 of 5
(3,866 Views)

Thank you for the reply.

I am using DAQmx, according to that other post I have to stop the tast after every pulse generation and start the task. According to my understanding this will make my consecutive pulse separation time dependent on my PC, which is not desired.

Basically I have a pulse/control data of size 1e6 of 32 bit words which I want to write as digital output on a PCI 6534 card 5 times and I want the clock to be at 10MHz. As the total data is huge(i.e 5e6) I can not fit it on onboard memory or sometimes not even on PC (when programming through Matlab, because the variable size exceeds available memory). If I use continous generation mode, I have to enable the regeneration because of high clock rate, but this leads to generation of more pulses than 5, depending on when the stoptask command gets executed.

In such case do you suggest me to go for finite genration mode? If so how do I specify that there is 5e6 data samples to generate before the task ends, and buffer size is set only to 1e6, and it has to be generated 5 times and then stop.

Thank you so much for the help 🙂

0 Kudos
Message 3 of 5
(3,851 Views)

Thanks for the help. It was a stupid mistake in my code. When setting up the task, the number of samples to write was 1e6, and i was trying to write data of 1e6 5 times. Now it works fine. Thank you

0 Kudos
Message 4 of 5
(3,838 Views)

I'm glad to here it's working now - good luck with the rest of your application!

 

 

--Michelle

National Instruments
0 Kudos
Message 5 of 5
(3,822 Views)